dd62ebe8f08fae0ffa3aaf55d346add79d2822a9
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2829 /// This corresponds to std::vector in C++
2830 pub struct CVec_PublicKeyZ {
2831         /// The elements in the array.
2832         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2833         pub data: *mut crate::c_types::PublicKey,
2834         /// The number of elements pointed to by `data`.
2835         pub datalen: usize
2836 }
2837 impl CVec_PublicKeyZ {
2838         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2839                 if self.datalen == 0 { return Vec::new(); }
2840                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2841                 self.data = core::ptr::null_mut();
2842                 self.datalen = 0;
2843                 ret
2844         }
2845         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2846                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2847         }
2848 }
2849 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2850         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2851                 let datalen = v.len();
2852                 let data = Box::into_raw(v.into_boxed_slice());
2853                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2854         }
2855 }
2856 #[no_mangle]
2857 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2858 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2859 impl Drop for CVec_PublicKeyZ {
2860         fn drop(&mut self) {
2861                 if self.datalen == 0 { return; }
2862                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2863         }
2864 }
2865 impl Clone for CVec_PublicKeyZ {
2866         fn clone(&self) -> Self {
2867                 let mut res = Vec::new();
2868                 if self.datalen == 0 { return Self::from(res); }
2869                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2870                 Self::from(res)
2871         }
2872 }
2873 #[repr(C)]
2874 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2875 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2876         /// A pointer to the contents in the success state.
2877         /// Reading from this pointer when `result_ok` is not set is undefined.
2878         pub result: *mut crate::lightning::util::events::PaymentPurpose,
2879         /// A pointer to the contents in the error state.
2880         /// Reading from this pointer when `result_ok` is set is undefined.
2881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2882 }
2883 #[repr(C)]
2884 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2885 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2887 pub struct CResult_PaymentPurposeDecodeErrorZ {
2888         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2889         /// `err` or `result` depending on the state of `result_ok`.
2890         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2891         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2892         pub result_ok: bool,
2893 }
2894 #[no_mangle]
2895 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2896 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2897         CResult_PaymentPurposeDecodeErrorZ {
2898                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2899                         result: Box::into_raw(Box::new(o)),
2900                 },
2901                 result_ok: true,
2902         }
2903 }
2904 #[no_mangle]
2905 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2906 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2907         CResult_PaymentPurposeDecodeErrorZ {
2908                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2909                         err: Box::into_raw(Box::new(e)),
2910                 },
2911                 result_ok: false,
2912         }
2913 }
2914 /// Checks if the given object is currently in the success state
2915 #[no_mangle]
2916 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2917         o.result_ok
2918 }
2919 #[no_mangle]
2920 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2921 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2922 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2923         fn drop(&mut self) {
2924                 if self.result_ok {
2925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2927                         }
2928                 } else {
2929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2931                         }
2932                 }
2933         }
2934 }
2935 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2937                 let contents = if o.result_ok {
2938                         let result = unsafe { o.contents.result };
2939                         unsafe { o.contents.result = core::ptr::null_mut() };
2940                         CResult_PaymentPurposeDecodeErrorZPtr { result }
2941                 } else {
2942                         let err = unsafe { o.contents.err };
2943                         unsafe { o.contents.err = core::ptr::null_mut(); }
2944                         CResult_PaymentPurposeDecodeErrorZPtr { err }
2945                 };
2946                 Self {
2947                         contents,
2948                         result_ok: o.result_ok,
2949                 }
2950         }
2951 }
2952 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2953         fn clone(&self) -> Self {
2954                 if self.result_ok {
2955                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2956                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
2957                         } }
2958                 } else {
2959                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
2960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2961                         } }
2962                 }
2963         }
2964 }
2965 #[no_mangle]
2966 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
2967 /// but with all dynamically-allocated buffers duplicated in new buffers.
2968 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
2969 #[repr(C)]
2970 #[derive(Clone)]
2971 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2972 pub enum COption_ClosureReasonZ {
2973         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2974         Some(crate::lightning::util::events::ClosureReason),
2975         /// When we're in this state, this COption_ClosureReasonZ contains nothing
2976         None
2977 }
2978 impl COption_ClosureReasonZ {
2979         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2980                 if let Self::None = self { false } else { true }
2981         }
2982         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2983                 !self.is_some()
2984         }
2985         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
2986                 if let Self::Some(v) = self { v } else { unreachable!() }
2987         }
2988 }
2989 #[no_mangle]
2990 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
2991 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
2992         COption_ClosureReasonZ::Some(o)
2993 }
2994 #[no_mangle]
2995 /// Constructs a new COption_ClosureReasonZ containing nothing
2996 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
2997         COption_ClosureReasonZ::None
2998 }
2999 #[no_mangle]
3000 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3001 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3002 #[no_mangle]
3003 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3004 /// but with all dynamically-allocated buffers duplicated in new buffers.
3005 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3006 #[repr(C)]
3007 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3008 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3009         /// A pointer to the contents in the success state.
3010         /// Reading from this pointer when `result_ok` is not set is undefined.
3011         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3012         /// A pointer to the contents in the error state.
3013         /// Reading from this pointer when `result_ok` is set is undefined.
3014         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3015 }
3016 #[repr(C)]
3017 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3018 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3019 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3020 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3021         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3022         /// `err` or `result` depending on the state of `result_ok`.
3023         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3024         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3025         pub result_ok: bool,
3026 }
3027 #[no_mangle]
3028 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3029 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3030         CResult_COption_ClosureReasonZDecodeErrorZ {
3031                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3032                         result: Box::into_raw(Box::new(o)),
3033                 },
3034                 result_ok: true,
3035         }
3036 }
3037 #[no_mangle]
3038 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3039 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3040         CResult_COption_ClosureReasonZDecodeErrorZ {
3041                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3042                         err: Box::into_raw(Box::new(e)),
3043                 },
3044                 result_ok: false,
3045         }
3046 }
3047 /// Checks if the given object is currently in the success state
3048 #[no_mangle]
3049 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3050         o.result_ok
3051 }
3052 #[no_mangle]
3053 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3054 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3055 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3056         fn drop(&mut self) {
3057                 if self.result_ok {
3058                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3059                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3060                         }
3061                 } else {
3062                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3063                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3064                         }
3065                 }
3066         }
3067 }
3068 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3069         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3070                 let contents = if o.result_ok {
3071                         let result = unsafe { o.contents.result };
3072                         unsafe { o.contents.result = core::ptr::null_mut() };
3073                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3074                 } else {
3075                         let err = unsafe { o.contents.err };
3076                         unsafe { o.contents.err = core::ptr::null_mut(); }
3077                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3078                 };
3079                 Self {
3080                         contents,
3081                         result_ok: o.result_ok,
3082                 }
3083         }
3084 }
3085 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3086         fn clone(&self) -> Self {
3087                 if self.result_ok {
3088                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3089                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3090                         } }
3091                 } else {
3092                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3093                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3094                         } }
3095                 }
3096         }
3097 }
3098 #[no_mangle]
3099 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3100 /// but with all dynamically-allocated buffers duplicated in new buffers.
3101 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3102 #[repr(C)]
3103 #[derive(Clone)]
3104 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3105 pub enum COption_NetworkUpdateZ {
3106         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3107         Some(crate::lightning::routing::gossip::NetworkUpdate),
3108         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3109         None
3110 }
3111 impl COption_NetworkUpdateZ {
3112         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3113                 if let Self::None = self { false } else { true }
3114         }
3115         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3116                 !self.is_some()
3117         }
3118         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3119                 if let Self::Some(v) = self { v } else { unreachable!() }
3120         }
3121 }
3122 #[no_mangle]
3123 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3124 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3125         COption_NetworkUpdateZ::Some(o)
3126 }
3127 #[no_mangle]
3128 /// Constructs a new COption_NetworkUpdateZ containing nothing
3129 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3130         COption_NetworkUpdateZ::None
3131 }
3132 #[no_mangle]
3133 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3134 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3135 #[no_mangle]
3136 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3137 /// but with all dynamically-allocated buffers duplicated in new buffers.
3138 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3139 #[repr(C)]
3140 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3141 /// This corresponds to std::vector in C++
3142 pub struct CVec_SpendableOutputDescriptorZ {
3143         /// The elements in the array.
3144         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3145         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3146         /// The number of elements pointed to by `data`.
3147         pub datalen: usize
3148 }
3149 impl CVec_SpendableOutputDescriptorZ {
3150         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3151                 if self.datalen == 0 { return Vec::new(); }
3152                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3153                 self.data = core::ptr::null_mut();
3154                 self.datalen = 0;
3155                 ret
3156         }
3157         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3158                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3159         }
3160 }
3161 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3162         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3163                 let datalen = v.len();
3164                 let data = Box::into_raw(v.into_boxed_slice());
3165                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3166         }
3167 }
3168 #[no_mangle]
3169 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3170 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3171 impl Drop for CVec_SpendableOutputDescriptorZ {
3172         fn drop(&mut self) {
3173                 if self.datalen == 0 { return; }
3174                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3175         }
3176 }
3177 impl Clone for CVec_SpendableOutputDescriptorZ {
3178         fn clone(&self) -> Self {
3179                 let mut res = Vec::new();
3180                 if self.datalen == 0 { return Self::from(res); }
3181                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3182                 Self::from(res)
3183         }
3184 }
3185 #[repr(C)]
3186 #[derive(Clone)]
3187 /// An enum which can either contain a crate::lightning::util::events::Event or not
3188 pub enum COption_EventZ {
3189         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3190         Some(crate::lightning::util::events::Event),
3191         /// When we're in this state, this COption_EventZ contains nothing
3192         None
3193 }
3194 impl COption_EventZ {
3195         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3196                 if let Self::None = self { false } else { true }
3197         }
3198         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3199                 !self.is_some()
3200         }
3201         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3202                 if let Self::Some(v) = self { v } else { unreachable!() }
3203         }
3204 }
3205 #[no_mangle]
3206 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3207 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3208         COption_EventZ::Some(o)
3209 }
3210 #[no_mangle]
3211 /// Constructs a new COption_EventZ containing nothing
3212 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3213         COption_EventZ::None
3214 }
3215 #[no_mangle]
3216 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3217 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3218 #[no_mangle]
3219 /// Creates a new COption_EventZ which has the same data as `orig`
3220 /// but with all dynamically-allocated buffers duplicated in new buffers.
3221 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3222 #[repr(C)]
3223 /// The contents of CResult_COption_EventZDecodeErrorZ
3224 pub union CResult_COption_EventZDecodeErrorZPtr {
3225         /// A pointer to the contents in the success state.
3226         /// Reading from this pointer when `result_ok` is not set is undefined.
3227         pub result: *mut crate::c_types::derived::COption_EventZ,
3228         /// A pointer to the contents in the error state.
3229         /// Reading from this pointer when `result_ok` is set is undefined.
3230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3231 }
3232 #[repr(C)]
3233 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3234 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3236 pub struct CResult_COption_EventZDecodeErrorZ {
3237         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3238         /// `err` or `result` depending on the state of `result_ok`.
3239         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3240         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3241         pub result_ok: bool,
3242 }
3243 #[no_mangle]
3244 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3245 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3246         CResult_COption_EventZDecodeErrorZ {
3247                 contents: CResult_COption_EventZDecodeErrorZPtr {
3248                         result: Box::into_raw(Box::new(o)),
3249                 },
3250                 result_ok: true,
3251         }
3252 }
3253 #[no_mangle]
3254 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3255 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3256         CResult_COption_EventZDecodeErrorZ {
3257                 contents: CResult_COption_EventZDecodeErrorZPtr {
3258                         err: Box::into_raw(Box::new(e)),
3259                 },
3260                 result_ok: false,
3261         }
3262 }
3263 /// Checks if the given object is currently in the success state
3264 #[no_mangle]
3265 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3266         o.result_ok
3267 }
3268 #[no_mangle]
3269 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3270 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3271 impl Drop for CResult_COption_EventZDecodeErrorZ {
3272         fn drop(&mut self) {
3273                 if self.result_ok {
3274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3276                         }
3277                 } else {
3278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3280                         }
3281                 }
3282         }
3283 }
3284 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3285         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3286                 let contents = if o.result_ok {
3287                         let result = unsafe { o.contents.result };
3288                         unsafe { o.contents.result = core::ptr::null_mut() };
3289                         CResult_COption_EventZDecodeErrorZPtr { result }
3290                 } else {
3291                         let err = unsafe { o.contents.err };
3292                         unsafe { o.contents.err = core::ptr::null_mut(); }
3293                         CResult_COption_EventZDecodeErrorZPtr { err }
3294                 };
3295                 Self {
3296                         contents,
3297                         result_ok: o.result_ok,
3298                 }
3299         }
3300 }
3301 impl Clone for CResult_COption_EventZDecodeErrorZ {
3302         fn clone(&self) -> Self {
3303                 if self.result_ok {
3304                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3305                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3306                         } }
3307                 } else {
3308                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3310                         } }
3311                 }
3312         }
3313 }
3314 #[no_mangle]
3315 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3318 #[repr(C)]
3319 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_MessageSendEventZ {
3322         /// The elements in the array.
3323         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3325         /// The number of elements pointed to by `data`.
3326         pub datalen: usize
3327 }
3328 impl CVec_MessageSendEventZ {
3329         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3330                 if self.datalen == 0 { return Vec::new(); }
3331                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332                 self.data = core::ptr::null_mut();
3333                 self.datalen = 0;
3334                 ret
3335         }
3336         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3337                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3338         }
3339 }
3340 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3341         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3342                 let datalen = v.len();
3343                 let data = Box::into_raw(v.into_boxed_slice());
3344                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3345         }
3346 }
3347 #[no_mangle]
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3350 impl Drop for CVec_MessageSendEventZ {
3351         fn drop(&mut self) {
3352                 if self.datalen == 0 { return; }
3353                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3354         }
3355 }
3356 impl Clone for CVec_MessageSendEventZ {
3357         fn clone(&self) -> Self {
3358                 let mut res = Vec::new();
3359                 if self.datalen == 0 { return Self::from(res); }
3360                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3361                 Self::from(res)
3362         }
3363 }
3364 #[repr(C)]
3365 /// The contents of CResult_TxOutAccessErrorZ
3366 pub union CResult_TxOutAccessErrorZPtr {
3367         /// A pointer to the contents in the success state.
3368         /// Reading from this pointer when `result_ok` is not set is undefined.
3369         pub result: *mut crate::c_types::TxOut,
3370         /// A pointer to the contents in the error state.
3371         /// Reading from this pointer when `result_ok` is set is undefined.
3372         pub err: *mut crate::lightning::chain::AccessError,
3373 }
3374 #[repr(C)]
3375 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3376 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3377 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3378 pub struct CResult_TxOutAccessErrorZ {
3379         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3380         /// `err` or `result` depending on the state of `result_ok`.
3381         pub contents: CResult_TxOutAccessErrorZPtr,
3382         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3383         pub result_ok: bool,
3384 }
3385 #[no_mangle]
3386 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3387 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3388         CResult_TxOutAccessErrorZ {
3389                 contents: CResult_TxOutAccessErrorZPtr {
3390                         result: Box::into_raw(Box::new(o)),
3391                 },
3392                 result_ok: true,
3393         }
3394 }
3395 #[no_mangle]
3396 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3397 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3398         CResult_TxOutAccessErrorZ {
3399                 contents: CResult_TxOutAccessErrorZPtr {
3400                         err: Box::into_raw(Box::new(e)),
3401                 },
3402                 result_ok: false,
3403         }
3404 }
3405 /// Checks if the given object is currently in the success state
3406 #[no_mangle]
3407 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3408         o.result_ok
3409 }
3410 #[no_mangle]
3411 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3412 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3413 impl Drop for CResult_TxOutAccessErrorZ {
3414         fn drop(&mut self) {
3415                 if self.result_ok {
3416                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3417                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3418                         }
3419                 } else {
3420                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3421                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3422                         }
3423                 }
3424         }
3425 }
3426 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3427         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3428                 let contents = if o.result_ok {
3429                         let result = unsafe { o.contents.result };
3430                         unsafe { o.contents.result = core::ptr::null_mut() };
3431                         CResult_TxOutAccessErrorZPtr { result }
3432                 } else {
3433                         let err = unsafe { o.contents.err };
3434                         unsafe { o.contents.err = core::ptr::null_mut(); }
3435                         CResult_TxOutAccessErrorZPtr { err }
3436                 };
3437                 Self {
3438                         contents,
3439                         result_ok: o.result_ok,
3440                 }
3441         }
3442 }
3443 impl Clone for CResult_TxOutAccessErrorZ {
3444         fn clone(&self) -> Self {
3445                 if self.result_ok {
3446                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3447                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3448                         } }
3449                 } else {
3450                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3451                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3452                         } }
3453                 }
3454         }
3455 }
3456 #[no_mangle]
3457 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3458 /// but with all dynamically-allocated buffers duplicated in new buffers.
3459 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3460 #[repr(C)]
3461 /// A tuple of 2 elements. See the individual fields for the types contained.
3462 pub struct C2Tuple_usizeTransactionZ {
3463         /// The element at position 0
3464         pub a: usize,
3465         /// The element at position 1
3466         pub b: crate::c_types::Transaction,
3467 }
3468 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3469         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3470                 Self {
3471                         a: tup.0,
3472                         b: tup.1,
3473                 }
3474         }
3475 }
3476 impl C2Tuple_usizeTransactionZ {
3477         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3478                 (self.a, self.b)
3479         }
3480 }
3481 impl Clone for C2Tuple_usizeTransactionZ {
3482         fn clone(&self) -> Self {
3483                 Self {
3484                         a: Clone::clone(&self.a),
3485                         b: Clone::clone(&self.b),
3486                 }
3487         }
3488 }
3489 #[no_mangle]
3490 /// Creates a new tuple which has the same data as `orig`
3491 /// but with all dynamically-allocated buffers duplicated in new buffers.
3492 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3493 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3494 #[no_mangle]
3495 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3496         C2Tuple_usizeTransactionZ { a, b, }
3497 }
3498
3499 #[no_mangle]
3500 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3501 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3502 #[repr(C)]
3503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3504 /// This corresponds to std::vector in C++
3505 pub struct CVec_C2Tuple_usizeTransactionZZ {
3506         /// The elements in the array.
3507         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3508         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3509         /// The number of elements pointed to by `data`.
3510         pub datalen: usize
3511 }
3512 impl CVec_C2Tuple_usizeTransactionZZ {
3513         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3514                 if self.datalen == 0 { return Vec::new(); }
3515                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3516                 self.data = core::ptr::null_mut();
3517                 self.datalen = 0;
3518                 ret
3519         }
3520         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3521                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3522         }
3523 }
3524 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3525         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3526                 let datalen = v.len();
3527                 let data = Box::into_raw(v.into_boxed_slice());
3528                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3529         }
3530 }
3531 #[no_mangle]
3532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3533 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3534 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3535         fn drop(&mut self) {
3536                 if self.datalen == 0 { return; }
3537                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3538         }
3539 }
3540 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3541         fn clone(&self) -> Self {
3542                 let mut res = Vec::new();
3543                 if self.datalen == 0 { return Self::from(res); }
3544                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3545                 Self::from(res)
3546         }
3547 }
3548 #[repr(C)]
3549 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3550 /// This corresponds to std::vector in C++
3551 pub struct CVec_TxidZ {
3552         /// The elements in the array.
3553         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3554         pub data: *mut crate::c_types::ThirtyTwoBytes,
3555         /// The number of elements pointed to by `data`.
3556         pub datalen: usize
3557 }
3558 impl CVec_TxidZ {
3559         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3560                 if self.datalen == 0 { return Vec::new(); }
3561                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3562                 self.data = core::ptr::null_mut();
3563                 self.datalen = 0;
3564                 ret
3565         }
3566         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3567                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3568         }
3569 }
3570 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3571         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3572                 let datalen = v.len();
3573                 let data = Box::into_raw(v.into_boxed_slice());
3574                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3579 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3580 impl Drop for CVec_TxidZ {
3581         fn drop(&mut self) {
3582                 if self.datalen == 0 { return; }
3583                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3584         }
3585 }
3586 impl Clone for CVec_TxidZ {
3587         fn clone(&self) -> Self {
3588                 let mut res = Vec::new();
3589                 if self.datalen == 0 { return Self::from(res); }
3590                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3591                 Self::from(res)
3592         }
3593 }
3594 #[repr(C)]
3595 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3596 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3597         /// Note that this value is always NULL, as there are no contents in the OK variant
3598         pub result: *mut core::ffi::c_void,
3599         /// A pointer to the contents in the error state.
3600         /// Reading from this pointer when `result_ok` is set is undefined.
3601         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3602 }
3603 #[repr(C)]
3604 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3605 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3607 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3608         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3609         /// `err` or `result` depending on the state of `result_ok`.
3610         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3611         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3612         pub result_ok: bool,
3613 }
3614 #[no_mangle]
3615 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3616 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3617         CResult_NoneChannelMonitorUpdateErrZ {
3618                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3619                         result: core::ptr::null_mut(),
3620                 },
3621                 result_ok: true,
3622         }
3623 }
3624 #[no_mangle]
3625 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3626 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3627         CResult_NoneChannelMonitorUpdateErrZ {
3628                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3629                         err: Box::into_raw(Box::new(e)),
3630                 },
3631                 result_ok: false,
3632         }
3633 }
3634 /// Checks if the given object is currently in the success state
3635 #[no_mangle]
3636 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3637         o.result_ok
3638 }
3639 #[no_mangle]
3640 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3641 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3642 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3643         fn drop(&mut self) {
3644                 if self.result_ok {
3645                 } else {
3646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3648                         }
3649                 }
3650         }
3651 }
3652 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3653         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3654                 let contents = if o.result_ok {
3655                         let _ = unsafe { Box::from_raw(o.contents.result) };
3656                         o.contents.result = core::ptr::null_mut();
3657                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3658                 } else {
3659                         let err = unsafe { o.contents.err };
3660                         unsafe { o.contents.err = core::ptr::null_mut(); }
3661                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3662                 };
3663                 Self {
3664                         contents,
3665                         result_ok: o.result_ok,
3666                 }
3667         }
3668 }
3669 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3670         fn clone(&self) -> Self {
3671                 if self.result_ok {
3672                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3673                                 result: core::ptr::null_mut()
3674                         } }
3675                 } else {
3676                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3677                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3678                         } }
3679                 }
3680         }
3681 }
3682 #[no_mangle]
3683 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3684 /// but with all dynamically-allocated buffers duplicated in new buffers.
3685 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3686 #[repr(C)]
3687 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3688 /// This corresponds to std::vector in C++
3689 pub struct CVec_MonitorEventZ {
3690         /// The elements in the array.
3691         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3692         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3693         /// The number of elements pointed to by `data`.
3694         pub datalen: usize
3695 }
3696 impl CVec_MonitorEventZ {
3697         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3698                 if self.datalen == 0 { return Vec::new(); }
3699                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3700                 self.data = core::ptr::null_mut();
3701                 self.datalen = 0;
3702                 ret
3703         }
3704         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3705                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3706         }
3707 }
3708 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3709         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3710                 let datalen = v.len();
3711                 let data = Box::into_raw(v.into_boxed_slice());
3712                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3713         }
3714 }
3715 #[no_mangle]
3716 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3717 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3718 impl Drop for CVec_MonitorEventZ {
3719         fn drop(&mut self) {
3720                 if self.datalen == 0 { return; }
3721                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3722         }
3723 }
3724 impl Clone for CVec_MonitorEventZ {
3725         fn clone(&self) -> Self {
3726                 let mut res = Vec::new();
3727                 if self.datalen == 0 { return Self::from(res); }
3728                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3729                 Self::from(res)
3730         }
3731 }
3732 #[repr(C)]
3733 /// A tuple of 2 elements. See the individual fields for the types contained.
3734 pub struct C2Tuple_OutPointCVec_MonitorEventZZ {
3735         /// The element at position 0
3736         pub a: crate::lightning::chain::transaction::OutPoint,
3737         /// The element at position 1
3738         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3739 }
3740 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)> for C2Tuple_OutPointCVec_MonitorEventZZ {
3741         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ)) -> Self {
3742                 Self {
3743                         a: tup.0,
3744                         b: tup.1,
3745                 }
3746         }
3747 }
3748 impl C2Tuple_OutPointCVec_MonitorEventZZ {
3749         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ) {
3750                 (self.a, self.b)
3751         }
3752 }
3753 impl Clone for C2Tuple_OutPointCVec_MonitorEventZZ {
3754         fn clone(&self) -> Self {
3755                 Self {
3756                         a: Clone::clone(&self.a),
3757                         b: Clone::clone(&self.b),
3758                 }
3759         }
3760 }
3761 #[no_mangle]
3762 /// Creates a new tuple which has the same data as `orig`
3763 /// but with all dynamically-allocated buffers duplicated in new buffers.
3764 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorEventZZ) -> C2Tuple_OutPointCVec_MonitorEventZZ { Clone::clone(&orig) }
3765 /// Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
3766 #[no_mangle]
3767 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ) -> C2Tuple_OutPointCVec_MonitorEventZZ {
3768         C2Tuple_OutPointCVec_MonitorEventZZ { a, b, }
3769 }
3770
3771 #[no_mangle]
3772 /// Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
3773 pub extern "C" fn C2Tuple_OutPointCVec_MonitorEventZZ_free(_res: C2Tuple_OutPointCVec_MonitorEventZZ) { }
3774 #[repr(C)]
3775 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
3776 /// This corresponds to std::vector in C++
3777 pub struct CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3778         /// The elements in the array.
3779         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3780         pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ,
3781         /// The number of elements pointed to by `data`.
3782         pub datalen: usize
3783 }
3784 impl CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3785         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ> {
3786                 if self.datalen == 0 { return Vec::new(); }
3787                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3788                 self.data = core::ptr::null_mut();
3789                 self.datalen = 0;
3790                 ret
3791         }
3792         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ] {
3793                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3794         }
3795 }
3796 impl From<Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>> for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3797         fn from(v: Vec<crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZ>) -> Self {
3798                 let datalen = v.len();
3799                 let data = Box::into_raw(v.into_boxed_slice());
3800                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3801         }
3802 }
3803 #[no_mangle]
3804 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3805 pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorEventZZZ) { }
3806 impl Drop for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3807         fn drop(&mut self) {
3808                 if self.datalen == 0 { return; }
3809                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3810         }
3811 }
3812 impl Clone for CVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
3813         fn clone(&self) -> Self {
3814                 let mut res = Vec::new();
3815                 if self.datalen == 0 { return Self::from(res); }
3816                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3817                 Self::from(res)
3818         }
3819 }
3820 #[repr(C)]
3821 #[derive(Clone)]
3822 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3823 pub enum COption_C2Tuple_usizeTransactionZZ {
3824         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3825         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3826         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3827         None
3828 }
3829 impl COption_C2Tuple_usizeTransactionZZ {
3830         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3831                 if let Self::None = self { false } else { true }
3832         }
3833         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3834                 !self.is_some()
3835         }
3836         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3837                 if let Self::Some(v) = self { v } else { unreachable!() }
3838         }
3839 }
3840 #[no_mangle]
3841 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3842 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3843         COption_C2Tuple_usizeTransactionZZ::Some(o)
3844 }
3845 #[no_mangle]
3846 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3847 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3848         COption_C2Tuple_usizeTransactionZZ::None
3849 }
3850 #[no_mangle]
3851 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3852 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3853 #[no_mangle]
3854 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3855 /// but with all dynamically-allocated buffers duplicated in new buffers.
3856 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3857 #[repr(C)]
3858 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3859 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3860         /// A pointer to the contents in the success state.
3861         /// Reading from this pointer when `result_ok` is not set is undefined.
3862         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3863         /// A pointer to the contents in the error state.
3864         /// Reading from this pointer when `result_ok` is set is undefined.
3865         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3866 }
3867 #[repr(C)]
3868 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3869 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3871 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3872         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3873         /// `err` or `result` depending on the state of `result_ok`.
3874         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3875         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3876         pub result_ok: bool,
3877 }
3878 #[no_mangle]
3879 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3880 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3881         CResult_FixedPenaltyScorerDecodeErrorZ {
3882                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3883                         result: Box::into_raw(Box::new(o)),
3884                 },
3885                 result_ok: true,
3886         }
3887 }
3888 #[no_mangle]
3889 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3890 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3891         CResult_FixedPenaltyScorerDecodeErrorZ {
3892                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3893                         err: Box::into_raw(Box::new(e)),
3894                 },
3895                 result_ok: false,
3896         }
3897 }
3898 /// Checks if the given object is currently in the success state
3899 #[no_mangle]
3900 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3901         o.result_ok
3902 }
3903 #[no_mangle]
3904 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3905 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3906 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3907         fn drop(&mut self) {
3908                 if self.result_ok {
3909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3911                         }
3912                 } else {
3913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3915                         }
3916                 }
3917         }
3918 }
3919 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3921                 let contents = if o.result_ok {
3922                         let result = unsafe { o.contents.result };
3923                         unsafe { o.contents.result = core::ptr::null_mut() };
3924                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3925                 } else {
3926                         let err = unsafe { o.contents.err };
3927                         unsafe { o.contents.err = core::ptr::null_mut(); }
3928                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3929                 };
3930                 Self {
3931                         contents,
3932                         result_ok: o.result_ok,
3933                 }
3934         }
3935 }
3936 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3937         fn clone(&self) -> Self {
3938                 if self.result_ok {
3939                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3940                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3941                         } }
3942                 } else {
3943                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3944                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3945                         } }
3946                 }
3947         }
3948 }
3949 #[no_mangle]
3950 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3951 /// but with all dynamically-allocated buffers duplicated in new buffers.
3952 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3953 #[repr(C)]
3954 /// A tuple of 2 elements. See the individual fields for the types contained.
3955 pub struct C2Tuple_u64u64Z {
3956         /// The element at position 0
3957         pub a: u64,
3958         /// The element at position 1
3959         pub b: u64,
3960 }
3961 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3962         fn from (tup: (u64, u64)) -> Self {
3963                 Self {
3964                         a: tup.0,
3965                         b: tup.1,
3966                 }
3967         }
3968 }
3969 impl C2Tuple_u64u64Z {
3970         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3971                 (self.a, self.b)
3972         }
3973 }
3974 impl Clone for C2Tuple_u64u64Z {
3975         fn clone(&self) -> Self {
3976                 Self {
3977                         a: Clone::clone(&self.a),
3978                         b: Clone::clone(&self.b),
3979                 }
3980         }
3981 }
3982 #[no_mangle]
3983 /// Creates a new tuple which has the same data as `orig`
3984 /// but with all dynamically-allocated buffers duplicated in new buffers.
3985 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
3986 /// Creates a new C2Tuple_u64u64Z from the contained elements.
3987 #[no_mangle]
3988 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
3989         C2Tuple_u64u64Z { a, b, }
3990 }
3991
3992 #[no_mangle]
3993 /// Frees any resources used by the C2Tuple_u64u64Z.
3994 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
3995 #[repr(C)]
3996 #[derive(Clone)]
3997 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
3998 pub enum COption_C2Tuple_u64u64ZZ {
3999         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4000         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4001         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4002         None
4003 }
4004 impl COption_C2Tuple_u64u64ZZ {
4005         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4006                 if let Self::None = self { false } else { true }
4007         }
4008         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4009                 !self.is_some()
4010         }
4011         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4012                 if let Self::Some(v) = self { v } else { unreachable!() }
4013         }
4014 }
4015 #[no_mangle]
4016 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4017 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4018         COption_C2Tuple_u64u64ZZ::Some(o)
4019 }
4020 #[no_mangle]
4021 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4022 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4023         COption_C2Tuple_u64u64ZZ::None
4024 }
4025 #[no_mangle]
4026 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4027 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4028 #[no_mangle]
4029 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4030 /// but with all dynamically-allocated buffers duplicated in new buffers.
4031 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4032 #[repr(C)]
4033 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4034 /// This corresponds to std::vector in C++
4035 pub struct CVec_NodeIdZ {
4036         /// The elements in the array.
4037         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4038         pub data: *mut crate::lightning::routing::gossip::NodeId,
4039         /// The number of elements pointed to by `data`.
4040         pub datalen: usize
4041 }
4042 impl CVec_NodeIdZ {
4043         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4044                 if self.datalen == 0 { return Vec::new(); }
4045                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4046                 self.data = core::ptr::null_mut();
4047                 self.datalen = 0;
4048                 ret
4049         }
4050         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4051                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4052         }
4053 }
4054 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4055         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4056                 let datalen = v.len();
4057                 let data = Box::into_raw(v.into_boxed_slice());
4058                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4059         }
4060 }
4061 #[no_mangle]
4062 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4063 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4064 impl Drop for CVec_NodeIdZ {
4065         fn drop(&mut self) {
4066                 if self.datalen == 0 { return; }
4067                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4068         }
4069 }
4070 impl Clone for CVec_NodeIdZ {
4071         fn clone(&self) -> Self {
4072                 let mut res = Vec::new();
4073                 if self.datalen == 0 { return Self::from(res); }
4074                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4075                 Self::from(res)
4076         }
4077 }
4078 #[repr(C)]
4079 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4080 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4081         /// A pointer to the contents in the success state.
4082         /// Reading from this pointer when `result_ok` is not set is undefined.
4083         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4084         /// A pointer to the contents in the error state.
4085         /// Reading from this pointer when `result_ok` is set is undefined.
4086         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4087 }
4088 #[repr(C)]
4089 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4090 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4091 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4092 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4093         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4094         /// `err` or `result` depending on the state of `result_ok`.
4095         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4096         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4097         pub result_ok: bool,
4098 }
4099 #[no_mangle]
4100 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4101 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4102         CResult_ProbabilisticScorerDecodeErrorZ {
4103                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4104                         result: Box::into_raw(Box::new(o)),
4105                 },
4106                 result_ok: true,
4107         }
4108 }
4109 #[no_mangle]
4110 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4111 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4112         CResult_ProbabilisticScorerDecodeErrorZ {
4113                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4114                         err: Box::into_raw(Box::new(e)),
4115                 },
4116                 result_ok: false,
4117         }
4118 }
4119 /// Checks if the given object is currently in the success state
4120 #[no_mangle]
4121 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4122         o.result_ok
4123 }
4124 #[no_mangle]
4125 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4126 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4127 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4128         fn drop(&mut self) {
4129                 if self.result_ok {
4130                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4131                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4132                         }
4133                 } else {
4134                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4135                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4136                         }
4137                 }
4138         }
4139 }
4140 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4141         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4142                 let contents = if o.result_ok {
4143                         let result = unsafe { o.contents.result };
4144                         unsafe { o.contents.result = core::ptr::null_mut() };
4145                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4146                 } else {
4147                         let err = unsafe { o.contents.err };
4148                         unsafe { o.contents.err = core::ptr::null_mut(); }
4149                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4150                 };
4151                 Self {
4152                         contents,
4153                         result_ok: o.result_ok,
4154                 }
4155         }
4156 }
4157 #[repr(C)]
4158 /// The contents of CResult_InitFeaturesDecodeErrorZ
4159 pub union CResult_InitFeaturesDecodeErrorZPtr {
4160         /// A pointer to the contents in the success state.
4161         /// Reading from this pointer when `result_ok` is not set is undefined.
4162         pub result: *mut crate::lightning::ln::features::InitFeatures,
4163         /// A pointer to the contents in the error state.
4164         /// Reading from this pointer when `result_ok` is set is undefined.
4165         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4166 }
4167 #[repr(C)]
4168 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4169 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4170 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4171 pub struct CResult_InitFeaturesDecodeErrorZ {
4172         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4173         /// `err` or `result` depending on the state of `result_ok`.
4174         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4175         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4176         pub result_ok: bool,
4177 }
4178 #[no_mangle]
4179 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4180 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4181         CResult_InitFeaturesDecodeErrorZ {
4182                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4183                         result: Box::into_raw(Box::new(o)),
4184                 },
4185                 result_ok: true,
4186         }
4187 }
4188 #[no_mangle]
4189 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4190 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4191         CResult_InitFeaturesDecodeErrorZ {
4192                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4193                         err: Box::into_raw(Box::new(e)),
4194                 },
4195                 result_ok: false,
4196         }
4197 }
4198 /// Checks if the given object is currently in the success state
4199 #[no_mangle]
4200 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4201         o.result_ok
4202 }
4203 #[no_mangle]
4204 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4205 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4206 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4207         fn drop(&mut self) {
4208                 if self.result_ok {
4209                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4210                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4211                         }
4212                 } else {
4213                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4214                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4215                         }
4216                 }
4217         }
4218 }
4219 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4220         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4221                 let contents = if o.result_ok {
4222                         let result = unsafe { o.contents.result };
4223                         unsafe { o.contents.result = core::ptr::null_mut() };
4224                         CResult_InitFeaturesDecodeErrorZPtr { result }
4225                 } else {
4226                         let err = unsafe { o.contents.err };
4227                         unsafe { o.contents.err = core::ptr::null_mut(); }
4228                         CResult_InitFeaturesDecodeErrorZPtr { err }
4229                 };
4230                 Self {
4231                         contents,
4232                         result_ok: o.result_ok,
4233                 }
4234         }
4235 }
4236 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4237         fn clone(&self) -> Self {
4238                 if self.result_ok {
4239                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4240                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4241                         } }
4242                 } else {
4243                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4244                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4245                         } }
4246                 }
4247         }
4248 }
4249 #[no_mangle]
4250 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4251 /// but with all dynamically-allocated buffers duplicated in new buffers.
4252 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4253 #[repr(C)]
4254 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4255 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4256         /// A pointer to the contents in the success state.
4257         /// Reading from this pointer when `result_ok` is not set is undefined.
4258         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4259         /// A pointer to the contents in the error state.
4260         /// Reading from this pointer when `result_ok` is set is undefined.
4261         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4262 }
4263 #[repr(C)]
4264 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4265 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4266 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4267 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4268         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4269         /// `err` or `result` depending on the state of `result_ok`.
4270         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4271         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4272         pub result_ok: bool,
4273 }
4274 #[no_mangle]
4275 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4276 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4277         CResult_ChannelFeaturesDecodeErrorZ {
4278                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4279                         result: Box::into_raw(Box::new(o)),
4280                 },
4281                 result_ok: true,
4282         }
4283 }
4284 #[no_mangle]
4285 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4286 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4287         CResult_ChannelFeaturesDecodeErrorZ {
4288                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4289                         err: Box::into_raw(Box::new(e)),
4290                 },
4291                 result_ok: false,
4292         }
4293 }
4294 /// Checks if the given object is currently in the success state
4295 #[no_mangle]
4296 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4297         o.result_ok
4298 }
4299 #[no_mangle]
4300 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4301 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4302 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4303         fn drop(&mut self) {
4304                 if self.result_ok {
4305                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4306                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4307                         }
4308                 } else {
4309                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4310                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4311                         }
4312                 }
4313         }
4314 }
4315 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4316         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4317                 let contents = if o.result_ok {
4318                         let result = unsafe { o.contents.result };
4319                         unsafe { o.contents.result = core::ptr::null_mut() };
4320                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4321                 } else {
4322                         let err = unsafe { o.contents.err };
4323                         unsafe { o.contents.err = core::ptr::null_mut(); }
4324                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4325                 };
4326                 Self {
4327                         contents,
4328                         result_ok: o.result_ok,
4329                 }
4330         }
4331 }
4332 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4333         fn clone(&self) -> Self {
4334                 if self.result_ok {
4335                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4336                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4337                         } }
4338                 } else {
4339                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4340                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4341                         } }
4342                 }
4343         }
4344 }
4345 #[no_mangle]
4346 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4347 /// but with all dynamically-allocated buffers duplicated in new buffers.
4348 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4349 #[repr(C)]
4350 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4351 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4352         /// A pointer to the contents in the success state.
4353         /// Reading from this pointer when `result_ok` is not set is undefined.
4354         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4355         /// A pointer to the contents in the error state.
4356         /// Reading from this pointer when `result_ok` is set is undefined.
4357         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4358 }
4359 #[repr(C)]
4360 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4361 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4362 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4363 pub struct CResult_NodeFeaturesDecodeErrorZ {
4364         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4365         /// `err` or `result` depending on the state of `result_ok`.
4366         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4367         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4368         pub result_ok: bool,
4369 }
4370 #[no_mangle]
4371 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4372 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4373         CResult_NodeFeaturesDecodeErrorZ {
4374                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4375                         result: Box::into_raw(Box::new(o)),
4376                 },
4377                 result_ok: true,
4378         }
4379 }
4380 #[no_mangle]
4381 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4382 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4383         CResult_NodeFeaturesDecodeErrorZ {
4384                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4385                         err: Box::into_raw(Box::new(e)),
4386                 },
4387                 result_ok: false,
4388         }
4389 }
4390 /// Checks if the given object is currently in the success state
4391 #[no_mangle]
4392 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4393         o.result_ok
4394 }
4395 #[no_mangle]
4396 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4397 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4398 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4399         fn drop(&mut self) {
4400                 if self.result_ok {
4401                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4402                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4403                         }
4404                 } else {
4405                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4406                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4407                         }
4408                 }
4409         }
4410 }
4411 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4412         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4413                 let contents = if o.result_ok {
4414                         let result = unsafe { o.contents.result };
4415                         unsafe { o.contents.result = core::ptr::null_mut() };
4416                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4417                 } else {
4418                         let err = unsafe { o.contents.err };
4419                         unsafe { o.contents.err = core::ptr::null_mut(); }
4420                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4421                 };
4422                 Self {
4423                         contents,
4424                         result_ok: o.result_ok,
4425                 }
4426         }
4427 }
4428 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4429         fn clone(&self) -> Self {
4430                 if self.result_ok {
4431                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4432                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4433                         } }
4434                 } else {
4435                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4436                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4437                         } }
4438                 }
4439         }
4440 }
4441 #[no_mangle]
4442 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4443 /// but with all dynamically-allocated buffers duplicated in new buffers.
4444 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4445 #[repr(C)]
4446 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4447 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4448         /// A pointer to the contents in the success state.
4449         /// Reading from this pointer when `result_ok` is not set is undefined.
4450         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4451         /// A pointer to the contents in the error state.
4452         /// Reading from this pointer when `result_ok` is set is undefined.
4453         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4454 }
4455 #[repr(C)]
4456 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4457 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4458 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4459 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4460         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4461         /// `err` or `result` depending on the state of `result_ok`.
4462         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4463         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4464         pub result_ok: bool,
4465 }
4466 #[no_mangle]
4467 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4468 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4469         CResult_InvoiceFeaturesDecodeErrorZ {
4470                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4471                         result: Box::into_raw(Box::new(o)),
4472                 },
4473                 result_ok: true,
4474         }
4475 }
4476 #[no_mangle]
4477 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4478 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4479         CResult_InvoiceFeaturesDecodeErrorZ {
4480                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4481                         err: Box::into_raw(Box::new(e)),
4482                 },
4483                 result_ok: false,
4484         }
4485 }
4486 /// Checks if the given object is currently in the success state
4487 #[no_mangle]
4488 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4489         o.result_ok
4490 }
4491 #[no_mangle]
4492 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4493 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4494 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4495         fn drop(&mut self) {
4496                 if self.result_ok {
4497                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4498                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4499                         }
4500                 } else {
4501                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4502                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4503                         }
4504                 }
4505         }
4506 }
4507 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4508         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4509                 let contents = if o.result_ok {
4510                         let result = unsafe { o.contents.result };
4511                         unsafe { o.contents.result = core::ptr::null_mut() };
4512                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4513                 } else {
4514                         let err = unsafe { o.contents.err };
4515                         unsafe { o.contents.err = core::ptr::null_mut(); }
4516                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4517                 };
4518                 Self {
4519                         contents,
4520                         result_ok: o.result_ok,
4521                 }
4522         }
4523 }
4524 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4525         fn clone(&self) -> Self {
4526                 if self.result_ok {
4527                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4528                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4529                         } }
4530                 } else {
4531                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4532                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4533                         } }
4534                 }
4535         }
4536 }
4537 #[no_mangle]
4538 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4539 /// but with all dynamically-allocated buffers duplicated in new buffers.
4540 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4541 #[repr(C)]
4542 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4543 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4544         /// A pointer to the contents in the success state.
4545         /// Reading from this pointer when `result_ok` is not set is undefined.
4546         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4547         /// A pointer to the contents in the error state.
4548         /// Reading from this pointer when `result_ok` is set is undefined.
4549         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4550 }
4551 #[repr(C)]
4552 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4553 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4554 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4555 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4556         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4557         /// `err` or `result` depending on the state of `result_ok`.
4558         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4559         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4560         pub result_ok: bool,
4561 }
4562 #[no_mangle]
4563 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4564 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4565         CResult_ChannelTypeFeaturesDecodeErrorZ {
4566                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4567                         result: Box::into_raw(Box::new(o)),
4568                 },
4569                 result_ok: true,
4570         }
4571 }
4572 #[no_mangle]
4573 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4574 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4575         CResult_ChannelTypeFeaturesDecodeErrorZ {
4576                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4577                         err: Box::into_raw(Box::new(e)),
4578                 },
4579                 result_ok: false,
4580         }
4581 }
4582 /// Checks if the given object is currently in the success state
4583 #[no_mangle]
4584 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4585         o.result_ok
4586 }
4587 #[no_mangle]
4588 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4589 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4590 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4591         fn drop(&mut self) {
4592                 if self.result_ok {
4593                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4594                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4595                         }
4596                 } else {
4597                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4598                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4599                         }
4600                 }
4601         }
4602 }
4603 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4604         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4605                 let contents = if o.result_ok {
4606                         let result = unsafe { o.contents.result };
4607                         unsafe { o.contents.result = core::ptr::null_mut() };
4608                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4609                 } else {
4610                         let err = unsafe { o.contents.err };
4611                         unsafe { o.contents.err = core::ptr::null_mut(); }
4612                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4613                 };
4614                 Self {
4615                         contents,
4616                         result_ok: o.result_ok,
4617                 }
4618         }
4619 }
4620 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4621         fn clone(&self) -> Self {
4622                 if self.result_ok {
4623                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4624                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4625                         } }
4626                 } else {
4627                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4628                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4629                         } }
4630                 }
4631         }
4632 }
4633 #[no_mangle]
4634 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4635 /// but with all dynamically-allocated buffers duplicated in new buffers.
4636 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4637 #[repr(C)]
4638 /// The contents of CResult_NodeIdDecodeErrorZ
4639 pub union CResult_NodeIdDecodeErrorZPtr {
4640         /// A pointer to the contents in the success state.
4641         /// Reading from this pointer when `result_ok` is not set is undefined.
4642         pub result: *mut crate::lightning::routing::gossip::NodeId,
4643         /// A pointer to the contents in the error state.
4644         /// Reading from this pointer when `result_ok` is set is undefined.
4645         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4646 }
4647 #[repr(C)]
4648 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4649 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4650 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4651 pub struct CResult_NodeIdDecodeErrorZ {
4652         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4653         /// `err` or `result` depending on the state of `result_ok`.
4654         pub contents: CResult_NodeIdDecodeErrorZPtr,
4655         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4656         pub result_ok: bool,
4657 }
4658 #[no_mangle]
4659 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4660 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4661         CResult_NodeIdDecodeErrorZ {
4662                 contents: CResult_NodeIdDecodeErrorZPtr {
4663                         result: Box::into_raw(Box::new(o)),
4664                 },
4665                 result_ok: true,
4666         }
4667 }
4668 #[no_mangle]
4669 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4670 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4671         CResult_NodeIdDecodeErrorZ {
4672                 contents: CResult_NodeIdDecodeErrorZPtr {
4673                         err: Box::into_raw(Box::new(e)),
4674                 },
4675                 result_ok: false,
4676         }
4677 }
4678 /// Checks if the given object is currently in the success state
4679 #[no_mangle]
4680 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4681         o.result_ok
4682 }
4683 #[no_mangle]
4684 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4685 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4686 impl Drop for CResult_NodeIdDecodeErrorZ {
4687         fn drop(&mut self) {
4688                 if self.result_ok {
4689                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4690                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4691                         }
4692                 } else {
4693                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4694                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4695                         }
4696                 }
4697         }
4698 }
4699 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4700         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4701                 let contents = if o.result_ok {
4702                         let result = unsafe { o.contents.result };
4703                         unsafe { o.contents.result = core::ptr::null_mut() };
4704                         CResult_NodeIdDecodeErrorZPtr { result }
4705                 } else {
4706                         let err = unsafe { o.contents.err };
4707                         unsafe { o.contents.err = core::ptr::null_mut(); }
4708                         CResult_NodeIdDecodeErrorZPtr { err }
4709                 };
4710                 Self {
4711                         contents,
4712                         result_ok: o.result_ok,
4713                 }
4714         }
4715 }
4716 impl Clone for CResult_NodeIdDecodeErrorZ {
4717         fn clone(&self) -> Self {
4718                 if self.result_ok {
4719                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4720                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4721                         } }
4722                 } else {
4723                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4724                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4725                         } }
4726                 }
4727         }
4728 }
4729 #[no_mangle]
4730 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4731 /// but with all dynamically-allocated buffers duplicated in new buffers.
4732 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4733 #[repr(C)]
4734 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4735 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4736         /// A pointer to the contents in the success state.
4737         /// Reading from this pointer when `result_ok` is not set is undefined.
4738         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4739         /// A pointer to the contents in the error state.
4740         /// Reading from this pointer when `result_ok` is set is undefined.
4741         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4742 }
4743 #[repr(C)]
4744 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4745 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4746 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4747 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4748         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4749         /// `err` or `result` depending on the state of `result_ok`.
4750         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4751         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4752         pub result_ok: bool,
4753 }
4754 #[no_mangle]
4755 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4756 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4757         CResult_COption_NetworkUpdateZDecodeErrorZ {
4758                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4759                         result: Box::into_raw(Box::new(o)),
4760                 },
4761                 result_ok: true,
4762         }
4763 }
4764 #[no_mangle]
4765 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4766 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4767         CResult_COption_NetworkUpdateZDecodeErrorZ {
4768                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4769                         err: Box::into_raw(Box::new(e)),
4770                 },
4771                 result_ok: false,
4772         }
4773 }
4774 /// Checks if the given object is currently in the success state
4775 #[no_mangle]
4776 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4777         o.result_ok
4778 }
4779 #[no_mangle]
4780 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4781 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4782 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4783         fn drop(&mut self) {
4784                 if self.result_ok {
4785                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4786                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4787                         }
4788                 } else {
4789                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4790                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4791                         }
4792                 }
4793         }
4794 }
4795 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4796         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4797                 let contents = if o.result_ok {
4798                         let result = unsafe { o.contents.result };
4799                         unsafe { o.contents.result = core::ptr::null_mut() };
4800                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4801                 } else {
4802                         let err = unsafe { o.contents.err };
4803                         unsafe { o.contents.err = core::ptr::null_mut(); }
4804                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4805                 };
4806                 Self {
4807                         contents,
4808                         result_ok: o.result_ok,
4809                 }
4810         }
4811 }
4812 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4813         fn clone(&self) -> Self {
4814                 if self.result_ok {
4815                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4816                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
4817                         } }
4818                 } else {
4819                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4820                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4821                         } }
4822                 }
4823         }
4824 }
4825 #[no_mangle]
4826 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
4827 /// but with all dynamically-allocated buffers duplicated in new buffers.
4828 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
4829 #[repr(C)]
4830 /// An enum which can either contain a crate::lightning::chain::Access or not
4831 pub enum COption_AccessZ {
4832         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4833         Some(crate::lightning::chain::Access),
4834         /// When we're in this state, this COption_AccessZ contains nothing
4835         None
4836 }
4837 impl COption_AccessZ {
4838         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4839                 if let Self::None = self { false } else { true }
4840         }
4841         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4842                 !self.is_some()
4843         }
4844         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
4845                 if let Self::Some(v) = self { v } else { unreachable!() }
4846         }
4847 }
4848 #[no_mangle]
4849 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
4850 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
4851         COption_AccessZ::Some(o)
4852 }
4853 #[no_mangle]
4854 /// Constructs a new COption_AccessZ containing nothing
4855 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
4856         COption_AccessZ::None
4857 }
4858 #[no_mangle]
4859 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
4860 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
4861 #[repr(C)]
4862 /// The contents of CResult_boolLightningErrorZ
4863 pub union CResult_boolLightningErrorZPtr {
4864         /// A pointer to the contents in the success state.
4865         /// Reading from this pointer when `result_ok` is not set is undefined.
4866         pub result: *mut bool,
4867         /// A pointer to the contents in the error state.
4868         /// Reading from this pointer when `result_ok` is set is undefined.
4869         pub err: *mut crate::lightning::ln::msgs::LightningError,
4870 }
4871 #[repr(C)]
4872 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
4873 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4875 pub struct CResult_boolLightningErrorZ {
4876         /// The contents of this CResult_boolLightningErrorZ, accessible via either
4877         /// `err` or `result` depending on the state of `result_ok`.
4878         pub contents: CResult_boolLightningErrorZPtr,
4879         /// Whether this CResult_boolLightningErrorZ represents a success state.
4880         pub result_ok: bool,
4881 }
4882 #[no_mangle]
4883 /// Creates a new CResult_boolLightningErrorZ in the success state.
4884 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
4885         CResult_boolLightningErrorZ {
4886                 contents: CResult_boolLightningErrorZPtr {
4887                         result: Box::into_raw(Box::new(o)),
4888                 },
4889                 result_ok: true,
4890         }
4891 }
4892 #[no_mangle]
4893 /// Creates a new CResult_boolLightningErrorZ in the error state.
4894 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
4895         CResult_boolLightningErrorZ {
4896                 contents: CResult_boolLightningErrorZPtr {
4897                         err: Box::into_raw(Box::new(e)),
4898                 },
4899                 result_ok: false,
4900         }
4901 }
4902 /// Checks if the given object is currently in the success state
4903 #[no_mangle]
4904 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
4905         o.result_ok
4906 }
4907 #[no_mangle]
4908 /// Frees any resources used by the CResult_boolLightningErrorZ.
4909 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
4910 impl Drop for CResult_boolLightningErrorZ {
4911         fn drop(&mut self) {
4912                 if self.result_ok {
4913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4915                         }
4916                 } else {
4917                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4918                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4919                         }
4920                 }
4921         }
4922 }
4923 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
4924         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
4925                 let contents = if o.result_ok {
4926                         let result = unsafe { o.contents.result };
4927                         unsafe { o.contents.result = core::ptr::null_mut() };
4928                         CResult_boolLightningErrorZPtr { result }
4929                 } else {
4930                         let err = unsafe { o.contents.err };
4931                         unsafe { o.contents.err = core::ptr::null_mut(); }
4932                         CResult_boolLightningErrorZPtr { err }
4933                 };
4934                 Self {
4935                         contents,
4936                         result_ok: o.result_ok,
4937                 }
4938         }
4939 }
4940 impl Clone for CResult_boolLightningErrorZ {
4941         fn clone(&self) -> Self {
4942                 if self.result_ok {
4943                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
4944                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
4945                         } }
4946                 } else {
4947                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
4948                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4949                         } }
4950                 }
4951         }
4952 }
4953 #[no_mangle]
4954 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
4955 /// but with all dynamically-allocated buffers duplicated in new buffers.
4956 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
4957 #[repr(C)]
4958 /// A tuple of 3 elements. See the individual fields for the types contained.
4959 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4960         /// The element at position 0
4961         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
4962         /// The element at position 1
4963         pub b: crate::lightning::ln::msgs::ChannelUpdate,
4964         /// The element at position 2
4965         pub c: crate::lightning::ln::msgs::ChannelUpdate,
4966 }
4967 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4968         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
4969                 Self {
4970                         a: tup.0,
4971                         b: tup.1,
4972                         c: tup.2,
4973                 }
4974         }
4975 }
4976 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4977         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
4978                 (self.a, self.b, self.c)
4979         }
4980 }
4981 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4982         fn clone(&self) -> Self {
4983                 Self {
4984                         a: Clone::clone(&self.a),
4985                         b: Clone::clone(&self.b),
4986                         c: Clone::clone(&self.c),
4987                 }
4988         }
4989 }
4990 #[no_mangle]
4991 /// Creates a new tuple which has the same data as `orig`
4992 /// but with all dynamically-allocated buffers duplicated in new buffers.
4993 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
4994 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
4995 #[no_mangle]
4996 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 {
4997         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
4998 }
4999
5000 #[no_mangle]
5001 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5002 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5003 #[repr(C)]
5004 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5005 /// This corresponds to std::vector in C++
5006 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5007         /// The elements in the array.
5008         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5009         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
5010         /// The number of elements pointed to by `data`.
5011         pub datalen: usize
5012 }
5013 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5014         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
5015                 if self.datalen == 0 { return Vec::new(); }
5016                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5017                 self.data = core::ptr::null_mut();
5018                 self.datalen = 0;
5019                 ret
5020         }
5021         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
5022                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5023         }
5024 }
5025 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5026         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
5027                 let datalen = v.len();
5028                 let data = Box::into_raw(v.into_boxed_slice());
5029                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5030         }
5031 }
5032 #[no_mangle]
5033 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5034 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5035 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5036         fn drop(&mut self) {
5037                 if self.datalen == 0 { return; }
5038                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5039         }
5040 }
5041 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5042         fn clone(&self) -> Self {
5043                 let mut res = Vec::new();
5044                 if self.datalen == 0 { return Self::from(res); }
5045                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5046                 Self::from(res)
5047         }
5048 }
5049 #[repr(C)]
5050 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5051 /// This corresponds to std::vector in C++
5052 pub struct CVec_NodeAnnouncementZ {
5053         /// The elements in the array.
5054         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5055         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
5056         /// The number of elements pointed to by `data`.
5057         pub datalen: usize
5058 }
5059 impl CVec_NodeAnnouncementZ {
5060         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
5061                 if self.datalen == 0 { return Vec::new(); }
5062                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5063                 self.data = core::ptr::null_mut();
5064                 self.datalen = 0;
5065                 ret
5066         }
5067         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
5068                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5069         }
5070 }
5071 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
5072         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
5073                 let datalen = v.len();
5074                 let data = Box::into_raw(v.into_boxed_slice());
5075                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5076         }
5077 }
5078 #[no_mangle]
5079 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5080 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
5081 impl Drop for CVec_NodeAnnouncementZ {
5082         fn drop(&mut self) {
5083                 if self.datalen == 0 { return; }
5084                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5085         }
5086 }
5087 impl Clone for CVec_NodeAnnouncementZ {
5088         fn clone(&self) -> Self {
5089                 let mut res = Vec::new();
5090                 if self.datalen == 0 { return Self::from(res); }
5091                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5092                 Self::from(res)
5093         }
5094 }
5095 #[repr(C)]
5096 /// The contents of CResult_NoneLightningErrorZ
5097 pub union CResult_NoneLightningErrorZPtr {
5098         /// Note that this value is always NULL, as there are no contents in the OK variant
5099         pub result: *mut core::ffi::c_void,
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::LightningError,
5103 }
5104 #[repr(C)]
5105 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5106 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5108 pub struct CResult_NoneLightningErrorZ {
5109         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5110         /// `err` or `result` depending on the state of `result_ok`.
5111         pub contents: CResult_NoneLightningErrorZPtr,
5112         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5113         pub result_ok: bool,
5114 }
5115 #[no_mangle]
5116 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5117 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5118         CResult_NoneLightningErrorZ {
5119                 contents: CResult_NoneLightningErrorZPtr {
5120                         result: core::ptr::null_mut(),
5121                 },
5122                 result_ok: true,
5123         }
5124 }
5125 #[no_mangle]
5126 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5127 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5128         CResult_NoneLightningErrorZ {
5129                 contents: CResult_NoneLightningErrorZPtr {
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_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5138         o.result_ok
5139 }
5140 #[no_mangle]
5141 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5142 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5143 impl Drop for CResult_NoneLightningErrorZ {
5144         fn drop(&mut self) {
5145                 if self.result_ok {
5146                 } else {
5147                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5148                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5149                         }
5150                 }
5151         }
5152 }
5153 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5154         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5155                 let contents = if o.result_ok {
5156                         let _ = unsafe { Box::from_raw(o.contents.result) };
5157                         o.contents.result = core::ptr::null_mut();
5158                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5159                 } else {
5160                         let err = unsafe { o.contents.err };
5161                         unsafe { o.contents.err = core::ptr::null_mut(); }
5162                         CResult_NoneLightningErrorZPtr { err }
5163                 };
5164                 Self {
5165                         contents,
5166                         result_ok: o.result_ok,
5167                 }
5168         }
5169 }
5170 impl Clone for CResult_NoneLightningErrorZ {
5171         fn clone(&self) -> Self {
5172                 if self.result_ok {
5173                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5174                                 result: core::ptr::null_mut()
5175                         } }
5176                 } else {
5177                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5178                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5179                         } }
5180                 }
5181         }
5182 }
5183 #[no_mangle]
5184 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5185 /// but with all dynamically-allocated buffers duplicated in new buffers.
5186 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5187 #[repr(C)]
5188 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5189 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5190         /// A pointer to the contents in the success state.
5191         /// Reading from this pointer when `result_ok` is not set is undefined.
5192         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5193         /// A pointer to the contents in the error state.
5194         /// Reading from this pointer when `result_ok` is set is undefined.
5195         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5196 }
5197 #[repr(C)]
5198 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5199 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5200 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5201 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5202         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5203         /// `err` or `result` depending on the state of `result_ok`.
5204         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5205         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5206         pub result_ok: bool,
5207 }
5208 #[no_mangle]
5209 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5210 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5211         CResult_ChannelUpdateInfoDecodeErrorZ {
5212                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5213                         result: Box::into_raw(Box::new(o)),
5214                 },
5215                 result_ok: true,
5216         }
5217 }
5218 #[no_mangle]
5219 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5220 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5221         CResult_ChannelUpdateInfoDecodeErrorZ {
5222                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5223                         err: Box::into_raw(Box::new(e)),
5224                 },
5225                 result_ok: false,
5226         }
5227 }
5228 /// Checks if the given object is currently in the success state
5229 #[no_mangle]
5230 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5231         o.result_ok
5232 }
5233 #[no_mangle]
5234 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5235 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5236 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5237         fn drop(&mut self) {
5238                 if self.result_ok {
5239                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5240                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5241                         }
5242                 } else {
5243                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5244                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5245                         }
5246                 }
5247         }
5248 }
5249 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5250         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5251                 let contents = if o.result_ok {
5252                         let result = unsafe { o.contents.result };
5253                         unsafe { o.contents.result = core::ptr::null_mut() };
5254                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5255                 } else {
5256                         let err = unsafe { o.contents.err };
5257                         unsafe { o.contents.err = core::ptr::null_mut(); }
5258                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5259                 };
5260                 Self {
5261                         contents,
5262                         result_ok: o.result_ok,
5263                 }
5264         }
5265 }
5266 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5267         fn clone(&self) -> Self {
5268                 if self.result_ok {
5269                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5270                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5271                         } }
5272                 } else {
5273                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5274                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5275                         } }
5276                 }
5277         }
5278 }
5279 #[no_mangle]
5280 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5281 /// but with all dynamically-allocated buffers duplicated in new buffers.
5282 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5283 #[repr(C)]
5284 /// The contents of CResult_ChannelInfoDecodeErrorZ
5285 pub union CResult_ChannelInfoDecodeErrorZPtr {
5286         /// A pointer to the contents in the success state.
5287         /// Reading from this pointer when `result_ok` is not set is undefined.
5288         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5289         /// A pointer to the contents in the error state.
5290         /// Reading from this pointer when `result_ok` is set is undefined.
5291         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5292 }
5293 #[repr(C)]
5294 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5295 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5296 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5297 pub struct CResult_ChannelInfoDecodeErrorZ {
5298         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5299         /// `err` or `result` depending on the state of `result_ok`.
5300         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5301         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5302         pub result_ok: bool,
5303 }
5304 #[no_mangle]
5305 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5306 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5307         CResult_ChannelInfoDecodeErrorZ {
5308                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5309                         result: Box::into_raw(Box::new(o)),
5310                 },
5311                 result_ok: true,
5312         }
5313 }
5314 #[no_mangle]
5315 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5316 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5317         CResult_ChannelInfoDecodeErrorZ {
5318                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5319                         err: Box::into_raw(Box::new(e)),
5320                 },
5321                 result_ok: false,
5322         }
5323 }
5324 /// Checks if the given object is currently in the success state
5325 #[no_mangle]
5326 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5327         o.result_ok
5328 }
5329 #[no_mangle]
5330 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5331 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5332 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5333         fn drop(&mut self) {
5334                 if self.result_ok {
5335                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5336                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5337                         }
5338                 } else {
5339                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5340                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5341                         }
5342                 }
5343         }
5344 }
5345 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5346         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5347                 let contents = if o.result_ok {
5348                         let result = unsafe { o.contents.result };
5349                         unsafe { o.contents.result = core::ptr::null_mut() };
5350                         CResult_ChannelInfoDecodeErrorZPtr { result }
5351                 } else {
5352                         let err = unsafe { o.contents.err };
5353                         unsafe { o.contents.err = core::ptr::null_mut(); }
5354                         CResult_ChannelInfoDecodeErrorZPtr { err }
5355                 };
5356                 Self {
5357                         contents,
5358                         result_ok: o.result_ok,
5359                 }
5360         }
5361 }
5362 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5363         fn clone(&self) -> Self {
5364                 if self.result_ok {
5365                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5366                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5367                         } }
5368                 } else {
5369                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5370                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5371                         } }
5372                 }
5373         }
5374 }
5375 #[no_mangle]
5376 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5377 /// but with all dynamically-allocated buffers duplicated in new buffers.
5378 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5379 #[repr(C)]
5380 /// The contents of CResult_RoutingFeesDecodeErrorZ
5381 pub union CResult_RoutingFeesDecodeErrorZPtr {
5382         /// A pointer to the contents in the success state.
5383         /// Reading from this pointer when `result_ok` is not set is undefined.
5384         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5385         /// A pointer to the contents in the error state.
5386         /// Reading from this pointer when `result_ok` is set is undefined.
5387         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5388 }
5389 #[repr(C)]
5390 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5391 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5393 pub struct CResult_RoutingFeesDecodeErrorZ {
5394         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5395         /// `err` or `result` depending on the state of `result_ok`.
5396         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5397         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5398         pub result_ok: bool,
5399 }
5400 #[no_mangle]
5401 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5402 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5403         CResult_RoutingFeesDecodeErrorZ {
5404                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5405                         result: Box::into_raw(Box::new(o)),
5406                 },
5407                 result_ok: true,
5408         }
5409 }
5410 #[no_mangle]
5411 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5412 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5413         CResult_RoutingFeesDecodeErrorZ {
5414                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5415                         err: Box::into_raw(Box::new(e)),
5416                 },
5417                 result_ok: false,
5418         }
5419 }
5420 /// Checks if the given object is currently in the success state
5421 #[no_mangle]
5422 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5423         o.result_ok
5424 }
5425 #[no_mangle]
5426 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5427 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5428 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5429         fn drop(&mut self) {
5430                 if self.result_ok {
5431                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5432                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5433                         }
5434                 } else {
5435                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5436                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5437                         }
5438                 }
5439         }
5440 }
5441 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5442         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5443                 let contents = if o.result_ok {
5444                         let result = unsafe { o.contents.result };
5445                         unsafe { o.contents.result = core::ptr::null_mut() };
5446                         CResult_RoutingFeesDecodeErrorZPtr { result }
5447                 } else {
5448                         let err = unsafe { o.contents.err };
5449                         unsafe { o.contents.err = core::ptr::null_mut(); }
5450                         CResult_RoutingFeesDecodeErrorZPtr { err }
5451                 };
5452                 Self {
5453                         contents,
5454                         result_ok: o.result_ok,
5455                 }
5456         }
5457 }
5458 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5459         fn clone(&self) -> Self {
5460                 if self.result_ok {
5461                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5462                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5463                         } }
5464                 } else {
5465                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5466                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5467                         } }
5468                 }
5469         }
5470 }
5471 #[no_mangle]
5472 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5473 /// but with all dynamically-allocated buffers duplicated in new buffers.
5474 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5475 #[repr(C)]
5476 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5477 /// This corresponds to std::vector in C++
5478 pub struct CVec_NetAddressZ {
5479         /// The elements in the array.
5480         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5481         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5482         /// The number of elements pointed to by `data`.
5483         pub datalen: usize
5484 }
5485 impl CVec_NetAddressZ {
5486         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5487                 if self.datalen == 0 { return Vec::new(); }
5488                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5489                 self.data = core::ptr::null_mut();
5490                 self.datalen = 0;
5491                 ret
5492         }
5493         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5494                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5495         }
5496 }
5497 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5498         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5499                 let datalen = v.len();
5500                 let data = Box::into_raw(v.into_boxed_slice());
5501                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5502         }
5503 }
5504 #[no_mangle]
5505 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5506 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5507 impl Drop for CVec_NetAddressZ {
5508         fn drop(&mut self) {
5509                 if self.datalen == 0 { return; }
5510                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5511         }
5512 }
5513 impl Clone for CVec_NetAddressZ {
5514         fn clone(&self) -> Self {
5515                 let mut res = Vec::new();
5516                 if self.datalen == 0 { return Self::from(res); }
5517                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5518                 Self::from(res)
5519         }
5520 }
5521 #[repr(C)]
5522 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5523 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5524         /// A pointer to the contents in the success state.
5525         /// Reading from this pointer when `result_ok` is not set is undefined.
5526         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5527         /// A pointer to the contents in the error state.
5528         /// Reading from this pointer when `result_ok` is set is undefined.
5529         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5530 }
5531 #[repr(C)]
5532 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5533 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5534 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5535 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5536         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5537         /// `err` or `result` depending on the state of `result_ok`.
5538         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5539         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5540         pub result_ok: bool,
5541 }
5542 #[no_mangle]
5543 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5544 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5545         CResult_NodeAnnouncementInfoDecodeErrorZ {
5546                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5547                         result: Box::into_raw(Box::new(o)),
5548                 },
5549                 result_ok: true,
5550         }
5551 }
5552 #[no_mangle]
5553 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5554 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5555         CResult_NodeAnnouncementInfoDecodeErrorZ {
5556                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5557                         err: Box::into_raw(Box::new(e)),
5558                 },
5559                 result_ok: false,
5560         }
5561 }
5562 /// Checks if the given object is currently in the success state
5563 #[no_mangle]
5564 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5565         o.result_ok
5566 }
5567 #[no_mangle]
5568 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5569 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5570 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5571         fn drop(&mut self) {
5572                 if self.result_ok {
5573                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5574                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5575                         }
5576                 } else {
5577                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5578                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5579                         }
5580                 }
5581         }
5582 }
5583 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5584         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5585                 let contents = if o.result_ok {
5586                         let result = unsafe { o.contents.result };
5587                         unsafe { o.contents.result = core::ptr::null_mut() };
5588                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5589                 } else {
5590                         let err = unsafe { o.contents.err };
5591                         unsafe { o.contents.err = core::ptr::null_mut(); }
5592                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5593                 };
5594                 Self {
5595                         contents,
5596                         result_ok: o.result_ok,
5597                 }
5598         }
5599 }
5600 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5601         fn clone(&self) -> Self {
5602                 if self.result_ok {
5603                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5604                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5605                         } }
5606                 } else {
5607                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5608                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5609                         } }
5610                 }
5611         }
5612 }
5613 #[no_mangle]
5614 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5615 /// but with all dynamically-allocated buffers duplicated in new buffers.
5616 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5617 #[repr(C)]
5618 /// The contents of CResult_NodeAliasDecodeErrorZ
5619 pub union CResult_NodeAliasDecodeErrorZPtr {
5620         /// A pointer to the contents in the success state.
5621         /// Reading from this pointer when `result_ok` is not set is undefined.
5622         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5623         /// A pointer to the contents in the error state.
5624         /// Reading from this pointer when `result_ok` is set is undefined.
5625         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5626 }
5627 #[repr(C)]
5628 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5629 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5631 pub struct CResult_NodeAliasDecodeErrorZ {
5632         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5633         /// `err` or `result` depending on the state of `result_ok`.
5634         pub contents: CResult_NodeAliasDecodeErrorZPtr,
5635         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5636         pub result_ok: bool,
5637 }
5638 #[no_mangle]
5639 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5640 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5641         CResult_NodeAliasDecodeErrorZ {
5642                 contents: CResult_NodeAliasDecodeErrorZPtr {
5643                         result: Box::into_raw(Box::new(o)),
5644                 },
5645                 result_ok: true,
5646         }
5647 }
5648 #[no_mangle]
5649 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5650 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5651         CResult_NodeAliasDecodeErrorZ {
5652                 contents: CResult_NodeAliasDecodeErrorZPtr {
5653                         err: Box::into_raw(Box::new(e)),
5654                 },
5655                 result_ok: false,
5656         }
5657 }
5658 /// Checks if the given object is currently in the success state
5659 #[no_mangle]
5660 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5661         o.result_ok
5662 }
5663 #[no_mangle]
5664 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5665 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5666 impl Drop for CResult_NodeAliasDecodeErrorZ {
5667         fn drop(&mut self) {
5668                 if self.result_ok {
5669                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5670                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5671                         }
5672                 } else {
5673                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5674                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5675                         }
5676                 }
5677         }
5678 }
5679 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5680         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5681                 let contents = if o.result_ok {
5682                         let result = unsafe { o.contents.result };
5683                         unsafe { o.contents.result = core::ptr::null_mut() };
5684                         CResult_NodeAliasDecodeErrorZPtr { result }
5685                 } else {
5686                         let err = unsafe { o.contents.err };
5687                         unsafe { o.contents.err = core::ptr::null_mut(); }
5688                         CResult_NodeAliasDecodeErrorZPtr { err }
5689                 };
5690                 Self {
5691                         contents,
5692                         result_ok: o.result_ok,
5693                 }
5694         }
5695 }
5696 impl Clone for CResult_NodeAliasDecodeErrorZ {
5697         fn clone(&self) -> Self {
5698                 if self.result_ok {
5699                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5700                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5701                         } }
5702                 } else {
5703                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5704                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5705                         } }
5706                 }
5707         }
5708 }
5709 #[no_mangle]
5710 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5711 /// but with all dynamically-allocated buffers duplicated in new buffers.
5712 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5713 #[repr(C)]
5714 /// A dynamically-allocated array of u64s of arbitrary size.
5715 /// This corresponds to std::vector in C++
5716 pub struct CVec_u64Z {
5717         /// The elements in the array.
5718         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5719         pub data: *mut u64,
5720         /// The number of elements pointed to by `data`.
5721         pub datalen: usize
5722 }
5723 impl CVec_u64Z {
5724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
5725                 if self.datalen == 0 { return Vec::new(); }
5726                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5727                 self.data = core::ptr::null_mut();
5728                 self.datalen = 0;
5729                 ret
5730         }
5731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
5732                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5733         }
5734 }
5735 impl From<Vec<u64>> for CVec_u64Z {
5736         fn from(v: Vec<u64>) -> Self {
5737                 let datalen = v.len();
5738                 let data = Box::into_raw(v.into_boxed_slice());
5739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5740         }
5741 }
5742 #[no_mangle]
5743 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5744 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
5745 impl Drop for CVec_u64Z {
5746         fn drop(&mut self) {
5747                 if self.datalen == 0 { return; }
5748                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5749         }
5750 }
5751 impl Clone for CVec_u64Z {
5752         fn clone(&self) -> Self {
5753                 let mut res = Vec::new();
5754                 if self.datalen == 0 { return Self::from(res); }
5755                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5756                 Self::from(res)
5757         }
5758 }
5759 #[repr(C)]
5760 /// The contents of CResult_NodeInfoDecodeErrorZ
5761 pub union CResult_NodeInfoDecodeErrorZPtr {
5762         /// A pointer to the contents in the success state.
5763         /// Reading from this pointer when `result_ok` is not set is undefined.
5764         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5765         /// A pointer to the contents in the error state.
5766         /// Reading from this pointer when `result_ok` is set is undefined.
5767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5768 }
5769 #[repr(C)]
5770 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5771 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5773 pub struct CResult_NodeInfoDecodeErrorZ {
5774         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5775         /// `err` or `result` depending on the state of `result_ok`.
5776         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5777         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5778         pub result_ok: bool,
5779 }
5780 #[no_mangle]
5781 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5782 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5783         CResult_NodeInfoDecodeErrorZ {
5784                 contents: CResult_NodeInfoDecodeErrorZPtr {
5785                         result: Box::into_raw(Box::new(o)),
5786                 },
5787                 result_ok: true,
5788         }
5789 }
5790 #[no_mangle]
5791 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5792 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5793         CResult_NodeInfoDecodeErrorZ {
5794                 contents: CResult_NodeInfoDecodeErrorZPtr {
5795                         err: Box::into_raw(Box::new(e)),
5796                 },
5797                 result_ok: false,
5798         }
5799 }
5800 /// Checks if the given object is currently in the success state
5801 #[no_mangle]
5802 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5803         o.result_ok
5804 }
5805 #[no_mangle]
5806 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5807 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5808 impl Drop for CResult_NodeInfoDecodeErrorZ {
5809         fn drop(&mut self) {
5810                 if self.result_ok {
5811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5813                         }
5814                 } else {
5815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5817                         }
5818                 }
5819         }
5820 }
5821 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5823                 let contents = if o.result_ok {
5824                         let result = unsafe { o.contents.result };
5825                         unsafe { o.contents.result = core::ptr::null_mut() };
5826                         CResult_NodeInfoDecodeErrorZPtr { result }
5827                 } else {
5828                         let err = unsafe { o.contents.err };
5829                         unsafe { o.contents.err = core::ptr::null_mut(); }
5830                         CResult_NodeInfoDecodeErrorZPtr { err }
5831                 };
5832                 Self {
5833                         contents,
5834                         result_ok: o.result_ok,
5835                 }
5836         }
5837 }
5838 impl Clone for CResult_NodeInfoDecodeErrorZ {
5839         fn clone(&self) -> Self {
5840                 if self.result_ok {
5841                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5842                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5843                         } }
5844                 } else {
5845                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5847                         } }
5848                 }
5849         }
5850 }
5851 #[no_mangle]
5852 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5853 /// but with all dynamically-allocated buffers duplicated in new buffers.
5854 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5855 #[repr(C)]
5856 /// The contents of CResult_NetworkGraphDecodeErrorZ
5857 pub union CResult_NetworkGraphDecodeErrorZPtr {
5858         /// A pointer to the contents in the success state.
5859         /// Reading from this pointer when `result_ok` is not set is undefined.
5860         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5861         /// A pointer to the contents in the error state.
5862         /// Reading from this pointer when `result_ok` is set is undefined.
5863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5864 }
5865 #[repr(C)]
5866 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5867 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5869 pub struct CResult_NetworkGraphDecodeErrorZ {
5870         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5871         /// `err` or `result` depending on the state of `result_ok`.
5872         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
5873         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5874         pub result_ok: bool,
5875 }
5876 #[no_mangle]
5877 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
5878 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
5879         CResult_NetworkGraphDecodeErrorZ {
5880                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5881                         result: Box::into_raw(Box::new(o)),
5882                 },
5883                 result_ok: true,
5884         }
5885 }
5886 #[no_mangle]
5887 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
5888 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
5889         CResult_NetworkGraphDecodeErrorZ {
5890                 contents: CResult_NetworkGraphDecodeErrorZPtr {
5891                         err: Box::into_raw(Box::new(e)),
5892                 },
5893                 result_ok: false,
5894         }
5895 }
5896 /// Checks if the given object is currently in the success state
5897 #[no_mangle]
5898 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
5899         o.result_ok
5900 }
5901 #[no_mangle]
5902 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
5903 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
5904 impl Drop for CResult_NetworkGraphDecodeErrorZ {
5905         fn drop(&mut self) {
5906                 if self.result_ok {
5907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5909                         }
5910                 } else {
5911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5913                         }
5914                 }
5915         }
5916 }
5917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
5918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
5919                 let contents = if o.result_ok {
5920                         let result = unsafe { o.contents.result };
5921                         unsafe { o.contents.result = core::ptr::null_mut() };
5922                         CResult_NetworkGraphDecodeErrorZPtr { result }
5923                 } else {
5924                         let err = unsafe { o.contents.err };
5925                         unsafe { o.contents.err = core::ptr::null_mut(); }
5926                         CResult_NetworkGraphDecodeErrorZPtr { err }
5927                 };
5928                 Self {
5929                         contents,
5930                         result_ok: o.result_ok,
5931                 }
5932         }
5933 }
5934 #[repr(C)]
5935 #[derive(Clone)]
5936 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5937 pub enum COption_CVec_NetAddressZZ {
5938         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5939         Some(crate::c_types::derived::CVec_NetAddressZ),
5940         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5941         None
5942 }
5943 impl COption_CVec_NetAddressZZ {
5944         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5945                 if let Self::None = self { false } else { true }
5946         }
5947         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5948                 !self.is_some()
5949         }
5950         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
5951                 if let Self::Some(v) = self { v } else { unreachable!() }
5952         }
5953 }
5954 #[no_mangle]
5955 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
5956 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
5957         COption_CVec_NetAddressZZ::Some(o)
5958 }
5959 #[no_mangle]
5960 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
5961 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
5962         COption_CVec_NetAddressZZ::None
5963 }
5964 #[no_mangle]
5965 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
5966 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
5967 #[no_mangle]
5968 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
5969 /// but with all dynamically-allocated buffers duplicated in new buffers.
5970 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
5971 #[repr(C)]
5972 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5973 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5974         /// A pointer to the contents in the success state.
5975         /// Reading from this pointer when `result_ok` is not set is undefined.
5976         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
5977         /// A pointer to the contents in the error state.
5978         /// Reading from this pointer when `result_ok` is set is undefined.
5979         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5980 }
5981 #[repr(C)]
5982 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5983 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5984 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5985 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5986         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5987         /// `err` or `result` depending on the state of `result_ok`.
5988         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
5989         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5990         pub result_ok: bool,
5991 }
5992 #[no_mangle]
5993 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
5994 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5995         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5996                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5997                         result: Box::into_raw(Box::new(o)),
5998                 },
5999                 result_ok: true,
6000         }
6001 }
6002 #[no_mangle]
6003 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6004 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6005         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6006                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6007                         err: Box::into_raw(Box::new(e)),
6008                 },
6009                 result_ok: false,
6010         }
6011 }
6012 /// Checks if the given object is currently in the success state
6013 #[no_mangle]
6014 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6015         o.result_ok
6016 }
6017 #[no_mangle]
6018 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6019 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6020 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6021         fn drop(&mut self) {
6022                 if self.result_ok {
6023                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6024                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6025                         }
6026                 } else {
6027                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6028                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6029                         }
6030                 }
6031         }
6032 }
6033 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6034         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6035                 let contents = if o.result_ok {
6036                         let result = unsafe { o.contents.result };
6037                         unsafe { o.contents.result = core::ptr::null_mut() };
6038                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6039                 } else {
6040                         let err = unsafe { o.contents.err };
6041                         unsafe { o.contents.err = core::ptr::null_mut(); }
6042                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6043                 };
6044                 Self {
6045                         contents,
6046                         result_ok: o.result_ok,
6047                 }
6048         }
6049 }
6050 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6051         fn clone(&self) -> Self {
6052                 if self.result_ok {
6053                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6054                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6055                         } }
6056                 } else {
6057                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6058                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6059                         } }
6060                 }
6061         }
6062 }
6063 #[no_mangle]
6064 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6065 /// but with all dynamically-allocated buffers duplicated in new buffers.
6066 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6067 #[repr(C)]
6068 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6069 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6070         /// A pointer to the contents in the success state.
6071         /// Reading from this pointer when `result_ok` is not set is undefined.
6072         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6073         /// A pointer to the contents in the error state.
6074         /// Reading from this pointer when `result_ok` is set is undefined.
6075         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6076 }
6077 #[repr(C)]
6078 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6079 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6080 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6081 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6082         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6083         /// `err` or `result` depending on the state of `result_ok`.
6084         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6085         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6086         pub result_ok: bool,
6087 }
6088 #[no_mangle]
6089 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6090 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6091         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6092                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6093                         result: Box::into_raw(Box::new(o)),
6094                 },
6095                 result_ok: true,
6096         }
6097 }
6098 #[no_mangle]
6099 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6100 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6101         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6102                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6103                         err: Box::into_raw(Box::new(e)),
6104                 },
6105                 result_ok: false,
6106         }
6107 }
6108 /// Checks if the given object is currently in the success state
6109 #[no_mangle]
6110 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6111         o.result_ok
6112 }
6113 #[no_mangle]
6114 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6115 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6116 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6117         fn drop(&mut self) {
6118                 if self.result_ok {
6119                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6120                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6121                         }
6122                 } else {
6123                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6124                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6125                         }
6126                 }
6127         }
6128 }
6129 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6130         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6131                 let contents = if o.result_ok {
6132                         let result = unsafe { o.contents.result };
6133                         unsafe { o.contents.result = core::ptr::null_mut() };
6134                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6135                 } else {
6136                         let err = unsafe { o.contents.err };
6137                         unsafe { o.contents.err = core::ptr::null_mut(); }
6138                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6139                 };
6140                 Self {
6141                         contents,
6142                         result_ok: o.result_ok,
6143                 }
6144         }
6145 }
6146 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6147         fn clone(&self) -> Self {
6148                 if self.result_ok {
6149                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6150                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6151                         } }
6152                 } else {
6153                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6154                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6155                         } }
6156                 }
6157         }
6158 }
6159 #[no_mangle]
6160 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6161 /// but with all dynamically-allocated buffers duplicated in new buffers.
6162 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6163 #[repr(C)]
6164 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6165 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6166         /// A pointer to the contents in the success state.
6167         /// Reading from this pointer when `result_ok` is not set is undefined.
6168         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6169         /// A pointer to the contents in the error state.
6170         /// Reading from this pointer when `result_ok` is set is undefined.
6171         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6172 }
6173 #[repr(C)]
6174 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6175 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6176 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6177 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6178         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6179         /// `err` or `result` depending on the state of `result_ok`.
6180         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6181         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6182         pub result_ok: bool,
6183 }
6184 #[no_mangle]
6185 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6186 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6187         CResult_SpendableOutputDescriptorDecodeErrorZ {
6188                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6189                         result: Box::into_raw(Box::new(o)),
6190                 },
6191                 result_ok: true,
6192         }
6193 }
6194 #[no_mangle]
6195 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6196 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6197         CResult_SpendableOutputDescriptorDecodeErrorZ {
6198                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6199                         err: Box::into_raw(Box::new(e)),
6200                 },
6201                 result_ok: false,
6202         }
6203 }
6204 /// Checks if the given object is currently in the success state
6205 #[no_mangle]
6206 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6207         o.result_ok
6208 }
6209 #[no_mangle]
6210 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6211 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6212 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6213         fn drop(&mut self) {
6214                 if self.result_ok {
6215                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6216                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6217                         }
6218                 } else {
6219                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6220                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6221                         }
6222                 }
6223         }
6224 }
6225 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6226         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6227                 let contents = if o.result_ok {
6228                         let result = unsafe { o.contents.result };
6229                         unsafe { o.contents.result = core::ptr::null_mut() };
6230                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6231                 } else {
6232                         let err = unsafe { o.contents.err };
6233                         unsafe { o.contents.err = core::ptr::null_mut(); }
6234                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6235                 };
6236                 Self {
6237                         contents,
6238                         result_ok: o.result_ok,
6239                 }
6240         }
6241 }
6242 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6243         fn clone(&self) -> Self {
6244                 if self.result_ok {
6245                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6246                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6247                         } }
6248                 } else {
6249                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6250                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6251                         } }
6252                 }
6253         }
6254 }
6255 #[no_mangle]
6256 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6257 /// but with all dynamically-allocated buffers duplicated in new buffers.
6258 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6259 #[repr(C)]
6260 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6261 /// This corresponds to std::vector in C++
6262 pub struct CVec_PaymentPreimageZ {
6263         /// The elements in the array.
6264         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6265         pub data: *mut crate::c_types::ThirtyTwoBytes,
6266         /// The number of elements pointed to by `data`.
6267         pub datalen: usize
6268 }
6269 impl CVec_PaymentPreimageZ {
6270         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6271                 if self.datalen == 0 { return Vec::new(); }
6272                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6273                 self.data = core::ptr::null_mut();
6274                 self.datalen = 0;
6275                 ret
6276         }
6277         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6278                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6279         }
6280 }
6281 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6282         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6283                 let datalen = v.len();
6284                 let data = Box::into_raw(v.into_boxed_slice());
6285                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6286         }
6287 }
6288 #[no_mangle]
6289 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6290 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6291 impl Drop for CVec_PaymentPreimageZ {
6292         fn drop(&mut self) {
6293                 if self.datalen == 0 { return; }
6294                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6295         }
6296 }
6297 impl Clone for CVec_PaymentPreimageZ {
6298         fn clone(&self) -> Self {
6299                 let mut res = Vec::new();
6300                 if self.datalen == 0 { return Self::from(res); }
6301                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6302                 Self::from(res)
6303         }
6304 }
6305 #[repr(C)]
6306 /// A tuple of 2 elements. See the individual fields for the types contained.
6307 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6308         /// The element at position 0
6309         pub a: crate::c_types::Signature,
6310         /// The element at position 1
6311         pub b: crate::c_types::derived::CVec_SignatureZ,
6312 }
6313 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6314         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6315                 Self {
6316                         a: tup.0,
6317                         b: tup.1,
6318                 }
6319         }
6320 }
6321 impl C2Tuple_SignatureCVec_SignatureZZ {
6322         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6323                 (self.a, self.b)
6324         }
6325 }
6326 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6327         fn clone(&self) -> Self {
6328                 Self {
6329                         a: Clone::clone(&self.a),
6330                         b: Clone::clone(&self.b),
6331                 }
6332         }
6333 }
6334 #[no_mangle]
6335 /// Creates a new tuple which has the same data as `orig`
6336 /// but with all dynamically-allocated buffers duplicated in new buffers.
6337 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6338 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6339 #[no_mangle]
6340 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6341         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6342 }
6343
6344 #[no_mangle]
6345 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6346 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6347 #[repr(C)]
6348 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6349 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6350         /// A pointer to the contents in the success state.
6351         /// Reading from this pointer when `result_ok` is not set is undefined.
6352         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6353         /// Note that this value is always NULL, as there are no contents in the Err variant
6354         pub err: *mut core::ffi::c_void,
6355 }
6356 #[repr(C)]
6357 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6358 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6359 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6360 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6361         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6362         /// `err` or `result` depending on the state of `result_ok`.
6363         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6364         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6365         pub result_ok: bool,
6366 }
6367 #[no_mangle]
6368 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6369 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6370         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6371                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6372                         result: Box::into_raw(Box::new(o)),
6373                 },
6374                 result_ok: true,
6375         }
6376 }
6377 #[no_mangle]
6378 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6379 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6380         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6381                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6382                         err: core::ptr::null_mut(),
6383                 },
6384                 result_ok: false,
6385         }
6386 }
6387 /// Checks if the given object is currently in the success state
6388 #[no_mangle]
6389 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6390         o.result_ok
6391 }
6392 #[no_mangle]
6393 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6394 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6395 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6396         fn drop(&mut self) {
6397                 if self.result_ok {
6398                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6399                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6400                         }
6401                 } else {
6402                 }
6403         }
6404 }
6405 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6406         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6407                 let contents = if o.result_ok {
6408                         let result = unsafe { o.contents.result };
6409                         unsafe { o.contents.result = core::ptr::null_mut() };
6410                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6411                 } else {
6412                         let _ = unsafe { Box::from_raw(o.contents.err) };
6413                         o.contents.err = core::ptr::null_mut();
6414                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6415                 };
6416                 Self {
6417                         contents,
6418                         result_ok: o.result_ok,
6419                 }
6420         }
6421 }
6422 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6423         fn clone(&self) -> Self {
6424                 if self.result_ok {
6425                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6426                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6427                         } }
6428                 } else {
6429                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6430                                 err: core::ptr::null_mut()
6431                         } }
6432                 }
6433         }
6434 }
6435 #[no_mangle]
6436 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6437 /// but with all dynamically-allocated buffers duplicated in new buffers.
6438 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6439 #[repr(C)]
6440 /// The contents of CResult_SignatureNoneZ
6441 pub union CResult_SignatureNoneZPtr {
6442         /// A pointer to the contents in the success state.
6443         /// Reading from this pointer when `result_ok` is not set is undefined.
6444         pub result: *mut crate::c_types::Signature,
6445         /// Note that this value is always NULL, as there are no contents in the Err variant
6446         pub err: *mut core::ffi::c_void,
6447 }
6448 #[repr(C)]
6449 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6450 /// containing a crate::c_types::Signature on success and a () on failure.
6451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6452 pub struct CResult_SignatureNoneZ {
6453         /// The contents of this CResult_SignatureNoneZ, accessible via either
6454         /// `err` or `result` depending on the state of `result_ok`.
6455         pub contents: CResult_SignatureNoneZPtr,
6456         /// Whether this CResult_SignatureNoneZ represents a success state.
6457         pub result_ok: bool,
6458 }
6459 #[no_mangle]
6460 /// Creates a new CResult_SignatureNoneZ in the success state.
6461 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6462         CResult_SignatureNoneZ {
6463                 contents: CResult_SignatureNoneZPtr {
6464                         result: Box::into_raw(Box::new(o)),
6465                 },
6466                 result_ok: true,
6467         }
6468 }
6469 #[no_mangle]
6470 /// Creates a new CResult_SignatureNoneZ in the error state.
6471 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6472         CResult_SignatureNoneZ {
6473                 contents: CResult_SignatureNoneZPtr {
6474                         err: core::ptr::null_mut(),
6475                 },
6476                 result_ok: false,
6477         }
6478 }
6479 /// Checks if the given object is currently in the success state
6480 #[no_mangle]
6481 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6482         o.result_ok
6483 }
6484 #[no_mangle]
6485 /// Frees any resources used by the CResult_SignatureNoneZ.
6486 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6487 impl Drop for CResult_SignatureNoneZ {
6488         fn drop(&mut self) {
6489                 if self.result_ok {
6490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6492                         }
6493                 } else {
6494                 }
6495         }
6496 }
6497 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6498         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6499                 let contents = if o.result_ok {
6500                         let result = unsafe { o.contents.result };
6501                         unsafe { o.contents.result = core::ptr::null_mut() };
6502                         CResult_SignatureNoneZPtr { result }
6503                 } else {
6504                         let _ = unsafe { Box::from_raw(o.contents.err) };
6505                         o.contents.err = core::ptr::null_mut();
6506                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6507                 };
6508                 Self {
6509                         contents,
6510                         result_ok: o.result_ok,
6511                 }
6512         }
6513 }
6514 impl Clone for CResult_SignatureNoneZ {
6515         fn clone(&self) -> Self {
6516                 if self.result_ok {
6517                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6518                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6519                         } }
6520                 } else {
6521                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6522                                 err: core::ptr::null_mut()
6523                         } }
6524                 }
6525         }
6526 }
6527 #[no_mangle]
6528 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6529 /// but with all dynamically-allocated buffers duplicated in new buffers.
6530 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6531 #[repr(C)]
6532 /// A tuple of 2 elements. See the individual fields for the types contained.
6533 pub struct C2Tuple_SignatureSignatureZ {
6534         /// The element at position 0
6535         pub a: crate::c_types::Signature,
6536         /// The element at position 1
6537         pub b: crate::c_types::Signature,
6538 }
6539 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6540         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6541                 Self {
6542                         a: tup.0,
6543                         b: tup.1,
6544                 }
6545         }
6546 }
6547 impl C2Tuple_SignatureSignatureZ {
6548         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6549                 (self.a, self.b)
6550         }
6551 }
6552 impl Clone for C2Tuple_SignatureSignatureZ {
6553         fn clone(&self) -> Self {
6554                 Self {
6555                         a: Clone::clone(&self.a),
6556                         b: Clone::clone(&self.b),
6557                 }
6558         }
6559 }
6560 #[no_mangle]
6561 /// Creates a new tuple which has the same data as `orig`
6562 /// but with all dynamically-allocated buffers duplicated in new buffers.
6563 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6564 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6565 #[no_mangle]
6566 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6567         C2Tuple_SignatureSignatureZ { a, b, }
6568 }
6569
6570 #[no_mangle]
6571 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6572 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6573 #[repr(C)]
6574 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6575 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6576         /// A pointer to the contents in the success state.
6577         /// Reading from this pointer when `result_ok` is not set is undefined.
6578         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6579         /// Note that this value is always NULL, as there are no contents in the Err variant
6580         pub err: *mut core::ffi::c_void,
6581 }
6582 #[repr(C)]
6583 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6584 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6586 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6587         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6588         /// `err` or `result` depending on the state of `result_ok`.
6589         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6590         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6591         pub result_ok: bool,
6592 }
6593 #[no_mangle]
6594 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6595 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6596         CResult_C2Tuple_SignatureSignatureZNoneZ {
6597                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6598                         result: Box::into_raw(Box::new(o)),
6599                 },
6600                 result_ok: true,
6601         }
6602 }
6603 #[no_mangle]
6604 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6605 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6606         CResult_C2Tuple_SignatureSignatureZNoneZ {
6607                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6608                         err: core::ptr::null_mut(),
6609                 },
6610                 result_ok: false,
6611         }
6612 }
6613 /// Checks if the given object is currently in the success state
6614 #[no_mangle]
6615 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6616         o.result_ok
6617 }
6618 #[no_mangle]
6619 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6620 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6621 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6622         fn drop(&mut self) {
6623                 if self.result_ok {
6624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6626                         }
6627                 } else {
6628                 }
6629         }
6630 }
6631 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6632         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6633                 let contents = if o.result_ok {
6634                         let result = unsafe { o.contents.result };
6635                         unsafe { o.contents.result = core::ptr::null_mut() };
6636                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6637                 } else {
6638                         let _ = unsafe { Box::from_raw(o.contents.err) };
6639                         o.contents.err = core::ptr::null_mut();
6640                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6641                 };
6642                 Self {
6643                         contents,
6644                         result_ok: o.result_ok,
6645                 }
6646         }
6647 }
6648 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6649         fn clone(&self) -> Self {
6650                 if self.result_ok {
6651                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6652                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6653                         } }
6654                 } else {
6655                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6656                                 err: core::ptr::null_mut()
6657                         } }
6658                 }
6659         }
6660 }
6661 #[no_mangle]
6662 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6663 /// but with all dynamically-allocated buffers duplicated in new buffers.
6664 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6665 #[repr(C)]
6666 /// The contents of CResult_SecretKeyNoneZ
6667 pub union CResult_SecretKeyNoneZPtr {
6668         /// A pointer to the contents in the success state.
6669         /// Reading from this pointer when `result_ok` is not set is undefined.
6670         pub result: *mut crate::c_types::SecretKey,
6671         /// Note that this value is always NULL, as there are no contents in the Err variant
6672         pub err: *mut core::ffi::c_void,
6673 }
6674 #[repr(C)]
6675 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6676 /// containing a crate::c_types::SecretKey on success and a () on failure.
6677 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6678 pub struct CResult_SecretKeyNoneZ {
6679         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6680         /// `err` or `result` depending on the state of `result_ok`.
6681         pub contents: CResult_SecretKeyNoneZPtr,
6682         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6683         pub result_ok: bool,
6684 }
6685 #[no_mangle]
6686 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6687 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6688         CResult_SecretKeyNoneZ {
6689                 contents: CResult_SecretKeyNoneZPtr {
6690                         result: Box::into_raw(Box::new(o)),
6691                 },
6692                 result_ok: true,
6693         }
6694 }
6695 #[no_mangle]
6696 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6697 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6698         CResult_SecretKeyNoneZ {
6699                 contents: CResult_SecretKeyNoneZPtr {
6700                         err: core::ptr::null_mut(),
6701                 },
6702                 result_ok: false,
6703         }
6704 }
6705 /// Checks if the given object is currently in the success state
6706 #[no_mangle]
6707 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6708         o.result_ok
6709 }
6710 #[no_mangle]
6711 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6712 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6713 impl Drop for CResult_SecretKeyNoneZ {
6714         fn drop(&mut self) {
6715                 if self.result_ok {
6716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6718                         }
6719                 } else {
6720                 }
6721         }
6722 }
6723 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6724         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6725                 let contents = if o.result_ok {
6726                         let result = unsafe { o.contents.result };
6727                         unsafe { o.contents.result = core::ptr::null_mut() };
6728                         CResult_SecretKeyNoneZPtr { result }
6729                 } else {
6730                         let _ = unsafe { Box::from_raw(o.contents.err) };
6731                         o.contents.err = core::ptr::null_mut();
6732                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6733                 };
6734                 Self {
6735                         contents,
6736                         result_ok: o.result_ok,
6737                 }
6738         }
6739 }
6740 impl Clone for CResult_SecretKeyNoneZ {
6741         fn clone(&self) -> Self {
6742                 if self.result_ok {
6743                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6744                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6745                         } }
6746                 } else {
6747                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6748                                 err: core::ptr::null_mut()
6749                         } }
6750                 }
6751         }
6752 }
6753 #[no_mangle]
6754 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6755 /// but with all dynamically-allocated buffers duplicated in new buffers.
6756 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6757 #[repr(C)]
6758 /// The contents of CResult_SignDecodeErrorZ
6759 pub union CResult_SignDecodeErrorZPtr {
6760         /// A pointer to the contents in the success state.
6761         /// Reading from this pointer when `result_ok` is not set is undefined.
6762         pub result: *mut crate::lightning::chain::keysinterface::Sign,
6763         /// A pointer to the contents in the error state.
6764         /// Reading from this pointer when `result_ok` is set is undefined.
6765         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6766 }
6767 #[repr(C)]
6768 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6769 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6770 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6771 pub struct CResult_SignDecodeErrorZ {
6772         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6773         /// `err` or `result` depending on the state of `result_ok`.
6774         pub contents: CResult_SignDecodeErrorZPtr,
6775         /// Whether this CResult_SignDecodeErrorZ represents a success state.
6776         pub result_ok: bool,
6777 }
6778 #[no_mangle]
6779 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6780 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6781         CResult_SignDecodeErrorZ {
6782                 contents: CResult_SignDecodeErrorZPtr {
6783                         result: Box::into_raw(Box::new(o)),
6784                 },
6785                 result_ok: true,
6786         }
6787 }
6788 #[no_mangle]
6789 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6790 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6791         CResult_SignDecodeErrorZ {
6792                 contents: CResult_SignDecodeErrorZPtr {
6793                         err: Box::into_raw(Box::new(e)),
6794                 },
6795                 result_ok: false,
6796         }
6797 }
6798 /// Checks if the given object is currently in the success state
6799 #[no_mangle]
6800 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6801         o.result_ok
6802 }
6803 #[no_mangle]
6804 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6805 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6806 impl Drop for CResult_SignDecodeErrorZ {
6807         fn drop(&mut self) {
6808                 if self.result_ok {
6809                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6810                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6811                         }
6812                 } else {
6813                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6814                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6815                         }
6816                 }
6817         }
6818 }
6819 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6820         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6821                 let contents = if o.result_ok {
6822                         let result = unsafe { o.contents.result };
6823                         unsafe { o.contents.result = core::ptr::null_mut() };
6824                         CResult_SignDecodeErrorZPtr { result }
6825                 } else {
6826                         let err = unsafe { o.contents.err };
6827                         unsafe { o.contents.err = core::ptr::null_mut(); }
6828                         CResult_SignDecodeErrorZPtr { err }
6829                 };
6830                 Self {
6831                         contents,
6832                         result_ok: o.result_ok,
6833                 }
6834         }
6835 }
6836 impl Clone for CResult_SignDecodeErrorZ {
6837         fn clone(&self) -> Self {
6838                 if self.result_ok {
6839                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6840                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6841                         } }
6842                 } else {
6843                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6844                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6845                         } }
6846                 }
6847         }
6848 }
6849 #[no_mangle]
6850 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6851 /// but with all dynamically-allocated buffers duplicated in new buffers.
6852 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6853 #[repr(C)]
6854 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6855 /// This corresponds to std::vector in C++
6856 pub struct CVec_u5Z {
6857         /// The elements in the array.
6858         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6859         pub data: *mut crate::c_types::u5,
6860         /// The number of elements pointed to by `data`.
6861         pub datalen: usize
6862 }
6863 impl CVec_u5Z {
6864         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
6865                 if self.datalen == 0 { return Vec::new(); }
6866                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6867                 self.data = core::ptr::null_mut();
6868                 self.datalen = 0;
6869                 ret
6870         }
6871         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
6872                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6873         }
6874 }
6875 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
6876         fn from(v: Vec<crate::c_types::u5>) -> Self {
6877                 let datalen = v.len();
6878                 let data = Box::into_raw(v.into_boxed_slice());
6879                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6880         }
6881 }
6882 #[no_mangle]
6883 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6884 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
6885 impl Drop for CVec_u5Z {
6886         fn drop(&mut self) {
6887                 if self.datalen == 0 { return; }
6888                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6889         }
6890 }
6891 impl Clone for CVec_u5Z {
6892         fn clone(&self) -> Self {
6893                 let mut res = Vec::new();
6894                 if self.datalen == 0 { return Self::from(res); }
6895                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6896                 Self::from(res)
6897         }
6898 }
6899 #[repr(C)]
6900 /// The contents of CResult_RecoverableSignatureNoneZ
6901 pub union CResult_RecoverableSignatureNoneZPtr {
6902         /// A pointer to the contents in the success state.
6903         /// Reading from this pointer when `result_ok` is not set is undefined.
6904         pub result: *mut crate::c_types::RecoverableSignature,
6905         /// Note that this value is always NULL, as there are no contents in the Err variant
6906         pub err: *mut core::ffi::c_void,
6907 }
6908 #[repr(C)]
6909 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6910 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
6911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6912 pub struct CResult_RecoverableSignatureNoneZ {
6913         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6914         /// `err` or `result` depending on the state of `result_ok`.
6915         pub contents: CResult_RecoverableSignatureNoneZPtr,
6916         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6917         pub result_ok: bool,
6918 }
6919 #[no_mangle]
6920 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
6921 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
6922         CResult_RecoverableSignatureNoneZ {
6923                 contents: CResult_RecoverableSignatureNoneZPtr {
6924                         result: Box::into_raw(Box::new(o)),
6925                 },
6926                 result_ok: true,
6927         }
6928 }
6929 #[no_mangle]
6930 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
6931 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
6932         CResult_RecoverableSignatureNoneZ {
6933                 contents: CResult_RecoverableSignatureNoneZPtr {
6934                         err: core::ptr::null_mut(),
6935                 },
6936                 result_ok: false,
6937         }
6938 }
6939 /// Checks if the given object is currently in the success state
6940 #[no_mangle]
6941 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
6942         o.result_ok
6943 }
6944 #[no_mangle]
6945 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
6946 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
6947 impl Drop for CResult_RecoverableSignatureNoneZ {
6948         fn drop(&mut self) {
6949                 if self.result_ok {
6950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6952                         }
6953                 } else {
6954                 }
6955         }
6956 }
6957 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
6958         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
6959                 let contents = if o.result_ok {
6960                         let result = unsafe { o.contents.result };
6961                         unsafe { o.contents.result = core::ptr::null_mut() };
6962                         CResult_RecoverableSignatureNoneZPtr { result }
6963                 } else {
6964                         let _ = unsafe { Box::from_raw(o.contents.err) };
6965                         o.contents.err = core::ptr::null_mut();
6966                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
6967                 };
6968                 Self {
6969                         contents,
6970                         result_ok: o.result_ok,
6971                 }
6972         }
6973 }
6974 impl Clone for CResult_RecoverableSignatureNoneZ {
6975         fn clone(&self) -> Self {
6976                 if self.result_ok {
6977                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
6978                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
6979                         } }
6980                 } else {
6981                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
6982                                 err: core::ptr::null_mut()
6983                         } }
6984                 }
6985         }
6986 }
6987 #[no_mangle]
6988 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
6989 /// but with all dynamically-allocated buffers duplicated in new buffers.
6990 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
6991 #[repr(C)]
6992 /// A dynamically-allocated array of u8s of arbitrary size.
6993 /// This corresponds to std::vector in C++
6994 pub struct CVec_u8Z {
6995         /// The elements in the array.
6996         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6997         pub data: *mut u8,
6998         /// The number of elements pointed to by `data`.
6999         pub datalen: usize
7000 }
7001 impl CVec_u8Z {
7002         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7003                 if self.datalen == 0 { return Vec::new(); }
7004                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7005                 self.data = core::ptr::null_mut();
7006                 self.datalen = 0;
7007                 ret
7008         }
7009         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7010                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7011         }
7012 }
7013 impl From<Vec<u8>> for CVec_u8Z {
7014         fn from(v: Vec<u8>) -> Self {
7015                 let datalen = v.len();
7016                 let data = Box::into_raw(v.into_boxed_slice());
7017                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7018         }
7019 }
7020 #[no_mangle]
7021 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7022 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7023 impl Drop for CVec_u8Z {
7024         fn drop(&mut self) {
7025                 if self.datalen == 0 { return; }
7026                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7027         }
7028 }
7029 impl Clone for CVec_u8Z {
7030         fn clone(&self) -> Self {
7031                 let mut res = Vec::new();
7032                 if self.datalen == 0 { return Self::from(res); }
7033                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7034                 Self::from(res)
7035         }
7036 }
7037 #[repr(C)]
7038 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7039 /// This corresponds to std::vector in C++
7040 pub struct CVec_CVec_u8ZZ {
7041         /// The elements in the array.
7042         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7043         pub data: *mut crate::c_types::derived::CVec_u8Z,
7044         /// The number of elements pointed to by `data`.
7045         pub datalen: usize
7046 }
7047 impl CVec_CVec_u8ZZ {
7048         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7049                 if self.datalen == 0 { return Vec::new(); }
7050                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7051                 self.data = core::ptr::null_mut();
7052                 self.datalen = 0;
7053                 ret
7054         }
7055         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7056                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7057         }
7058 }
7059 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7060         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7061                 let datalen = v.len();
7062                 let data = Box::into_raw(v.into_boxed_slice());
7063                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7064         }
7065 }
7066 #[no_mangle]
7067 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7068 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7069 impl Drop for CVec_CVec_u8ZZ {
7070         fn drop(&mut self) {
7071                 if self.datalen == 0 { return; }
7072                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7073         }
7074 }
7075 impl Clone for CVec_CVec_u8ZZ {
7076         fn clone(&self) -> Self {
7077                 let mut res = Vec::new();
7078                 if self.datalen == 0 { return Self::from(res); }
7079                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7080                 Self::from(res)
7081         }
7082 }
7083 #[repr(C)]
7084 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7085 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7086         /// A pointer to the contents in the success state.
7087         /// Reading from this pointer when `result_ok` is not set is undefined.
7088         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7089         /// Note that this value is always NULL, as there are no contents in the Err variant
7090         pub err: *mut core::ffi::c_void,
7091 }
7092 #[repr(C)]
7093 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7094 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7095 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7096 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7097         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7098         /// `err` or `result` depending on the state of `result_ok`.
7099         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7100         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7101         pub result_ok: bool,
7102 }
7103 #[no_mangle]
7104 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7105 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7106         CResult_CVec_CVec_u8ZZNoneZ {
7107                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7108                         result: Box::into_raw(Box::new(o)),
7109                 },
7110                 result_ok: true,
7111         }
7112 }
7113 #[no_mangle]
7114 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7115 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7116         CResult_CVec_CVec_u8ZZNoneZ {
7117                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7118                         err: core::ptr::null_mut(),
7119                 },
7120                 result_ok: false,
7121         }
7122 }
7123 /// Checks if the given object is currently in the success state
7124 #[no_mangle]
7125 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7126         o.result_ok
7127 }
7128 #[no_mangle]
7129 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7130 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7131 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7132         fn drop(&mut self) {
7133                 if self.result_ok {
7134                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7135                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7136                         }
7137                 } else {
7138                 }
7139         }
7140 }
7141 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7142         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7143                 let contents = if o.result_ok {
7144                         let result = unsafe { o.contents.result };
7145                         unsafe { o.contents.result = core::ptr::null_mut() };
7146                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
7147                 } else {
7148                         let _ = unsafe { Box::from_raw(o.contents.err) };
7149                         o.contents.err = core::ptr::null_mut();
7150                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7151                 };
7152                 Self {
7153                         contents,
7154                         result_ok: o.result_ok,
7155                 }
7156         }
7157 }
7158 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7159         fn clone(&self) -> Self {
7160                 if self.result_ok {
7161                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7162                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7163                         } }
7164                 } else {
7165                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7166                                 err: core::ptr::null_mut()
7167                         } }
7168                 }
7169         }
7170 }
7171 #[no_mangle]
7172 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7173 /// but with all dynamically-allocated buffers duplicated in new buffers.
7174 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7175 #[repr(C)]
7176 /// The contents of CResult_InMemorySignerDecodeErrorZ
7177 pub union CResult_InMemorySignerDecodeErrorZPtr {
7178         /// A pointer to the contents in the success state.
7179         /// Reading from this pointer when `result_ok` is not set is undefined.
7180         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7181         /// A pointer to the contents in the error state.
7182         /// Reading from this pointer when `result_ok` is set is undefined.
7183         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7184 }
7185 #[repr(C)]
7186 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7187 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7189 pub struct CResult_InMemorySignerDecodeErrorZ {
7190         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7191         /// `err` or `result` depending on the state of `result_ok`.
7192         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7193         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7194         pub result_ok: bool,
7195 }
7196 #[no_mangle]
7197 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7198 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7199         CResult_InMemorySignerDecodeErrorZ {
7200                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7201                         result: Box::into_raw(Box::new(o)),
7202                 },
7203                 result_ok: true,
7204         }
7205 }
7206 #[no_mangle]
7207 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7208 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7209         CResult_InMemorySignerDecodeErrorZ {
7210                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7211                         err: Box::into_raw(Box::new(e)),
7212                 },
7213                 result_ok: false,
7214         }
7215 }
7216 /// Checks if the given object is currently in the success state
7217 #[no_mangle]
7218 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7219         o.result_ok
7220 }
7221 #[no_mangle]
7222 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7223 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7224 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7225         fn drop(&mut self) {
7226                 if self.result_ok {
7227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7229                         }
7230                 } else {
7231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7233                         }
7234                 }
7235         }
7236 }
7237 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7238         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7239                 let contents = if o.result_ok {
7240                         let result = unsafe { o.contents.result };
7241                         unsafe { o.contents.result = core::ptr::null_mut() };
7242                         CResult_InMemorySignerDecodeErrorZPtr { result }
7243                 } else {
7244                         let err = unsafe { o.contents.err };
7245                         unsafe { o.contents.err = core::ptr::null_mut(); }
7246                         CResult_InMemorySignerDecodeErrorZPtr { err }
7247                 };
7248                 Self {
7249                         contents,
7250                         result_ok: o.result_ok,
7251                 }
7252         }
7253 }
7254 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7255         fn clone(&self) -> Self {
7256                 if self.result_ok {
7257                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7258                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7259                         } }
7260                 } else {
7261                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7262                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7263                         } }
7264                 }
7265         }
7266 }
7267 #[no_mangle]
7268 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7269 /// but with all dynamically-allocated buffers duplicated in new buffers.
7270 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7271 #[repr(C)]
7272 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7273 /// This corresponds to std::vector in C++
7274 pub struct CVec_TxOutZ {
7275         /// The elements in the array.
7276         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7277         pub data: *mut crate::c_types::TxOut,
7278         /// The number of elements pointed to by `data`.
7279         pub datalen: usize
7280 }
7281 impl CVec_TxOutZ {
7282         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7283                 if self.datalen == 0 { return Vec::new(); }
7284                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7285                 self.data = core::ptr::null_mut();
7286                 self.datalen = 0;
7287                 ret
7288         }
7289         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7290                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7291         }
7292 }
7293 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7294         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7295                 let datalen = v.len();
7296                 let data = Box::into_raw(v.into_boxed_slice());
7297                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7298         }
7299 }
7300 #[no_mangle]
7301 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7302 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7303 impl Drop for CVec_TxOutZ {
7304         fn drop(&mut self) {
7305                 if self.datalen == 0 { return; }
7306                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7307         }
7308 }
7309 impl Clone for CVec_TxOutZ {
7310         fn clone(&self) -> Self {
7311                 let mut res = Vec::new();
7312                 if self.datalen == 0 { return Self::from(res); }
7313                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7314                 Self::from(res)
7315         }
7316 }
7317 #[repr(C)]
7318 /// The contents of CResult_TransactionNoneZ
7319 pub union CResult_TransactionNoneZPtr {
7320         /// A pointer to the contents in the success state.
7321         /// Reading from this pointer when `result_ok` is not set is undefined.
7322         pub result: *mut crate::c_types::Transaction,
7323         /// Note that this value is always NULL, as there are no contents in the Err variant
7324         pub err: *mut core::ffi::c_void,
7325 }
7326 #[repr(C)]
7327 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7328 /// containing a crate::c_types::Transaction on success and a () on failure.
7329 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7330 pub struct CResult_TransactionNoneZ {
7331         /// The contents of this CResult_TransactionNoneZ, accessible via either
7332         /// `err` or `result` depending on the state of `result_ok`.
7333         pub contents: CResult_TransactionNoneZPtr,
7334         /// Whether this CResult_TransactionNoneZ represents a success state.
7335         pub result_ok: bool,
7336 }
7337 #[no_mangle]
7338 /// Creates a new CResult_TransactionNoneZ in the success state.
7339 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7340         CResult_TransactionNoneZ {
7341                 contents: CResult_TransactionNoneZPtr {
7342                         result: Box::into_raw(Box::new(o)),
7343                 },
7344                 result_ok: true,
7345         }
7346 }
7347 #[no_mangle]
7348 /// Creates a new CResult_TransactionNoneZ in the error state.
7349 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7350         CResult_TransactionNoneZ {
7351                 contents: CResult_TransactionNoneZPtr {
7352                         err: core::ptr::null_mut(),
7353                 },
7354                 result_ok: false,
7355         }
7356 }
7357 /// Checks if the given object is currently in the success state
7358 #[no_mangle]
7359 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7360         o.result_ok
7361 }
7362 #[no_mangle]
7363 /// Frees any resources used by the CResult_TransactionNoneZ.
7364 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7365 impl Drop for CResult_TransactionNoneZ {
7366         fn drop(&mut self) {
7367                 if self.result_ok {
7368                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7369                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7370                         }
7371                 } else {
7372                 }
7373         }
7374 }
7375 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7376         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7377                 let contents = if o.result_ok {
7378                         let result = unsafe { o.contents.result };
7379                         unsafe { o.contents.result = core::ptr::null_mut() };
7380                         CResult_TransactionNoneZPtr { result }
7381                 } else {
7382                         let _ = unsafe { Box::from_raw(o.contents.err) };
7383                         o.contents.err = core::ptr::null_mut();
7384                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7385                 };
7386                 Self {
7387                         contents,
7388                         result_ok: o.result_ok,
7389                 }
7390         }
7391 }
7392 impl Clone for CResult_TransactionNoneZ {
7393         fn clone(&self) -> Self {
7394                 if self.result_ok {
7395                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7396                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7397                         } }
7398                 } else {
7399                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7400                                 err: core::ptr::null_mut()
7401                         } }
7402                 }
7403         }
7404 }
7405 #[no_mangle]
7406 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7407 /// but with all dynamically-allocated buffers duplicated in new buffers.
7408 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7409 #[repr(C)]
7410 /// A tuple of 2 elements. See the individual fields for the types contained.
7411 pub struct C2Tuple_BlockHashChannelMonitorZ {
7412         /// The element at position 0
7413         pub a: crate::c_types::ThirtyTwoBytes,
7414         /// The element at position 1
7415         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7416 }
7417 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7418         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7419                 Self {
7420                         a: tup.0,
7421                         b: tup.1,
7422                 }
7423         }
7424 }
7425 impl C2Tuple_BlockHashChannelMonitorZ {
7426         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7427                 (self.a, self.b)
7428         }
7429 }
7430 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7431 #[no_mangle]
7432 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7433         C2Tuple_BlockHashChannelMonitorZ { a, b, }
7434 }
7435
7436 #[no_mangle]
7437 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7438 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7439 #[repr(C)]
7440 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7441 /// This corresponds to std::vector in C++
7442 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7443         /// The elements in the array.
7444         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7445         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7446         /// The number of elements pointed to by `data`.
7447         pub datalen: usize
7448 }
7449 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7450         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7451                 if self.datalen == 0 { return Vec::new(); }
7452                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7453                 self.data = core::ptr::null_mut();
7454                 self.datalen = 0;
7455                 ret
7456         }
7457         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7458                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7459         }
7460 }
7461 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7462         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7463                 let datalen = v.len();
7464                 let data = Box::into_raw(v.into_boxed_slice());
7465                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7466         }
7467 }
7468 #[no_mangle]
7469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7470 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7471 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7472         fn drop(&mut self) {
7473                 if self.datalen == 0 { return; }
7474                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7475         }
7476 }
7477 #[repr(C)]
7478 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7479 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7480         /// A pointer to the contents in the success state.
7481         /// Reading from this pointer when `result_ok` is not set is undefined.
7482         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7483         /// A pointer to the contents in the error state.
7484         /// Reading from this pointer when `result_ok` is set is undefined.
7485         pub err: *mut crate::c_types::IOError,
7486 }
7487 #[repr(C)]
7488 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7489 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7491 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7492         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7493         /// `err` or `result` depending on the state of `result_ok`.
7494         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7495         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7496         pub result_ok: bool,
7497 }
7498 #[no_mangle]
7499 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7500 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7501         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7502                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7503                         result: Box::into_raw(Box::new(o)),
7504                 },
7505                 result_ok: true,
7506         }
7507 }
7508 #[no_mangle]
7509 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7510 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7511         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7512                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7513                         err: Box::into_raw(Box::new(e)),
7514                 },
7515                 result_ok: false,
7516         }
7517 }
7518 /// Checks if the given object is currently in the success state
7519 #[no_mangle]
7520 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7521         o.result_ok
7522 }
7523 #[no_mangle]
7524 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7525 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7526 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7527         fn drop(&mut self) {
7528                 if self.result_ok {
7529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7531                         }
7532                 } else {
7533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7535                         }
7536                 }
7537         }
7538 }
7539 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7540         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7541                 let contents = if o.result_ok {
7542                         let result = unsafe { o.contents.result };
7543                         unsafe { o.contents.result = core::ptr::null_mut() };
7544                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7545                 } else {
7546                         let err = unsafe { o.contents.err };
7547                         unsafe { o.contents.err = core::ptr::null_mut(); }
7548                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7549                 };
7550                 Self {
7551                         contents,
7552                         result_ok: o.result_ok,
7553                 }
7554         }
7555 }
7556 #[repr(C)]
7557 #[derive(Clone)]
7558 /// An enum which can either contain a u16 or not
7559 pub enum COption_u16Z {
7560         /// When we're in this state, this COption_u16Z contains a u16
7561         Some(u16),
7562         /// When we're in this state, this COption_u16Z contains nothing
7563         None
7564 }
7565 impl COption_u16Z {
7566         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7567                 if let Self::None = self { false } else { true }
7568         }
7569         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7570                 !self.is_some()
7571         }
7572         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7573                 if let Self::Some(v) = self { v } else { unreachable!() }
7574         }
7575 }
7576 #[no_mangle]
7577 /// Constructs a new COption_u16Z containing a u16
7578 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7579         COption_u16Z::Some(o)
7580 }
7581 #[no_mangle]
7582 /// Constructs a new COption_u16Z containing nothing
7583 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7584         COption_u16Z::None
7585 }
7586 #[no_mangle]
7587 /// Frees any resources associated with the u16, if we are in the Some state
7588 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7589 #[no_mangle]
7590 /// Creates a new COption_u16Z which has the same data as `orig`
7591 /// but with all dynamically-allocated buffers duplicated in new buffers.
7592 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7593 #[repr(C)]
7594 /// The contents of CResult_NoneAPIErrorZ
7595 pub union CResult_NoneAPIErrorZPtr {
7596         /// Note that this value is always NULL, as there are no contents in the OK variant
7597         pub result: *mut core::ffi::c_void,
7598         /// A pointer to the contents in the error state.
7599         /// Reading from this pointer when `result_ok` is set is undefined.
7600         pub err: *mut crate::lightning::util::errors::APIError,
7601 }
7602 #[repr(C)]
7603 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7604 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7606 pub struct CResult_NoneAPIErrorZ {
7607         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7608         /// `err` or `result` depending on the state of `result_ok`.
7609         pub contents: CResult_NoneAPIErrorZPtr,
7610         /// Whether this CResult_NoneAPIErrorZ represents a success state.
7611         pub result_ok: bool,
7612 }
7613 #[no_mangle]
7614 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7615 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7616         CResult_NoneAPIErrorZ {
7617                 contents: CResult_NoneAPIErrorZPtr {
7618                         result: core::ptr::null_mut(),
7619                 },
7620                 result_ok: true,
7621         }
7622 }
7623 #[no_mangle]
7624 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7625 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7626         CResult_NoneAPIErrorZ {
7627                 contents: CResult_NoneAPIErrorZPtr {
7628                         err: Box::into_raw(Box::new(e)),
7629                 },
7630                 result_ok: false,
7631         }
7632 }
7633 /// Checks if the given object is currently in the success state
7634 #[no_mangle]
7635 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7636         o.result_ok
7637 }
7638 #[no_mangle]
7639 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7640 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7641 impl Drop for CResult_NoneAPIErrorZ {
7642         fn drop(&mut self) {
7643                 if self.result_ok {
7644                 } else {
7645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7647                         }
7648                 }
7649         }
7650 }
7651 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7652         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7653                 let contents = if o.result_ok {
7654                         let _ = unsafe { Box::from_raw(o.contents.result) };
7655                         o.contents.result = core::ptr::null_mut();
7656                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7657                 } else {
7658                         let err = unsafe { o.contents.err };
7659                         unsafe { o.contents.err = core::ptr::null_mut(); }
7660                         CResult_NoneAPIErrorZPtr { err }
7661                 };
7662                 Self {
7663                         contents,
7664                         result_ok: o.result_ok,
7665                 }
7666         }
7667 }
7668 impl Clone for CResult_NoneAPIErrorZ {
7669         fn clone(&self) -> Self {
7670                 if self.result_ok {
7671                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7672                                 result: core::ptr::null_mut()
7673                         } }
7674                 } else {
7675                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7676                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7677                         } }
7678                 }
7679         }
7680 }
7681 #[no_mangle]
7682 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7683 /// but with all dynamically-allocated buffers duplicated in new buffers.
7684 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7685 #[repr(C)]
7686 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7687 /// This corresponds to std::vector in C++
7688 pub struct CVec_CResult_NoneAPIErrorZZ {
7689         /// The elements in the array.
7690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7691         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7692         /// The number of elements pointed to by `data`.
7693         pub datalen: usize
7694 }
7695 impl CVec_CResult_NoneAPIErrorZZ {
7696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7697                 if self.datalen == 0 { return Vec::new(); }
7698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7699                 self.data = core::ptr::null_mut();
7700                 self.datalen = 0;
7701                 ret
7702         }
7703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7705         }
7706 }
7707 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7708         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7709                 let datalen = v.len();
7710                 let data = Box::into_raw(v.into_boxed_slice());
7711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7712         }
7713 }
7714 #[no_mangle]
7715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7716 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7717 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7718         fn drop(&mut self) {
7719                 if self.datalen == 0 { return; }
7720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7721         }
7722 }
7723 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7724         fn clone(&self) -> Self {
7725                 let mut res = Vec::new();
7726                 if self.datalen == 0 { return Self::from(res); }
7727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7728                 Self::from(res)
7729         }
7730 }
7731 #[repr(C)]
7732 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7733 /// This corresponds to std::vector in C++
7734 pub struct CVec_APIErrorZ {
7735         /// The elements in the array.
7736         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7737         pub data: *mut crate::lightning::util::errors::APIError,
7738         /// The number of elements pointed to by `data`.
7739         pub datalen: usize
7740 }
7741 impl CVec_APIErrorZ {
7742         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7743                 if self.datalen == 0 { return Vec::new(); }
7744                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7745                 self.data = core::ptr::null_mut();
7746                 self.datalen = 0;
7747                 ret
7748         }
7749         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7750                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7751         }
7752 }
7753 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7754         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7755                 let datalen = v.len();
7756                 let data = Box::into_raw(v.into_boxed_slice());
7757                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7758         }
7759 }
7760 #[no_mangle]
7761 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7762 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7763 impl Drop for CVec_APIErrorZ {
7764         fn drop(&mut self) {
7765                 if self.datalen == 0 { return; }
7766                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7767         }
7768 }
7769 impl Clone for CVec_APIErrorZ {
7770         fn clone(&self) -> Self {
7771                 let mut res = Vec::new();
7772                 if self.datalen == 0 { return Self::from(res); }
7773                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7774                 Self::from(res)
7775         }
7776 }
7777 #[repr(C)]
7778 /// The contents of CResult__u832APIErrorZ
7779 pub union CResult__u832APIErrorZPtr {
7780         /// A pointer to the contents in the success state.
7781         /// Reading from this pointer when `result_ok` is not set is undefined.
7782         pub result: *mut crate::c_types::ThirtyTwoBytes,
7783         /// A pointer to the contents in the error state.
7784         /// Reading from this pointer when `result_ok` is set is undefined.
7785         pub err: *mut crate::lightning::util::errors::APIError,
7786 }
7787 #[repr(C)]
7788 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7789 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7791 pub struct CResult__u832APIErrorZ {
7792         /// The contents of this CResult__u832APIErrorZ, accessible via either
7793         /// `err` or `result` depending on the state of `result_ok`.
7794         pub contents: CResult__u832APIErrorZPtr,
7795         /// Whether this CResult__u832APIErrorZ represents a success state.
7796         pub result_ok: bool,
7797 }
7798 #[no_mangle]
7799 /// Creates a new CResult__u832APIErrorZ in the success state.
7800 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7801         CResult__u832APIErrorZ {
7802                 contents: CResult__u832APIErrorZPtr {
7803                         result: Box::into_raw(Box::new(o)),
7804                 },
7805                 result_ok: true,
7806         }
7807 }
7808 #[no_mangle]
7809 /// Creates a new CResult__u832APIErrorZ in the error state.
7810 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7811         CResult__u832APIErrorZ {
7812                 contents: CResult__u832APIErrorZPtr {
7813                         err: Box::into_raw(Box::new(e)),
7814                 },
7815                 result_ok: false,
7816         }
7817 }
7818 /// Checks if the given object is currently in the success state
7819 #[no_mangle]
7820 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7821         o.result_ok
7822 }
7823 #[no_mangle]
7824 /// Frees any resources used by the CResult__u832APIErrorZ.
7825 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7826 impl Drop for CResult__u832APIErrorZ {
7827         fn drop(&mut self) {
7828                 if self.result_ok {
7829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7831                         }
7832                 } else {
7833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7835                         }
7836                 }
7837         }
7838 }
7839 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7840         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7841                 let contents = if o.result_ok {
7842                         let result = unsafe { o.contents.result };
7843                         unsafe { o.contents.result = core::ptr::null_mut() };
7844                         CResult__u832APIErrorZPtr { result }
7845                 } else {
7846                         let err = unsafe { o.contents.err };
7847                         unsafe { o.contents.err = core::ptr::null_mut(); }
7848                         CResult__u832APIErrorZPtr { err }
7849                 };
7850                 Self {
7851                         contents,
7852                         result_ok: o.result_ok,
7853                 }
7854         }
7855 }
7856 impl Clone for CResult__u832APIErrorZ {
7857         fn clone(&self) -> Self {
7858                 if self.result_ok {
7859                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7860                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7861                         } }
7862                 } else {
7863                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
7864                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7865                         } }
7866                 }
7867         }
7868 }
7869 #[no_mangle]
7870 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
7873 #[repr(C)]
7874 /// The contents of CResult_PaymentIdPaymentSendFailureZ
7875 pub union CResult_PaymentIdPaymentSendFailureZPtr {
7876         /// A pointer to the contents in the success state.
7877         /// Reading from this pointer when `result_ok` is not set is undefined.
7878         pub result: *mut crate::c_types::ThirtyTwoBytes,
7879         /// A pointer to the contents in the error state.
7880         /// Reading from this pointer when `result_ok` is set is undefined.
7881         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7882 }
7883 #[repr(C)]
7884 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7885 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7887 pub struct CResult_PaymentIdPaymentSendFailureZ {
7888         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7889         /// `err` or `result` depending on the state of `result_ok`.
7890         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
7891         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7892         pub result_ok: bool,
7893 }
7894 #[no_mangle]
7895 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
7896 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
7897         CResult_PaymentIdPaymentSendFailureZ {
7898                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7899                         result: Box::into_raw(Box::new(o)),
7900                 },
7901                 result_ok: true,
7902         }
7903 }
7904 #[no_mangle]
7905 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
7906 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
7907         CResult_PaymentIdPaymentSendFailureZ {
7908                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
7909                         err: Box::into_raw(Box::new(e)),
7910                 },
7911                 result_ok: false,
7912         }
7913 }
7914 /// Checks if the given object is currently in the success state
7915 #[no_mangle]
7916 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
7917         o.result_ok
7918 }
7919 #[no_mangle]
7920 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
7921 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
7922 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
7923         fn drop(&mut self) {
7924                 if self.result_ok {
7925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7927                         }
7928                 } else {
7929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7931                         }
7932                 }
7933         }
7934 }
7935 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
7936         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
7937                 let contents = if o.result_ok {
7938                         let result = unsafe { o.contents.result };
7939                         unsafe { o.contents.result = core::ptr::null_mut() };
7940                         CResult_PaymentIdPaymentSendFailureZPtr { result }
7941                 } else {
7942                         let err = unsafe { o.contents.err };
7943                         unsafe { o.contents.err = core::ptr::null_mut(); }
7944                         CResult_PaymentIdPaymentSendFailureZPtr { err }
7945                 };
7946                 Self {
7947                         contents,
7948                         result_ok: o.result_ok,
7949                 }
7950         }
7951 }
7952 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
7953         fn clone(&self) -> Self {
7954                 if self.result_ok {
7955                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7956                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7957                         } }
7958                 } else {
7959                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
7960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
7961                         } }
7962                 }
7963         }
7964 }
7965 #[no_mangle]
7966 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
7967 /// but with all dynamically-allocated buffers duplicated in new buffers.
7968 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
7969 #[repr(C)]
7970 /// The contents of CResult_NonePaymentSendFailureZ
7971 pub union CResult_NonePaymentSendFailureZPtr {
7972         /// Note that this value is always NULL, as there are no contents in the OK variant
7973         pub result: *mut core::ffi::c_void,
7974         /// A pointer to the contents in the error state.
7975         /// Reading from this pointer when `result_ok` is set is undefined.
7976         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
7977 }
7978 #[repr(C)]
7979 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7980 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7982 pub struct CResult_NonePaymentSendFailureZ {
7983         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7984         /// `err` or `result` depending on the state of `result_ok`.
7985         pub contents: CResult_NonePaymentSendFailureZPtr,
7986         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
7987         pub result_ok: bool,
7988 }
7989 #[no_mangle]
7990 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
7991 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
7992         CResult_NonePaymentSendFailureZ {
7993                 contents: CResult_NonePaymentSendFailureZPtr {
7994                         result: core::ptr::null_mut(),
7995                 },
7996                 result_ok: true,
7997         }
7998 }
7999 #[no_mangle]
8000 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8001 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8002         CResult_NonePaymentSendFailureZ {
8003                 contents: CResult_NonePaymentSendFailureZPtr {
8004                         err: Box::into_raw(Box::new(e)),
8005                 },
8006                 result_ok: false,
8007         }
8008 }
8009 /// Checks if the given object is currently in the success state
8010 #[no_mangle]
8011 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8012         o.result_ok
8013 }
8014 #[no_mangle]
8015 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8016 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8017 impl Drop for CResult_NonePaymentSendFailureZ {
8018         fn drop(&mut self) {
8019                 if self.result_ok {
8020                 } else {
8021                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8022                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8023                         }
8024                 }
8025         }
8026 }
8027 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8028         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8029                 let contents = if o.result_ok {
8030                         let _ = unsafe { Box::from_raw(o.contents.result) };
8031                         o.contents.result = core::ptr::null_mut();
8032                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8033                 } else {
8034                         let err = unsafe { o.contents.err };
8035                         unsafe { o.contents.err = core::ptr::null_mut(); }
8036                         CResult_NonePaymentSendFailureZPtr { err }
8037                 };
8038                 Self {
8039                         contents,
8040                         result_ok: o.result_ok,
8041                 }
8042         }
8043 }
8044 impl Clone for CResult_NonePaymentSendFailureZ {
8045         fn clone(&self) -> Self {
8046                 if self.result_ok {
8047                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8048                                 result: core::ptr::null_mut()
8049                         } }
8050                 } else {
8051                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8052                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8053                         } }
8054                 }
8055         }
8056 }
8057 #[no_mangle]
8058 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8059 /// but with all dynamically-allocated buffers duplicated in new buffers.
8060 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8061 #[repr(C)]
8062 /// A tuple of 2 elements. See the individual fields for the types contained.
8063 pub struct C2Tuple_PaymentHashPaymentIdZ {
8064         /// The element at position 0
8065         pub a: crate::c_types::ThirtyTwoBytes,
8066         /// The element at position 1
8067         pub b: crate::c_types::ThirtyTwoBytes,
8068 }
8069 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8070         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8071                 Self {
8072                         a: tup.0,
8073                         b: tup.1,
8074                 }
8075         }
8076 }
8077 impl C2Tuple_PaymentHashPaymentIdZ {
8078         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8079                 (self.a, self.b)
8080         }
8081 }
8082 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8083         fn clone(&self) -> Self {
8084                 Self {
8085                         a: Clone::clone(&self.a),
8086                         b: Clone::clone(&self.b),
8087                 }
8088         }
8089 }
8090 #[no_mangle]
8091 /// Creates a new tuple which has the same data as `orig`
8092 /// but with all dynamically-allocated buffers duplicated in new buffers.
8093 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8094 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8095 #[no_mangle]
8096 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8097         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8098 }
8099
8100 #[no_mangle]
8101 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8102 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8103 #[repr(C)]
8104 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8105 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8106         /// A pointer to the contents in the success state.
8107         /// Reading from this pointer when `result_ok` is not set is undefined.
8108         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8109         /// A pointer to the contents in the error state.
8110         /// Reading from this pointer when `result_ok` is set is undefined.
8111         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8112 }
8113 #[repr(C)]
8114 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8115 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8117 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8118         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8119         /// `err` or `result` depending on the state of `result_ok`.
8120         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8121         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8122         pub result_ok: bool,
8123 }
8124 #[no_mangle]
8125 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8126 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8127         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8128                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8129                         result: Box::into_raw(Box::new(o)),
8130                 },
8131                 result_ok: true,
8132         }
8133 }
8134 #[no_mangle]
8135 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8136 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8137         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8138                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8139                         err: Box::into_raw(Box::new(e)),
8140                 },
8141                 result_ok: false,
8142         }
8143 }
8144 /// Checks if the given object is currently in the success state
8145 #[no_mangle]
8146 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8147         o.result_ok
8148 }
8149 #[no_mangle]
8150 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8151 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8152 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8153         fn drop(&mut self) {
8154                 if self.result_ok {
8155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8157                         }
8158                 } else {
8159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8161                         }
8162                 }
8163         }
8164 }
8165 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8166         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8167                 let contents = if o.result_ok {
8168                         let result = unsafe { o.contents.result };
8169                         unsafe { o.contents.result = core::ptr::null_mut() };
8170                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8171                 } else {
8172                         let err = unsafe { o.contents.err };
8173                         unsafe { o.contents.err = core::ptr::null_mut(); }
8174                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8175                 };
8176                 Self {
8177                         contents,
8178                         result_ok: o.result_ok,
8179                 }
8180         }
8181 }
8182 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8183         fn clone(&self) -> Self {
8184                 if self.result_ok {
8185                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8186                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8187                         } }
8188                 } else {
8189                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8191                         } }
8192                 }
8193         }
8194 }
8195 #[no_mangle]
8196 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8197 /// but with all dynamically-allocated buffers duplicated in new buffers.
8198 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8199 #[repr(C)]
8200 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8201 /// This corresponds to std::vector in C++
8202 pub struct CVec_ThirtyTwoBytesZ {
8203         /// The elements in the array.
8204         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8205         pub data: *mut crate::c_types::ThirtyTwoBytes,
8206         /// The number of elements pointed to by `data`.
8207         pub datalen: usize
8208 }
8209 impl CVec_ThirtyTwoBytesZ {
8210         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8211                 if self.datalen == 0 { return Vec::new(); }
8212                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8213                 self.data = core::ptr::null_mut();
8214                 self.datalen = 0;
8215                 ret
8216         }
8217         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8218                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8219         }
8220 }
8221 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8222         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8223                 let datalen = v.len();
8224                 let data = Box::into_raw(v.into_boxed_slice());
8225                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8226         }
8227 }
8228 #[no_mangle]
8229 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8230 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8231 impl Drop for CVec_ThirtyTwoBytesZ {
8232         fn drop(&mut self) {
8233                 if self.datalen == 0 { return; }
8234                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8235         }
8236 }
8237 impl Clone for CVec_ThirtyTwoBytesZ {
8238         fn clone(&self) -> Self {
8239                 let mut res = Vec::new();
8240                 if self.datalen == 0 { return Self::from(res); }
8241                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8242                 Self::from(res)
8243         }
8244 }
8245 #[repr(C)]
8246 /// A tuple of 2 elements. See the individual fields for the types contained.
8247 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8248         /// The element at position 0
8249         pub a: crate::c_types::ThirtyTwoBytes,
8250         /// The element at position 1
8251         pub b: crate::c_types::ThirtyTwoBytes,
8252 }
8253 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8254         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8255                 Self {
8256                         a: tup.0,
8257                         b: tup.1,
8258                 }
8259         }
8260 }
8261 impl C2Tuple_PaymentHashPaymentSecretZ {
8262         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8263                 (self.a, self.b)
8264         }
8265 }
8266 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8267         fn clone(&self) -> Self {
8268                 Self {
8269                         a: Clone::clone(&self.a),
8270                         b: Clone::clone(&self.b),
8271                 }
8272         }
8273 }
8274 #[no_mangle]
8275 /// Creates a new tuple which has the same data as `orig`
8276 /// but with all dynamically-allocated buffers duplicated in new buffers.
8277 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8278 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8279 #[no_mangle]
8280 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8281         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8282 }
8283
8284 #[no_mangle]
8285 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8286 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8287 #[repr(C)]
8288 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8289 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8290         /// A pointer to the contents in the success state.
8291         /// Reading from this pointer when `result_ok` is not set is undefined.
8292         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8293         /// Note that this value is always NULL, as there are no contents in the Err variant
8294         pub err: *mut core::ffi::c_void,
8295 }
8296 #[repr(C)]
8297 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8298 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8300 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8301         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8302         /// `err` or `result` depending on the state of `result_ok`.
8303         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8304         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8305         pub result_ok: bool,
8306 }
8307 #[no_mangle]
8308 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8309 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8310         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8311                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8312                         result: Box::into_raw(Box::new(o)),
8313                 },
8314                 result_ok: true,
8315         }
8316 }
8317 #[no_mangle]
8318 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8319 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8320         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8321                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8322                         err: core::ptr::null_mut(),
8323                 },
8324                 result_ok: false,
8325         }
8326 }
8327 /// Checks if the given object is currently in the success state
8328 #[no_mangle]
8329 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8330         o.result_ok
8331 }
8332 #[no_mangle]
8333 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8334 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8335 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8336         fn drop(&mut self) {
8337                 if self.result_ok {
8338                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8339                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8340                         }
8341                 } else {
8342                 }
8343         }
8344 }
8345 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8346         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8347                 let contents = if o.result_ok {
8348                         let result = unsafe { o.contents.result };
8349                         unsafe { o.contents.result = core::ptr::null_mut() };
8350                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8351                 } else {
8352                         let _ = unsafe { Box::from_raw(o.contents.err) };
8353                         o.contents.err = core::ptr::null_mut();
8354                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8355                 };
8356                 Self {
8357                         contents,
8358                         result_ok: o.result_ok,
8359                 }
8360         }
8361 }
8362 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8363         fn clone(&self) -> Self {
8364                 if self.result_ok {
8365                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8366                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8367                         } }
8368                 } else {
8369                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8370                                 err: core::ptr::null_mut()
8371                         } }
8372                 }
8373         }
8374 }
8375 #[no_mangle]
8376 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8377 /// but with all dynamically-allocated buffers duplicated in new buffers.
8378 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8379 #[repr(C)]
8380 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8381 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8382         /// A pointer to the contents in the success state.
8383         /// Reading from this pointer when `result_ok` is not set is undefined.
8384         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8385         /// A pointer to the contents in the error state.
8386         /// Reading from this pointer when `result_ok` is set is undefined.
8387         pub err: *mut crate::lightning::util::errors::APIError,
8388 }
8389 #[repr(C)]
8390 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8391 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8392 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8393 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8394         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8395         /// `err` or `result` depending on the state of `result_ok`.
8396         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8397         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8398         pub result_ok: bool,
8399 }
8400 #[no_mangle]
8401 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8402 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8403         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8404                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8405                         result: Box::into_raw(Box::new(o)),
8406                 },
8407                 result_ok: true,
8408         }
8409 }
8410 #[no_mangle]
8411 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8412 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8413         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8414                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8415                         err: Box::into_raw(Box::new(e)),
8416                 },
8417                 result_ok: false,
8418         }
8419 }
8420 /// Checks if the given object is currently in the success state
8421 #[no_mangle]
8422 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8423         o.result_ok
8424 }
8425 #[no_mangle]
8426 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8427 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8428 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8429         fn drop(&mut self) {
8430                 if self.result_ok {
8431                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8432                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8433                         }
8434                 } else {
8435                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8436                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8437                         }
8438                 }
8439         }
8440 }
8441 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8442         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8443                 let contents = if o.result_ok {
8444                         let result = unsafe { o.contents.result };
8445                         unsafe { o.contents.result = core::ptr::null_mut() };
8446                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8447                 } else {
8448                         let err = unsafe { o.contents.err };
8449                         unsafe { o.contents.err = core::ptr::null_mut(); }
8450                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8451                 };
8452                 Self {
8453                         contents,
8454                         result_ok: o.result_ok,
8455                 }
8456         }
8457 }
8458 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8459         fn clone(&self) -> Self {
8460                 if self.result_ok {
8461                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8462                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8463                         } }
8464                 } else {
8465                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8466                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8467                         } }
8468                 }
8469         }
8470 }
8471 #[no_mangle]
8472 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8473 /// but with all dynamically-allocated buffers duplicated in new buffers.
8474 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8475 #[repr(C)]
8476 /// The contents of CResult_PaymentSecretNoneZ
8477 pub union CResult_PaymentSecretNoneZPtr {
8478         /// A pointer to the contents in the success state.
8479         /// Reading from this pointer when `result_ok` is not set is undefined.
8480         pub result: *mut crate::c_types::ThirtyTwoBytes,
8481         /// Note that this value is always NULL, as there are no contents in the Err variant
8482         pub err: *mut core::ffi::c_void,
8483 }
8484 #[repr(C)]
8485 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8486 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8487 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8488 pub struct CResult_PaymentSecretNoneZ {
8489         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8490         /// `err` or `result` depending on the state of `result_ok`.
8491         pub contents: CResult_PaymentSecretNoneZPtr,
8492         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8493         pub result_ok: bool,
8494 }
8495 #[no_mangle]
8496 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8497 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8498         CResult_PaymentSecretNoneZ {
8499                 contents: CResult_PaymentSecretNoneZPtr {
8500                         result: Box::into_raw(Box::new(o)),
8501                 },
8502                 result_ok: true,
8503         }
8504 }
8505 #[no_mangle]
8506 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8507 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8508         CResult_PaymentSecretNoneZ {
8509                 contents: CResult_PaymentSecretNoneZPtr {
8510                         err: core::ptr::null_mut(),
8511                 },
8512                 result_ok: false,
8513         }
8514 }
8515 /// Checks if the given object is currently in the success state
8516 #[no_mangle]
8517 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8518         o.result_ok
8519 }
8520 #[no_mangle]
8521 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8522 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8523 impl Drop for CResult_PaymentSecretNoneZ {
8524         fn drop(&mut self) {
8525                 if self.result_ok {
8526                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8527                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8528                         }
8529                 } else {
8530                 }
8531         }
8532 }
8533 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8534         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8535                 let contents = if o.result_ok {
8536                         let result = unsafe { o.contents.result };
8537                         unsafe { o.contents.result = core::ptr::null_mut() };
8538                         CResult_PaymentSecretNoneZPtr { result }
8539                 } else {
8540                         let _ = unsafe { Box::from_raw(o.contents.err) };
8541                         o.contents.err = core::ptr::null_mut();
8542                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8543                 };
8544                 Self {
8545                         contents,
8546                         result_ok: o.result_ok,
8547                 }
8548         }
8549 }
8550 impl Clone for CResult_PaymentSecretNoneZ {
8551         fn clone(&self) -> Self {
8552                 if self.result_ok {
8553                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8554                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8555                         } }
8556                 } else {
8557                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8558                                 err: core::ptr::null_mut()
8559                         } }
8560                 }
8561         }
8562 }
8563 #[no_mangle]
8564 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8565 /// but with all dynamically-allocated buffers duplicated in new buffers.
8566 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8567 #[repr(C)]
8568 /// The contents of CResult_PaymentSecretAPIErrorZ
8569 pub union CResult_PaymentSecretAPIErrorZPtr {
8570         /// A pointer to the contents in the success state.
8571         /// Reading from this pointer when `result_ok` is not set is undefined.
8572         pub result: *mut crate::c_types::ThirtyTwoBytes,
8573         /// A pointer to the contents in the error state.
8574         /// Reading from this pointer when `result_ok` is set is undefined.
8575         pub err: *mut crate::lightning::util::errors::APIError,
8576 }
8577 #[repr(C)]
8578 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8579 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8580 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8581 pub struct CResult_PaymentSecretAPIErrorZ {
8582         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8583         /// `err` or `result` depending on the state of `result_ok`.
8584         pub contents: CResult_PaymentSecretAPIErrorZPtr,
8585         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8586         pub result_ok: bool,
8587 }
8588 #[no_mangle]
8589 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8590 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8591         CResult_PaymentSecretAPIErrorZ {
8592                 contents: CResult_PaymentSecretAPIErrorZPtr {
8593                         result: Box::into_raw(Box::new(o)),
8594                 },
8595                 result_ok: true,
8596         }
8597 }
8598 #[no_mangle]
8599 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8600 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8601         CResult_PaymentSecretAPIErrorZ {
8602                 contents: CResult_PaymentSecretAPIErrorZPtr {
8603                         err: Box::into_raw(Box::new(e)),
8604                 },
8605                 result_ok: false,
8606         }
8607 }
8608 /// Checks if the given object is currently in the success state
8609 #[no_mangle]
8610 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8611         o.result_ok
8612 }
8613 #[no_mangle]
8614 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8615 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8616 impl Drop for CResult_PaymentSecretAPIErrorZ {
8617         fn drop(&mut self) {
8618                 if self.result_ok {
8619                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8620                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8621                         }
8622                 } else {
8623                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8624                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8625                         }
8626                 }
8627         }
8628 }
8629 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8630         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8631                 let contents = if o.result_ok {
8632                         let result = unsafe { o.contents.result };
8633                         unsafe { o.contents.result = core::ptr::null_mut() };
8634                         CResult_PaymentSecretAPIErrorZPtr { result }
8635                 } else {
8636                         let err = unsafe { o.contents.err };
8637                         unsafe { o.contents.err = core::ptr::null_mut(); }
8638                         CResult_PaymentSecretAPIErrorZPtr { err }
8639                 };
8640                 Self {
8641                         contents,
8642                         result_ok: o.result_ok,
8643                 }
8644         }
8645 }
8646 impl Clone for CResult_PaymentSecretAPIErrorZ {
8647         fn clone(&self) -> Self {
8648                 if self.result_ok {
8649                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8650                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8651                         } }
8652                 } else {
8653                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8654                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8655                         } }
8656                 }
8657         }
8658 }
8659 #[no_mangle]
8660 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8661 /// but with all dynamically-allocated buffers duplicated in new buffers.
8662 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8663 #[repr(C)]
8664 /// The contents of CResult_PaymentPreimageAPIErrorZ
8665 pub union CResult_PaymentPreimageAPIErrorZPtr {
8666         /// A pointer to the contents in the success state.
8667         /// Reading from this pointer when `result_ok` is not set is undefined.
8668         pub result: *mut crate::c_types::ThirtyTwoBytes,
8669         /// A pointer to the contents in the error state.
8670         /// Reading from this pointer when `result_ok` is set is undefined.
8671         pub err: *mut crate::lightning::util::errors::APIError,
8672 }
8673 #[repr(C)]
8674 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8675 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8676 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8677 pub struct CResult_PaymentPreimageAPIErrorZ {
8678         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8679         /// `err` or `result` depending on the state of `result_ok`.
8680         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8681         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8682         pub result_ok: bool,
8683 }
8684 #[no_mangle]
8685 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8686 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8687         CResult_PaymentPreimageAPIErrorZ {
8688                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8689                         result: Box::into_raw(Box::new(o)),
8690                 },
8691                 result_ok: true,
8692         }
8693 }
8694 #[no_mangle]
8695 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8696 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8697         CResult_PaymentPreimageAPIErrorZ {
8698                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8699                         err: Box::into_raw(Box::new(e)),
8700                 },
8701                 result_ok: false,
8702         }
8703 }
8704 /// Checks if the given object is currently in the success state
8705 #[no_mangle]
8706 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8707         o.result_ok
8708 }
8709 #[no_mangle]
8710 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8711 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8712 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8713         fn drop(&mut self) {
8714                 if self.result_ok {
8715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8717                         }
8718                 } else {
8719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8721                         }
8722                 }
8723         }
8724 }
8725 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8726         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8727                 let contents = if o.result_ok {
8728                         let result = unsafe { o.contents.result };
8729                         unsafe { o.contents.result = core::ptr::null_mut() };
8730                         CResult_PaymentPreimageAPIErrorZPtr { result }
8731                 } else {
8732                         let err = unsafe { o.contents.err };
8733                         unsafe { o.contents.err = core::ptr::null_mut(); }
8734                         CResult_PaymentPreimageAPIErrorZPtr { err }
8735                 };
8736                 Self {
8737                         contents,
8738                         result_ok: o.result_ok,
8739                 }
8740         }
8741 }
8742 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8743         fn clone(&self) -> Self {
8744                 if self.result_ok {
8745                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8746                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8747                         } }
8748                 } else {
8749                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8750                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8751                         } }
8752                 }
8753         }
8754 }
8755 #[no_mangle]
8756 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8757 /// but with all dynamically-allocated buffers duplicated in new buffers.
8758 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8759 #[repr(C)]
8760 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8761 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8762         /// A pointer to the contents in the success state.
8763         /// Reading from this pointer when `result_ok` is not set is undefined.
8764         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8765         /// A pointer to the contents in the error state.
8766         /// Reading from this pointer when `result_ok` is set is undefined.
8767         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8768 }
8769 #[repr(C)]
8770 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8771 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8773 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8774         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8775         /// `err` or `result` depending on the state of `result_ok`.
8776         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8777         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8778         pub result_ok: bool,
8779 }
8780 #[no_mangle]
8781 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8782 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8783         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8784                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8785                         result: Box::into_raw(Box::new(o)),
8786                 },
8787                 result_ok: true,
8788         }
8789 }
8790 #[no_mangle]
8791 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8792 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8793         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8794                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8795                         err: Box::into_raw(Box::new(e)),
8796                 },
8797                 result_ok: false,
8798         }
8799 }
8800 /// Checks if the given object is currently in the success state
8801 #[no_mangle]
8802 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8803         o.result_ok
8804 }
8805 #[no_mangle]
8806 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8807 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8808 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8809         fn drop(&mut self) {
8810                 if self.result_ok {
8811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8813                         }
8814                 } else {
8815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8817                         }
8818                 }
8819         }
8820 }
8821 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8823                 let contents = if o.result_ok {
8824                         let result = unsafe { o.contents.result };
8825                         unsafe { o.contents.result = core::ptr::null_mut() };
8826                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8827                 } else {
8828                         let err = unsafe { o.contents.err };
8829                         unsafe { o.contents.err = core::ptr::null_mut(); }
8830                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8831                 };
8832                 Self {
8833                         contents,
8834                         result_ok: o.result_ok,
8835                 }
8836         }
8837 }
8838 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8839         fn clone(&self) -> Self {
8840                 if self.result_ok {
8841                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8842                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8843                         } }
8844                 } else {
8845                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8847                         } }
8848                 }
8849         }
8850 }
8851 #[no_mangle]
8852 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8853 /// but with all dynamically-allocated buffers duplicated in new buffers.
8854 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8855 #[repr(C)]
8856 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8857 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8858         /// A pointer to the contents in the success state.
8859         /// Reading from this pointer when `result_ok` is not set is undefined.
8860         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8861         /// A pointer to the contents in the error state.
8862         /// Reading from this pointer when `result_ok` is set is undefined.
8863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8864 }
8865 #[repr(C)]
8866 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
8867 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
8868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8869 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
8870         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
8871         /// `err` or `result` depending on the state of `result_ok`.
8872         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
8873         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
8874         pub result_ok: bool,
8875 }
8876 #[no_mangle]
8877 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
8878 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
8879         CResult_ChannelCounterpartyDecodeErrorZ {
8880                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8881                         result: Box::into_raw(Box::new(o)),
8882                 },
8883                 result_ok: true,
8884         }
8885 }
8886 #[no_mangle]
8887 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
8888 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
8889         CResult_ChannelCounterpartyDecodeErrorZ {
8890                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8891                         err: Box::into_raw(Box::new(e)),
8892                 },
8893                 result_ok: false,
8894         }
8895 }
8896 /// Checks if the given object is currently in the success state
8897 #[no_mangle]
8898 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
8899         o.result_ok
8900 }
8901 #[no_mangle]
8902 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
8903 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
8904 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
8905         fn drop(&mut self) {
8906                 if self.result_ok {
8907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8909                         }
8910                 } else {
8911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8913                         }
8914                 }
8915         }
8916 }
8917 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
8918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
8919                 let contents = if o.result_ok {
8920                         let result = unsafe { o.contents.result };
8921                         unsafe { o.contents.result = core::ptr::null_mut() };
8922                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
8923                 } else {
8924                         let err = unsafe { o.contents.err };
8925                         unsafe { o.contents.err = core::ptr::null_mut(); }
8926                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
8927                 };
8928                 Self {
8929                         contents,
8930                         result_ok: o.result_ok,
8931                 }
8932         }
8933 }
8934 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
8935         fn clone(&self) -> Self {
8936                 if self.result_ok {
8937                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8938                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
8939                         } }
8940                 } else {
8941                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
8942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8943                         } }
8944                 }
8945         }
8946 }
8947 #[no_mangle]
8948 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
8949 /// but with all dynamically-allocated buffers duplicated in new buffers.
8950 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
8951 #[repr(C)]
8952 /// The contents of CResult_ChannelDetailsDecodeErrorZ
8953 pub union CResult_ChannelDetailsDecodeErrorZPtr {
8954         /// A pointer to the contents in the success state.
8955         /// Reading from this pointer when `result_ok` is not set is undefined.
8956         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
8957         /// A pointer to the contents in the error state.
8958         /// Reading from this pointer when `result_ok` is set is undefined.
8959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8960 }
8961 #[repr(C)]
8962 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
8963 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
8964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8965 pub struct CResult_ChannelDetailsDecodeErrorZ {
8966         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
8967         /// `err` or `result` depending on the state of `result_ok`.
8968         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
8969         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
8970         pub result_ok: bool,
8971 }
8972 #[no_mangle]
8973 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
8974 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
8975         CResult_ChannelDetailsDecodeErrorZ {
8976                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8977                         result: Box::into_raw(Box::new(o)),
8978                 },
8979                 result_ok: true,
8980         }
8981 }
8982 #[no_mangle]
8983 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
8984 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
8985         CResult_ChannelDetailsDecodeErrorZ {
8986                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
8987                         err: Box::into_raw(Box::new(e)),
8988                 },
8989                 result_ok: false,
8990         }
8991 }
8992 /// Checks if the given object is currently in the success state
8993 #[no_mangle]
8994 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
8995         o.result_ok
8996 }
8997 #[no_mangle]
8998 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
8999 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9000 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9001         fn drop(&mut self) {
9002                 if self.result_ok {
9003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9005                         }
9006                 } else {
9007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9009                         }
9010                 }
9011         }
9012 }
9013 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9014         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9015                 let contents = if o.result_ok {
9016                         let result = unsafe { o.contents.result };
9017                         unsafe { o.contents.result = core::ptr::null_mut() };
9018                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9019                 } else {
9020                         let err = unsafe { o.contents.err };
9021                         unsafe { o.contents.err = core::ptr::null_mut(); }
9022                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9023                 };
9024                 Self {
9025                         contents,
9026                         result_ok: o.result_ok,
9027                 }
9028         }
9029 }
9030 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9031         fn clone(&self) -> Self {
9032                 if self.result_ok {
9033                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9034                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9035                         } }
9036                 } else {
9037                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9039                         } }
9040                 }
9041         }
9042 }
9043 #[no_mangle]
9044 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9045 /// but with all dynamically-allocated buffers duplicated in new buffers.
9046 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9047 #[repr(C)]
9048 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9049 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9050         /// A pointer to the contents in the success state.
9051         /// Reading from this pointer when `result_ok` is not set is undefined.
9052         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9053         /// A pointer to the contents in the error state.
9054         /// Reading from this pointer when `result_ok` is set is undefined.
9055         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9056 }
9057 #[repr(C)]
9058 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9059 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9060 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9061 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9062         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9063         /// `err` or `result` depending on the state of `result_ok`.
9064         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9065         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9066         pub result_ok: bool,
9067 }
9068 #[no_mangle]
9069 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9070 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9071         CResult_PhantomRouteHintsDecodeErrorZ {
9072                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9073                         result: Box::into_raw(Box::new(o)),
9074                 },
9075                 result_ok: true,
9076         }
9077 }
9078 #[no_mangle]
9079 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9080 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9081         CResult_PhantomRouteHintsDecodeErrorZ {
9082                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9083                         err: Box::into_raw(Box::new(e)),
9084                 },
9085                 result_ok: false,
9086         }
9087 }
9088 /// Checks if the given object is currently in the success state
9089 #[no_mangle]
9090 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9091         o.result_ok
9092 }
9093 #[no_mangle]
9094 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9095 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9096 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9097         fn drop(&mut self) {
9098                 if self.result_ok {
9099                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9100                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9101                         }
9102                 } else {
9103                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9104                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9105                         }
9106                 }
9107         }
9108 }
9109 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9110         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9111                 let contents = if o.result_ok {
9112                         let result = unsafe { o.contents.result };
9113                         unsafe { o.contents.result = core::ptr::null_mut() };
9114                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9115                 } else {
9116                         let err = unsafe { o.contents.err };
9117                         unsafe { o.contents.err = core::ptr::null_mut(); }
9118                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9119                 };
9120                 Self {
9121                         contents,
9122                         result_ok: o.result_ok,
9123                 }
9124         }
9125 }
9126 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9127         fn clone(&self) -> Self {
9128                 if self.result_ok {
9129                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9130                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9131                         } }
9132                 } else {
9133                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9134                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9135                         } }
9136                 }
9137         }
9138 }
9139 #[no_mangle]
9140 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9141 /// but with all dynamically-allocated buffers duplicated in new buffers.
9142 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9143 #[repr(C)]
9144 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9145 /// This corresponds to std::vector in C++
9146 pub struct CVec_ChannelMonitorZ {
9147         /// The elements in the array.
9148         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9149         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9150         /// The number of elements pointed to by `data`.
9151         pub datalen: usize
9152 }
9153 impl CVec_ChannelMonitorZ {
9154         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9155                 if self.datalen == 0 { return Vec::new(); }
9156                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9157                 self.data = core::ptr::null_mut();
9158                 self.datalen = 0;
9159                 ret
9160         }
9161         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9162                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9163         }
9164 }
9165 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9166         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9167                 let datalen = v.len();
9168                 let data = Box::into_raw(v.into_boxed_slice());
9169                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9170         }
9171 }
9172 #[no_mangle]
9173 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9174 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9175 impl Drop for CVec_ChannelMonitorZ {
9176         fn drop(&mut self) {
9177                 if self.datalen == 0 { return; }
9178                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9179         }
9180 }
9181 #[repr(C)]
9182 /// A tuple of 2 elements. See the individual fields for the types contained.
9183 pub struct C2Tuple_BlockHashChannelManagerZ {
9184         /// The element at position 0
9185         pub a: crate::c_types::ThirtyTwoBytes,
9186         /// The element at position 1
9187         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9188 }
9189 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9190         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9191                 Self {
9192                         a: tup.0,
9193                         b: tup.1,
9194                 }
9195         }
9196 }
9197 impl C2Tuple_BlockHashChannelManagerZ {
9198         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9199                 (self.a, self.b)
9200         }
9201 }
9202 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9203 #[no_mangle]
9204 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9205         C2Tuple_BlockHashChannelManagerZ { a, b, }
9206 }
9207
9208 #[no_mangle]
9209 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9210 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9211 #[repr(C)]
9212 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9213 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9214         /// A pointer to the contents in the success state.
9215         /// Reading from this pointer when `result_ok` is not set is undefined.
9216         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9217         /// A pointer to the contents in the error state.
9218         /// Reading from this pointer when `result_ok` is set is undefined.
9219         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9220 }
9221 #[repr(C)]
9222 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9223 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9224 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9225 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9226         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9227         /// `err` or `result` depending on the state of `result_ok`.
9228         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9229         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9230         pub result_ok: bool,
9231 }
9232 #[no_mangle]
9233 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9234 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9235         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9236                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9237                         result: Box::into_raw(Box::new(o)),
9238                 },
9239                 result_ok: true,
9240         }
9241 }
9242 #[no_mangle]
9243 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9244 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9245         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9246                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9247                         err: Box::into_raw(Box::new(e)),
9248                 },
9249                 result_ok: false,
9250         }
9251 }
9252 /// Checks if the given object is currently in the success state
9253 #[no_mangle]
9254 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9255         o.result_ok
9256 }
9257 #[no_mangle]
9258 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9259 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9260 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9261         fn drop(&mut self) {
9262                 if self.result_ok {
9263                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9264                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9265                         }
9266                 } else {
9267                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9268                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9269                         }
9270                 }
9271         }
9272 }
9273 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9274         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9275                 let contents = if o.result_ok {
9276                         let result = unsafe { o.contents.result };
9277                         unsafe { o.contents.result = core::ptr::null_mut() };
9278                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9279                 } else {
9280                         let err = unsafe { o.contents.err };
9281                         unsafe { o.contents.err = core::ptr::null_mut(); }
9282                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9283                 };
9284                 Self {
9285                         contents,
9286                         result_ok: o.result_ok,
9287                 }
9288         }
9289 }
9290 #[repr(C)]
9291 /// The contents of CResult_ChannelConfigDecodeErrorZ
9292 pub union CResult_ChannelConfigDecodeErrorZPtr {
9293         /// A pointer to the contents in the success state.
9294         /// Reading from this pointer when `result_ok` is not set is undefined.
9295         pub result: *mut crate::lightning::util::config::ChannelConfig,
9296         /// A pointer to the contents in the error state.
9297         /// Reading from this pointer when `result_ok` is set is undefined.
9298         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9299 }
9300 #[repr(C)]
9301 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9302 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9304 pub struct CResult_ChannelConfigDecodeErrorZ {
9305         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9306         /// `err` or `result` depending on the state of `result_ok`.
9307         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9308         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9309         pub result_ok: bool,
9310 }
9311 #[no_mangle]
9312 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9313 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9314         CResult_ChannelConfigDecodeErrorZ {
9315                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9316                         result: Box::into_raw(Box::new(o)),
9317                 },
9318                 result_ok: true,
9319         }
9320 }
9321 #[no_mangle]
9322 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9323 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9324         CResult_ChannelConfigDecodeErrorZ {
9325                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9326                         err: Box::into_raw(Box::new(e)),
9327                 },
9328                 result_ok: false,
9329         }
9330 }
9331 /// Checks if the given object is currently in the success state
9332 #[no_mangle]
9333 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9334         o.result_ok
9335 }
9336 #[no_mangle]
9337 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9338 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9339 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9340         fn drop(&mut self) {
9341                 if self.result_ok {
9342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9344                         }
9345                 } else {
9346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9348                         }
9349                 }
9350         }
9351 }
9352 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9353         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9354                 let contents = if o.result_ok {
9355                         let result = unsafe { o.contents.result };
9356                         unsafe { o.contents.result = core::ptr::null_mut() };
9357                         CResult_ChannelConfigDecodeErrorZPtr { result }
9358                 } else {
9359                         let err = unsafe { o.contents.err };
9360                         unsafe { o.contents.err = core::ptr::null_mut(); }
9361                         CResult_ChannelConfigDecodeErrorZPtr { err }
9362                 };
9363                 Self {
9364                         contents,
9365                         result_ok: o.result_ok,
9366                 }
9367         }
9368 }
9369 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9370         fn clone(&self) -> Self {
9371                 if self.result_ok {
9372                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9373                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9374                         } }
9375                 } else {
9376                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9377                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9378                         } }
9379                 }
9380         }
9381 }
9382 #[no_mangle]
9383 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9384 /// but with all dynamically-allocated buffers duplicated in new buffers.
9385 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9386 #[repr(C)]
9387 /// The contents of CResult_OutPointDecodeErrorZ
9388 pub union CResult_OutPointDecodeErrorZPtr {
9389         /// A pointer to the contents in the success state.
9390         /// Reading from this pointer when `result_ok` is not set is undefined.
9391         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9392         /// A pointer to the contents in the error state.
9393         /// Reading from this pointer when `result_ok` is set is undefined.
9394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9395 }
9396 #[repr(C)]
9397 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9398 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9400 pub struct CResult_OutPointDecodeErrorZ {
9401         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9402         /// `err` or `result` depending on the state of `result_ok`.
9403         pub contents: CResult_OutPointDecodeErrorZPtr,
9404         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9405         pub result_ok: bool,
9406 }
9407 #[no_mangle]
9408 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9409 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9410         CResult_OutPointDecodeErrorZ {
9411                 contents: CResult_OutPointDecodeErrorZPtr {
9412                         result: Box::into_raw(Box::new(o)),
9413                 },
9414                 result_ok: true,
9415         }
9416 }
9417 #[no_mangle]
9418 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9419 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9420         CResult_OutPointDecodeErrorZ {
9421                 contents: CResult_OutPointDecodeErrorZPtr {
9422                         err: Box::into_raw(Box::new(e)),
9423                 },
9424                 result_ok: false,
9425         }
9426 }
9427 /// Checks if the given object is currently in the success state
9428 #[no_mangle]
9429 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9430         o.result_ok
9431 }
9432 #[no_mangle]
9433 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9434 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9435 impl Drop for CResult_OutPointDecodeErrorZ {
9436         fn drop(&mut self) {
9437                 if self.result_ok {
9438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9440                         }
9441                 } else {
9442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9444                         }
9445                 }
9446         }
9447 }
9448 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9450                 let contents = if o.result_ok {
9451                         let result = unsafe { o.contents.result };
9452                         unsafe { o.contents.result = core::ptr::null_mut() };
9453                         CResult_OutPointDecodeErrorZPtr { result }
9454                 } else {
9455                         let err = unsafe { o.contents.err };
9456                         unsafe { o.contents.err = core::ptr::null_mut(); }
9457                         CResult_OutPointDecodeErrorZPtr { err }
9458                 };
9459                 Self {
9460                         contents,
9461                         result_ok: o.result_ok,
9462                 }
9463         }
9464 }
9465 impl Clone for CResult_OutPointDecodeErrorZ {
9466         fn clone(&self) -> Self {
9467                 if self.result_ok {
9468                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9469                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9470                         } }
9471                 } else {
9472                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9474                         } }
9475                 }
9476         }
9477 }
9478 #[no_mangle]
9479 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9480 /// but with all dynamically-allocated buffers duplicated in new buffers.
9481 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9482 #[repr(C)]
9483 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9484 pub enum COption_TypeZ {
9485         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9486         Some(crate::lightning::ln::wire::Type),
9487         /// When we're in this state, this COption_TypeZ contains nothing
9488         None
9489 }
9490 impl COption_TypeZ {
9491         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9492                 if let Self::None = self { false } else { true }
9493         }
9494         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9495                 !self.is_some()
9496         }
9497         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9498                 if let Self::Some(v) = self { v } else { unreachable!() }
9499         }
9500 }
9501 #[no_mangle]
9502 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9503 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9504         COption_TypeZ::Some(o)
9505 }
9506 #[no_mangle]
9507 /// Constructs a new COption_TypeZ containing nothing
9508 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9509         COption_TypeZ::None
9510 }
9511 #[no_mangle]
9512 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9513 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9514 #[repr(C)]
9515 /// The contents of CResult_COption_TypeZDecodeErrorZ
9516 pub union CResult_COption_TypeZDecodeErrorZPtr {
9517         /// A pointer to the contents in the success state.
9518         /// Reading from this pointer when `result_ok` is not set is undefined.
9519         pub result: *mut crate::c_types::derived::COption_TypeZ,
9520         /// A pointer to the contents in the error state.
9521         /// Reading from this pointer when `result_ok` is set is undefined.
9522         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9523 }
9524 #[repr(C)]
9525 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9526 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9528 pub struct CResult_COption_TypeZDecodeErrorZ {
9529         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9530         /// `err` or `result` depending on the state of `result_ok`.
9531         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9532         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9533         pub result_ok: bool,
9534 }
9535 #[no_mangle]
9536 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9537 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9538         CResult_COption_TypeZDecodeErrorZ {
9539                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9540                         result: Box::into_raw(Box::new(o)),
9541                 },
9542                 result_ok: true,
9543         }
9544 }
9545 #[no_mangle]
9546 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9547 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9548         CResult_COption_TypeZDecodeErrorZ {
9549                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9550                         err: Box::into_raw(Box::new(e)),
9551                 },
9552                 result_ok: false,
9553         }
9554 }
9555 /// Checks if the given object is currently in the success state
9556 #[no_mangle]
9557 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9558         o.result_ok
9559 }
9560 #[no_mangle]
9561 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9562 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9563 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9564         fn drop(&mut self) {
9565                 if self.result_ok {
9566                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9567                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9568                         }
9569                 } else {
9570                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9571                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9572                         }
9573                 }
9574         }
9575 }
9576 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9577         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9578                 let contents = if o.result_ok {
9579                         let result = unsafe { o.contents.result };
9580                         unsafe { o.contents.result = core::ptr::null_mut() };
9581                         CResult_COption_TypeZDecodeErrorZPtr { result }
9582                 } else {
9583                         let err = unsafe { o.contents.err };
9584                         unsafe { o.contents.err = core::ptr::null_mut(); }
9585                         CResult_COption_TypeZDecodeErrorZPtr { err }
9586                 };
9587                 Self {
9588                         contents,
9589                         result_ok: o.result_ok,
9590                 }
9591         }
9592 }
9593 #[repr(C)]
9594 /// The contents of CResult_PaymentIdPaymentErrorZ
9595 pub union CResult_PaymentIdPaymentErrorZPtr {
9596         /// A pointer to the contents in the success state.
9597         /// Reading from this pointer when `result_ok` is not set is undefined.
9598         pub result: *mut crate::c_types::ThirtyTwoBytes,
9599         /// A pointer to the contents in the error state.
9600         /// Reading from this pointer when `result_ok` is set is undefined.
9601         pub err: *mut crate::lightning_invoice::payment::PaymentError,
9602 }
9603 #[repr(C)]
9604 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9605 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9606 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9607 pub struct CResult_PaymentIdPaymentErrorZ {
9608         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9609         /// `err` or `result` depending on the state of `result_ok`.
9610         pub contents: CResult_PaymentIdPaymentErrorZPtr,
9611         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9612         pub result_ok: bool,
9613 }
9614 #[no_mangle]
9615 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9616 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9617         CResult_PaymentIdPaymentErrorZ {
9618                 contents: CResult_PaymentIdPaymentErrorZPtr {
9619                         result: Box::into_raw(Box::new(o)),
9620                 },
9621                 result_ok: true,
9622         }
9623 }
9624 #[no_mangle]
9625 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9626 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9627         CResult_PaymentIdPaymentErrorZ {
9628                 contents: CResult_PaymentIdPaymentErrorZPtr {
9629                         err: Box::into_raw(Box::new(e)),
9630                 },
9631                 result_ok: false,
9632         }
9633 }
9634 /// Checks if the given object is currently in the success state
9635 #[no_mangle]
9636 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9637         o.result_ok
9638 }
9639 #[no_mangle]
9640 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9641 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9642 impl Drop for CResult_PaymentIdPaymentErrorZ {
9643         fn drop(&mut self) {
9644                 if self.result_ok {
9645                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9646                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9647                         }
9648                 } else {
9649                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9650                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9651                         }
9652                 }
9653         }
9654 }
9655 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9656         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9657                 let contents = if o.result_ok {
9658                         let result = unsafe { o.contents.result };
9659                         unsafe { o.contents.result = core::ptr::null_mut() };
9660                         CResult_PaymentIdPaymentErrorZPtr { result }
9661                 } else {
9662                         let err = unsafe { o.contents.err };
9663                         unsafe { o.contents.err = core::ptr::null_mut(); }
9664                         CResult_PaymentIdPaymentErrorZPtr { err }
9665                 };
9666                 Self {
9667                         contents,
9668                         result_ok: o.result_ok,
9669                 }
9670         }
9671 }
9672 impl Clone for CResult_PaymentIdPaymentErrorZ {
9673         fn clone(&self) -> Self {
9674                 if self.result_ok {
9675                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9676                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9677                         } }
9678                 } else {
9679                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9680                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9681                         } }
9682                 }
9683         }
9684 }
9685 #[no_mangle]
9686 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9687 /// but with all dynamically-allocated buffers duplicated in new buffers.
9688 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9689 #[repr(C)]
9690 /// The contents of CResult_SiPrefixParseErrorZ
9691 pub union CResult_SiPrefixParseErrorZPtr {
9692         /// A pointer to the contents in the success state.
9693         /// Reading from this pointer when `result_ok` is not set is undefined.
9694         pub result: *mut crate::lightning_invoice::SiPrefix,
9695         /// A pointer to the contents in the error state.
9696         /// Reading from this pointer when `result_ok` is set is undefined.
9697         pub err: *mut crate::lightning_invoice::ParseError,
9698 }
9699 #[repr(C)]
9700 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9701 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9703 pub struct CResult_SiPrefixParseErrorZ {
9704         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9705         /// `err` or `result` depending on the state of `result_ok`.
9706         pub contents: CResult_SiPrefixParseErrorZPtr,
9707         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9708         pub result_ok: bool,
9709 }
9710 #[no_mangle]
9711 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9712 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9713         CResult_SiPrefixParseErrorZ {
9714                 contents: CResult_SiPrefixParseErrorZPtr {
9715                         result: Box::into_raw(Box::new(o)),
9716                 },
9717                 result_ok: true,
9718         }
9719 }
9720 #[no_mangle]
9721 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9722 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9723         CResult_SiPrefixParseErrorZ {
9724                 contents: CResult_SiPrefixParseErrorZPtr {
9725                         err: Box::into_raw(Box::new(e)),
9726                 },
9727                 result_ok: false,
9728         }
9729 }
9730 /// Checks if the given object is currently in the success state
9731 #[no_mangle]
9732 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9733         o.result_ok
9734 }
9735 #[no_mangle]
9736 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9737 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9738 impl Drop for CResult_SiPrefixParseErrorZ {
9739         fn drop(&mut self) {
9740                 if self.result_ok {
9741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9743                         }
9744                 } else {
9745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9747                         }
9748                 }
9749         }
9750 }
9751 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9753                 let contents = if o.result_ok {
9754                         let result = unsafe { o.contents.result };
9755                         unsafe { o.contents.result = core::ptr::null_mut() };
9756                         CResult_SiPrefixParseErrorZPtr { result }
9757                 } else {
9758                         let err = unsafe { o.contents.err };
9759                         unsafe { o.contents.err = core::ptr::null_mut(); }
9760                         CResult_SiPrefixParseErrorZPtr { err }
9761                 };
9762                 Self {
9763                         contents,
9764                         result_ok: o.result_ok,
9765                 }
9766         }
9767 }
9768 impl Clone for CResult_SiPrefixParseErrorZ {
9769         fn clone(&self) -> Self {
9770                 if self.result_ok {
9771                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9772                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9773                         } }
9774                 } else {
9775                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9776                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9777                         } }
9778                 }
9779         }
9780 }
9781 #[no_mangle]
9782 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9783 /// but with all dynamically-allocated buffers duplicated in new buffers.
9784 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9785 #[repr(C)]
9786 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9787 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9788         /// A pointer to the contents in the success state.
9789         /// Reading from this pointer when `result_ok` is not set is undefined.
9790         pub result: *mut crate::lightning_invoice::Invoice,
9791         /// A pointer to the contents in the error state.
9792         /// Reading from this pointer when `result_ok` is set is undefined.
9793         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9794 }
9795 #[repr(C)]
9796 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9797 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9799 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9800         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9801         /// `err` or `result` depending on the state of `result_ok`.
9802         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9803         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9804         pub result_ok: bool,
9805 }
9806 #[no_mangle]
9807 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9808 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9809         CResult_InvoiceParseOrSemanticErrorZ {
9810                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9811                         result: Box::into_raw(Box::new(o)),
9812                 },
9813                 result_ok: true,
9814         }
9815 }
9816 #[no_mangle]
9817 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9818 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9819         CResult_InvoiceParseOrSemanticErrorZ {
9820                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9821                         err: Box::into_raw(Box::new(e)),
9822                 },
9823                 result_ok: false,
9824         }
9825 }
9826 /// Checks if the given object is currently in the success state
9827 #[no_mangle]
9828 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9829         o.result_ok
9830 }
9831 #[no_mangle]
9832 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9833 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9834 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9835         fn drop(&mut self) {
9836                 if self.result_ok {
9837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9839                         }
9840                 } else {
9841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9843                         }
9844                 }
9845         }
9846 }
9847 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9849                 let contents = if o.result_ok {
9850                         let result = unsafe { o.contents.result };
9851                         unsafe { o.contents.result = core::ptr::null_mut() };
9852                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
9853                 } else {
9854                         let err = unsafe { o.contents.err };
9855                         unsafe { o.contents.err = core::ptr::null_mut(); }
9856                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
9857                 };
9858                 Self {
9859                         contents,
9860                         result_ok: o.result_ok,
9861                 }
9862         }
9863 }
9864 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
9865         fn clone(&self) -> Self {
9866                 if self.result_ok {
9867                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9868                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
9869                         } }
9870                 } else {
9871                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9872                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
9873                         } }
9874                 }
9875         }
9876 }
9877 #[no_mangle]
9878 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
9879 /// but with all dynamically-allocated buffers duplicated in new buffers.
9880 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
9881 #[repr(C)]
9882 /// The contents of CResult_SignedRawInvoiceParseErrorZ
9883 pub union CResult_SignedRawInvoiceParseErrorZPtr {
9884         /// A pointer to the contents in the success state.
9885         /// Reading from this pointer when `result_ok` is not set is undefined.
9886         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
9887         /// A pointer to the contents in the error state.
9888         /// Reading from this pointer when `result_ok` is set is undefined.
9889         pub err: *mut crate::lightning_invoice::ParseError,
9890 }
9891 #[repr(C)]
9892 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
9893 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
9894 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9895 pub struct CResult_SignedRawInvoiceParseErrorZ {
9896         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
9897         /// `err` or `result` depending on the state of `result_ok`.
9898         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
9899         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
9900         pub result_ok: bool,
9901 }
9902 #[no_mangle]
9903 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
9904 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
9905         CResult_SignedRawInvoiceParseErrorZ {
9906                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9907                         result: Box::into_raw(Box::new(o)),
9908                 },
9909                 result_ok: true,
9910         }
9911 }
9912 #[no_mangle]
9913 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
9914 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
9915         CResult_SignedRawInvoiceParseErrorZ {
9916                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
9917                         err: Box::into_raw(Box::new(e)),
9918                 },
9919                 result_ok: false,
9920         }
9921 }
9922 /// Checks if the given object is currently in the success state
9923 #[no_mangle]
9924 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
9925         o.result_ok
9926 }
9927 #[no_mangle]
9928 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
9929 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
9930 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
9931         fn drop(&mut self) {
9932                 if self.result_ok {
9933                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9934                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9935                         }
9936                 } else {
9937                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9938                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9939                         }
9940                 }
9941         }
9942 }
9943 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
9944         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
9945                 let contents = if o.result_ok {
9946                         let result = unsafe { o.contents.result };
9947                         unsafe { o.contents.result = core::ptr::null_mut() };
9948                         CResult_SignedRawInvoiceParseErrorZPtr { result }
9949                 } else {
9950                         let err = unsafe { o.contents.err };
9951                         unsafe { o.contents.err = core::ptr::null_mut(); }
9952                         CResult_SignedRawInvoiceParseErrorZPtr { err }
9953                 };
9954                 Self {
9955                         contents,
9956                         result_ok: o.result_ok,
9957                 }
9958         }
9959 }
9960 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
9961         fn clone(&self) -> Self {
9962                 if self.result_ok {
9963                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9964                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
9965                         } }
9966                 } else {
9967                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
9968                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9969                         } }
9970                 }
9971         }
9972 }
9973 #[no_mangle]
9974 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
9975 /// but with all dynamically-allocated buffers duplicated in new buffers.
9976 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
9977 #[repr(C)]
9978 /// A tuple of 3 elements. See the individual fields for the types contained.
9979 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9980         /// The element at position 0
9981         pub a: crate::lightning_invoice::RawInvoice,
9982         /// The element at position 1
9983         pub b: crate::c_types::ThirtyTwoBytes,
9984         /// The element at position 2
9985         pub c: crate::lightning_invoice::InvoiceSignature,
9986 }
9987 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9988         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
9989                 Self {
9990                         a: tup.0,
9991                         b: tup.1,
9992                         c: tup.2,
9993                 }
9994         }
9995 }
9996 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
9997         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
9998                 (self.a, self.b, self.c)
9999         }
10000 }
10001 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10002         fn clone(&self) -> Self {
10003                 Self {
10004                         a: Clone::clone(&self.a),
10005                         b: Clone::clone(&self.b),
10006                         c: Clone::clone(&self.c),
10007                 }
10008         }
10009 }
10010 #[no_mangle]
10011 /// Creates a new tuple which has the same data as `orig`
10012 /// but with all dynamically-allocated buffers duplicated in new buffers.
10013 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10014 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10015 #[no_mangle]
10016 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 {
10017         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10018 }
10019
10020 #[no_mangle]
10021 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10022 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10023 #[repr(C)]
10024 /// The contents of CResult_PayeePubKeyErrorZ
10025 pub union CResult_PayeePubKeyErrorZPtr {
10026         /// A pointer to the contents in the success state.
10027         /// Reading from this pointer when `result_ok` is not set is undefined.
10028         pub result: *mut crate::lightning_invoice::PayeePubKey,
10029         /// A pointer to the contents in the error state.
10030         /// Reading from this pointer when `result_ok` is set is undefined.
10031         pub err: *mut crate::c_types::Secp256k1Error,
10032 }
10033 #[repr(C)]
10034 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10035 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10036 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10037 pub struct CResult_PayeePubKeyErrorZ {
10038         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10039         /// `err` or `result` depending on the state of `result_ok`.
10040         pub contents: CResult_PayeePubKeyErrorZPtr,
10041         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10042         pub result_ok: bool,
10043 }
10044 #[no_mangle]
10045 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10046 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10047         CResult_PayeePubKeyErrorZ {
10048                 contents: CResult_PayeePubKeyErrorZPtr {
10049                         result: Box::into_raw(Box::new(o)),
10050                 },
10051                 result_ok: true,
10052         }
10053 }
10054 #[no_mangle]
10055 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10056 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10057         CResult_PayeePubKeyErrorZ {
10058                 contents: CResult_PayeePubKeyErrorZPtr {
10059                         err: Box::into_raw(Box::new(e)),
10060                 },
10061                 result_ok: false,
10062         }
10063 }
10064 /// Checks if the given object is currently in the success state
10065 #[no_mangle]
10066 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10067         o.result_ok
10068 }
10069 #[no_mangle]
10070 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10071 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10072 impl Drop for CResult_PayeePubKeyErrorZ {
10073         fn drop(&mut self) {
10074                 if self.result_ok {
10075                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10076                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10077                         }
10078                 } else {
10079                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10080                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10081                         }
10082                 }
10083         }
10084 }
10085 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10086         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10087                 let contents = if o.result_ok {
10088                         let result = unsafe { o.contents.result };
10089                         unsafe { o.contents.result = core::ptr::null_mut() };
10090                         CResult_PayeePubKeyErrorZPtr { result }
10091                 } else {
10092                         let err = unsafe { o.contents.err };
10093                         unsafe { o.contents.err = core::ptr::null_mut(); }
10094                         CResult_PayeePubKeyErrorZPtr { err }
10095                 };
10096                 Self {
10097                         contents,
10098                         result_ok: o.result_ok,
10099                 }
10100         }
10101 }
10102 impl Clone for CResult_PayeePubKeyErrorZ {
10103         fn clone(&self) -> Self {
10104                 if self.result_ok {
10105                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10106                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10107                         } }
10108                 } else {
10109                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10110                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10111                         } }
10112                 }
10113         }
10114 }
10115 #[no_mangle]
10116 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10117 /// but with all dynamically-allocated buffers duplicated in new buffers.
10118 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10119 #[repr(C)]
10120 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10121 /// This corresponds to std::vector in C++
10122 pub struct CVec_PrivateRouteZ {
10123         /// The elements in the array.
10124         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10125         pub data: *mut crate::lightning_invoice::PrivateRoute,
10126         /// The number of elements pointed to by `data`.
10127         pub datalen: usize
10128 }
10129 impl CVec_PrivateRouteZ {
10130         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10131                 if self.datalen == 0 { return Vec::new(); }
10132                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10133                 self.data = core::ptr::null_mut();
10134                 self.datalen = 0;
10135                 ret
10136         }
10137         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10138                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10139         }
10140 }
10141 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10142         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10143                 let datalen = v.len();
10144                 let data = Box::into_raw(v.into_boxed_slice());
10145                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10146         }
10147 }
10148 #[no_mangle]
10149 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10150 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10151 impl Drop for CVec_PrivateRouteZ {
10152         fn drop(&mut self) {
10153                 if self.datalen == 0 { return; }
10154                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10155         }
10156 }
10157 impl Clone for CVec_PrivateRouteZ {
10158         fn clone(&self) -> Self {
10159                 let mut res = Vec::new();
10160                 if self.datalen == 0 { return Self::from(res); }
10161                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10162                 Self::from(res)
10163         }
10164 }
10165 #[repr(C)]
10166 /// The contents of CResult_PositiveTimestampCreationErrorZ
10167 pub union CResult_PositiveTimestampCreationErrorZPtr {
10168         /// A pointer to the contents in the success state.
10169         /// Reading from this pointer when `result_ok` is not set is undefined.
10170         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10171         /// A pointer to the contents in the error state.
10172         /// Reading from this pointer when `result_ok` is set is undefined.
10173         pub err: *mut crate::lightning_invoice::CreationError,
10174 }
10175 #[repr(C)]
10176 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10177 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10178 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10179 pub struct CResult_PositiveTimestampCreationErrorZ {
10180         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10181         /// `err` or `result` depending on the state of `result_ok`.
10182         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10183         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10184         pub result_ok: bool,
10185 }
10186 #[no_mangle]
10187 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10188 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10189         CResult_PositiveTimestampCreationErrorZ {
10190                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10191                         result: Box::into_raw(Box::new(o)),
10192                 },
10193                 result_ok: true,
10194         }
10195 }
10196 #[no_mangle]
10197 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10198 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10199         CResult_PositiveTimestampCreationErrorZ {
10200                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10201                         err: Box::into_raw(Box::new(e)),
10202                 },
10203                 result_ok: false,
10204         }
10205 }
10206 /// Checks if the given object is currently in the success state
10207 #[no_mangle]
10208 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10209         o.result_ok
10210 }
10211 #[no_mangle]
10212 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10213 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10214 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10215         fn drop(&mut self) {
10216                 if self.result_ok {
10217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10219                         }
10220                 } else {
10221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10223                         }
10224                 }
10225         }
10226 }
10227 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10228         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10229                 let contents = if o.result_ok {
10230                         let result = unsafe { o.contents.result };
10231                         unsafe { o.contents.result = core::ptr::null_mut() };
10232                         CResult_PositiveTimestampCreationErrorZPtr { result }
10233                 } else {
10234                         let err = unsafe { o.contents.err };
10235                         unsafe { o.contents.err = core::ptr::null_mut(); }
10236                         CResult_PositiveTimestampCreationErrorZPtr { err }
10237                 };
10238                 Self {
10239                         contents,
10240                         result_ok: o.result_ok,
10241                 }
10242         }
10243 }
10244 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10245         fn clone(&self) -> Self {
10246                 if self.result_ok {
10247                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10248                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10249                         } }
10250                 } else {
10251                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10252                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10253                         } }
10254                 }
10255         }
10256 }
10257 #[no_mangle]
10258 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10259 /// but with all dynamically-allocated buffers duplicated in new buffers.
10260 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10261 #[repr(C)]
10262 /// The contents of CResult_NoneSemanticErrorZ
10263 pub union CResult_NoneSemanticErrorZPtr {
10264         /// Note that this value is always NULL, as there are no contents in the OK variant
10265         pub result: *mut core::ffi::c_void,
10266         /// A pointer to the contents in the error state.
10267         /// Reading from this pointer when `result_ok` is set is undefined.
10268         pub err: *mut crate::lightning_invoice::SemanticError,
10269 }
10270 #[repr(C)]
10271 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10272 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10273 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10274 pub struct CResult_NoneSemanticErrorZ {
10275         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10276         /// `err` or `result` depending on the state of `result_ok`.
10277         pub contents: CResult_NoneSemanticErrorZPtr,
10278         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10279         pub result_ok: bool,
10280 }
10281 #[no_mangle]
10282 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10283 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10284         CResult_NoneSemanticErrorZ {
10285                 contents: CResult_NoneSemanticErrorZPtr {
10286                         result: core::ptr::null_mut(),
10287                 },
10288                 result_ok: true,
10289         }
10290 }
10291 #[no_mangle]
10292 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10293 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10294         CResult_NoneSemanticErrorZ {
10295                 contents: CResult_NoneSemanticErrorZPtr {
10296                         err: Box::into_raw(Box::new(e)),
10297                 },
10298                 result_ok: false,
10299         }
10300 }
10301 /// Checks if the given object is currently in the success state
10302 #[no_mangle]
10303 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10304         o.result_ok
10305 }
10306 #[no_mangle]
10307 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10308 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10309 impl Drop for CResult_NoneSemanticErrorZ {
10310         fn drop(&mut self) {
10311                 if self.result_ok {
10312                 } else {
10313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10315                         }
10316                 }
10317         }
10318 }
10319 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10320         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10321                 let contents = if o.result_ok {
10322                         let _ = unsafe { Box::from_raw(o.contents.result) };
10323                         o.contents.result = core::ptr::null_mut();
10324                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10325                 } else {
10326                         let err = unsafe { o.contents.err };
10327                         unsafe { o.contents.err = core::ptr::null_mut(); }
10328                         CResult_NoneSemanticErrorZPtr { err }
10329                 };
10330                 Self {
10331                         contents,
10332                         result_ok: o.result_ok,
10333                 }
10334         }
10335 }
10336 impl Clone for CResult_NoneSemanticErrorZ {
10337         fn clone(&self) -> Self {
10338                 if self.result_ok {
10339                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10340                                 result: core::ptr::null_mut()
10341                         } }
10342                 } else {
10343                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10344                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10345                         } }
10346                 }
10347         }
10348 }
10349 #[no_mangle]
10350 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10351 /// but with all dynamically-allocated buffers duplicated in new buffers.
10352 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10353 #[repr(C)]
10354 /// The contents of CResult_InvoiceSemanticErrorZ
10355 pub union CResult_InvoiceSemanticErrorZPtr {
10356         /// A pointer to the contents in the success state.
10357         /// Reading from this pointer when `result_ok` is not set is undefined.
10358         pub result: *mut crate::lightning_invoice::Invoice,
10359         /// A pointer to the contents in the error state.
10360         /// Reading from this pointer when `result_ok` is set is undefined.
10361         pub err: *mut crate::lightning_invoice::SemanticError,
10362 }
10363 #[repr(C)]
10364 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10365 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10367 pub struct CResult_InvoiceSemanticErrorZ {
10368         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10369         /// `err` or `result` depending on the state of `result_ok`.
10370         pub contents: CResult_InvoiceSemanticErrorZPtr,
10371         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10372         pub result_ok: bool,
10373 }
10374 #[no_mangle]
10375 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10376 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10377         CResult_InvoiceSemanticErrorZ {
10378                 contents: CResult_InvoiceSemanticErrorZPtr {
10379                         result: Box::into_raw(Box::new(o)),
10380                 },
10381                 result_ok: true,
10382         }
10383 }
10384 #[no_mangle]
10385 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10386 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10387         CResult_InvoiceSemanticErrorZ {
10388                 contents: CResult_InvoiceSemanticErrorZPtr {
10389                         err: Box::into_raw(Box::new(e)),
10390                 },
10391                 result_ok: false,
10392         }
10393 }
10394 /// Checks if the given object is currently in the success state
10395 #[no_mangle]
10396 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10397         o.result_ok
10398 }
10399 #[no_mangle]
10400 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10401 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10402 impl Drop for CResult_InvoiceSemanticErrorZ {
10403         fn drop(&mut self) {
10404                 if self.result_ok {
10405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10407                         }
10408                 } else {
10409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10411                         }
10412                 }
10413         }
10414 }
10415 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10417                 let contents = if o.result_ok {
10418                         let result = unsafe { o.contents.result };
10419                         unsafe { o.contents.result = core::ptr::null_mut() };
10420                         CResult_InvoiceSemanticErrorZPtr { result }
10421                 } else {
10422                         let err = unsafe { o.contents.err };
10423                         unsafe { o.contents.err = core::ptr::null_mut(); }
10424                         CResult_InvoiceSemanticErrorZPtr { err }
10425                 };
10426                 Self {
10427                         contents,
10428                         result_ok: o.result_ok,
10429                 }
10430         }
10431 }
10432 impl Clone for CResult_InvoiceSemanticErrorZ {
10433         fn clone(&self) -> Self {
10434                 if self.result_ok {
10435                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10436                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10437                         } }
10438                 } else {
10439                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10440                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10441                         } }
10442                 }
10443         }
10444 }
10445 #[no_mangle]
10446 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10447 /// but with all dynamically-allocated buffers duplicated in new buffers.
10448 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10449 #[repr(C)]
10450 /// The contents of CResult_DescriptionCreationErrorZ
10451 pub union CResult_DescriptionCreationErrorZPtr {
10452         /// A pointer to the contents in the success state.
10453         /// Reading from this pointer when `result_ok` is not set is undefined.
10454         pub result: *mut crate::lightning_invoice::Description,
10455         /// A pointer to the contents in the error state.
10456         /// Reading from this pointer when `result_ok` is set is undefined.
10457         pub err: *mut crate::lightning_invoice::CreationError,
10458 }
10459 #[repr(C)]
10460 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10461 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10463 pub struct CResult_DescriptionCreationErrorZ {
10464         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10465         /// `err` or `result` depending on the state of `result_ok`.
10466         pub contents: CResult_DescriptionCreationErrorZPtr,
10467         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10468         pub result_ok: bool,
10469 }
10470 #[no_mangle]
10471 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10472 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10473         CResult_DescriptionCreationErrorZ {
10474                 contents: CResult_DescriptionCreationErrorZPtr {
10475                         result: Box::into_raw(Box::new(o)),
10476                 },
10477                 result_ok: true,
10478         }
10479 }
10480 #[no_mangle]
10481 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10482 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10483         CResult_DescriptionCreationErrorZ {
10484                 contents: CResult_DescriptionCreationErrorZPtr {
10485                         err: Box::into_raw(Box::new(e)),
10486                 },
10487                 result_ok: false,
10488         }
10489 }
10490 /// Checks if the given object is currently in the success state
10491 #[no_mangle]
10492 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10493         o.result_ok
10494 }
10495 #[no_mangle]
10496 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10497 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10498 impl Drop for CResult_DescriptionCreationErrorZ {
10499         fn drop(&mut self) {
10500                 if self.result_ok {
10501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10503                         }
10504                 } else {
10505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10507                         }
10508                 }
10509         }
10510 }
10511 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10513                 let contents = if o.result_ok {
10514                         let result = unsafe { o.contents.result };
10515                         unsafe { o.contents.result = core::ptr::null_mut() };
10516                         CResult_DescriptionCreationErrorZPtr { result }
10517                 } else {
10518                         let err = unsafe { o.contents.err };
10519                         unsafe { o.contents.err = core::ptr::null_mut(); }
10520                         CResult_DescriptionCreationErrorZPtr { err }
10521                 };
10522                 Self {
10523                         contents,
10524                         result_ok: o.result_ok,
10525                 }
10526         }
10527 }
10528 impl Clone for CResult_DescriptionCreationErrorZ {
10529         fn clone(&self) -> Self {
10530                 if self.result_ok {
10531                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10532                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10533                         } }
10534                 } else {
10535                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10536                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10537                         } }
10538                 }
10539         }
10540 }
10541 #[no_mangle]
10542 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10543 /// but with all dynamically-allocated buffers duplicated in new buffers.
10544 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10545 #[repr(C)]
10546 /// The contents of CResult_PrivateRouteCreationErrorZ
10547 pub union CResult_PrivateRouteCreationErrorZPtr {
10548         /// A pointer to the contents in the success state.
10549         /// Reading from this pointer when `result_ok` is not set is undefined.
10550         pub result: *mut crate::lightning_invoice::PrivateRoute,
10551         /// A pointer to the contents in the error state.
10552         /// Reading from this pointer when `result_ok` is set is undefined.
10553         pub err: *mut crate::lightning_invoice::CreationError,
10554 }
10555 #[repr(C)]
10556 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10557 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10559 pub struct CResult_PrivateRouteCreationErrorZ {
10560         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10561         /// `err` or `result` depending on the state of `result_ok`.
10562         pub contents: CResult_PrivateRouteCreationErrorZPtr,
10563         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10564         pub result_ok: bool,
10565 }
10566 #[no_mangle]
10567 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10568 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10569         CResult_PrivateRouteCreationErrorZ {
10570                 contents: CResult_PrivateRouteCreationErrorZPtr {
10571                         result: Box::into_raw(Box::new(o)),
10572                 },
10573                 result_ok: true,
10574         }
10575 }
10576 #[no_mangle]
10577 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10578 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10579         CResult_PrivateRouteCreationErrorZ {
10580                 contents: CResult_PrivateRouteCreationErrorZPtr {
10581                         err: Box::into_raw(Box::new(e)),
10582                 },
10583                 result_ok: false,
10584         }
10585 }
10586 /// Checks if the given object is currently in the success state
10587 #[no_mangle]
10588 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10589         o.result_ok
10590 }
10591 #[no_mangle]
10592 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10593 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10594 impl Drop for CResult_PrivateRouteCreationErrorZ {
10595         fn drop(&mut self) {
10596                 if self.result_ok {
10597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10599                         }
10600                 } else {
10601                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10602                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10603                         }
10604                 }
10605         }
10606 }
10607 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10608         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10609                 let contents = if o.result_ok {
10610                         let result = unsafe { o.contents.result };
10611                         unsafe { o.contents.result = core::ptr::null_mut() };
10612                         CResult_PrivateRouteCreationErrorZPtr { result }
10613                 } else {
10614                         let err = unsafe { o.contents.err };
10615                         unsafe { o.contents.err = core::ptr::null_mut(); }
10616                         CResult_PrivateRouteCreationErrorZPtr { err }
10617                 };
10618                 Self {
10619                         contents,
10620                         result_ok: o.result_ok,
10621                 }
10622         }
10623 }
10624 impl Clone for CResult_PrivateRouteCreationErrorZ {
10625         fn clone(&self) -> Self {
10626                 if self.result_ok {
10627                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10628                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10629                         } }
10630                 } else {
10631                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10632                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10633                         } }
10634                 }
10635         }
10636 }
10637 #[no_mangle]
10638 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10639 /// but with all dynamically-allocated buffers duplicated in new buffers.
10640 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10641 #[repr(C)]
10642 /// The contents of CResult_StringErrorZ
10643 pub union CResult_StringErrorZPtr {
10644         /// A pointer to the contents in the success state.
10645         /// Reading from this pointer when `result_ok` is not set is undefined.
10646         pub result: *mut crate::c_types::Str,
10647         /// A pointer to the contents in the error state.
10648         /// Reading from this pointer when `result_ok` is set is undefined.
10649         pub err: *mut crate::c_types::Secp256k1Error,
10650 }
10651 #[repr(C)]
10652 /// A CResult_StringErrorZ represents the result of a fallible operation,
10653 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10655 pub struct CResult_StringErrorZ {
10656         /// The contents of this CResult_StringErrorZ, accessible via either
10657         /// `err` or `result` depending on the state of `result_ok`.
10658         pub contents: CResult_StringErrorZPtr,
10659         /// Whether this CResult_StringErrorZ represents a success state.
10660         pub result_ok: bool,
10661 }
10662 #[no_mangle]
10663 /// Creates a new CResult_StringErrorZ in the success state.
10664 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10665         CResult_StringErrorZ {
10666                 contents: CResult_StringErrorZPtr {
10667                         result: Box::into_raw(Box::new(o)),
10668                 },
10669                 result_ok: true,
10670         }
10671 }
10672 #[no_mangle]
10673 /// Creates a new CResult_StringErrorZ in the error state.
10674 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10675         CResult_StringErrorZ {
10676                 contents: CResult_StringErrorZPtr {
10677                         err: Box::into_raw(Box::new(e)),
10678                 },
10679                 result_ok: false,
10680         }
10681 }
10682 /// Checks if the given object is currently in the success state
10683 #[no_mangle]
10684 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10685         o.result_ok
10686 }
10687 #[no_mangle]
10688 /// Frees any resources used by the CResult_StringErrorZ.
10689 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10690 impl Drop for CResult_StringErrorZ {
10691         fn drop(&mut self) {
10692                 if self.result_ok {
10693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10695                         }
10696                 } else {
10697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10699                         }
10700                 }
10701         }
10702 }
10703 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10704         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10705                 let contents = if o.result_ok {
10706                         let result = unsafe { o.contents.result };
10707                         unsafe { o.contents.result = core::ptr::null_mut() };
10708                         CResult_StringErrorZPtr { result }
10709                 } else {
10710                         let err = unsafe { o.contents.err };
10711                         unsafe { o.contents.err = core::ptr::null_mut(); }
10712                         CResult_StringErrorZPtr { err }
10713                 };
10714                 Self {
10715                         contents,
10716                         result_ok: o.result_ok,
10717                 }
10718         }
10719 }
10720 impl Clone for CResult_StringErrorZ {
10721         fn clone(&self) -> Self {
10722                 if self.result_ok {
10723                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10724                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10725                         } }
10726                 } else {
10727                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10728                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10729                         } }
10730                 }
10731         }
10732 }
10733 #[no_mangle]
10734 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10735 /// but with all dynamically-allocated buffers duplicated in new buffers.
10736 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10737 #[repr(C)]
10738 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10739 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10740         /// A pointer to the contents in the success state.
10741         /// Reading from this pointer when `result_ok` is not set is undefined.
10742         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10743         /// A pointer to the contents in the error state.
10744         /// Reading from this pointer when `result_ok` is set is undefined.
10745         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10746 }
10747 #[repr(C)]
10748 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10749 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10751 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10752         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10753         /// `err` or `result` depending on the state of `result_ok`.
10754         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10755         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10756         pub result_ok: bool,
10757 }
10758 #[no_mangle]
10759 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10760 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10761         CResult_ChannelMonitorUpdateDecodeErrorZ {
10762                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10763                         result: Box::into_raw(Box::new(o)),
10764                 },
10765                 result_ok: true,
10766         }
10767 }
10768 #[no_mangle]
10769 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10770 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10771         CResult_ChannelMonitorUpdateDecodeErrorZ {
10772                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10773                         err: Box::into_raw(Box::new(e)),
10774                 },
10775                 result_ok: false,
10776         }
10777 }
10778 /// Checks if the given object is currently in the success state
10779 #[no_mangle]
10780 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10781         o.result_ok
10782 }
10783 #[no_mangle]
10784 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10785 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10786 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10787         fn drop(&mut self) {
10788                 if self.result_ok {
10789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10791                         }
10792                 } else {
10793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10795                         }
10796                 }
10797         }
10798 }
10799 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10800         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10801                 let contents = if o.result_ok {
10802                         let result = unsafe { o.contents.result };
10803                         unsafe { o.contents.result = core::ptr::null_mut() };
10804                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10805                 } else {
10806                         let err = unsafe { o.contents.err };
10807                         unsafe { o.contents.err = core::ptr::null_mut(); }
10808                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10809                 };
10810                 Self {
10811                         contents,
10812                         result_ok: o.result_ok,
10813                 }
10814         }
10815 }
10816 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10817         fn clone(&self) -> Self {
10818                 if self.result_ok {
10819                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10820                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10821                         } }
10822                 } else {
10823                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10825                         } }
10826                 }
10827         }
10828 }
10829 #[no_mangle]
10830 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10831 /// but with all dynamically-allocated buffers duplicated in new buffers.
10832 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10833 #[repr(C)]
10834 #[derive(Clone)]
10835 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10836 pub enum COption_MonitorEventZ {
10837         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10838         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10839         /// When we're in this state, this COption_MonitorEventZ contains nothing
10840         None
10841 }
10842 impl COption_MonitorEventZ {
10843         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10844                 if let Self::None = self { false } else { true }
10845         }
10846         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10847                 !self.is_some()
10848         }
10849         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10850                 if let Self::Some(v) = self { v } else { unreachable!() }
10851         }
10852 }
10853 #[no_mangle]
10854 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10855 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10856         COption_MonitorEventZ::Some(o)
10857 }
10858 #[no_mangle]
10859 /// Constructs a new COption_MonitorEventZ containing nothing
10860 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10861         COption_MonitorEventZ::None
10862 }
10863 #[no_mangle]
10864 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
10865 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
10866 #[no_mangle]
10867 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
10868 /// but with all dynamically-allocated buffers duplicated in new buffers.
10869 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
10870 #[repr(C)]
10871 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
10872 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
10873         /// A pointer to the contents in the success state.
10874         /// Reading from this pointer when `result_ok` is not set is undefined.
10875         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
10876         /// A pointer to the contents in the error state.
10877         /// Reading from this pointer when `result_ok` is set is undefined.
10878         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10879 }
10880 #[repr(C)]
10881 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
10882 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10883 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10884 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
10885         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
10886         /// `err` or `result` depending on the state of `result_ok`.
10887         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
10888         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
10889         pub result_ok: bool,
10890 }
10891 #[no_mangle]
10892 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
10893 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
10894         CResult_COption_MonitorEventZDecodeErrorZ {
10895                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10896                         result: Box::into_raw(Box::new(o)),
10897                 },
10898                 result_ok: true,
10899         }
10900 }
10901 #[no_mangle]
10902 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
10903 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
10904         CResult_COption_MonitorEventZDecodeErrorZ {
10905                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10906                         err: Box::into_raw(Box::new(e)),
10907                 },
10908                 result_ok: false,
10909         }
10910 }
10911 /// Checks if the given object is currently in the success state
10912 #[no_mangle]
10913 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
10914         o.result_ok
10915 }
10916 #[no_mangle]
10917 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
10918 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
10919 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
10920         fn drop(&mut self) {
10921                 if self.result_ok {
10922                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10923                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10924                         }
10925                 } else {
10926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10928                         }
10929                 }
10930         }
10931 }
10932 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
10933         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10934                 let contents = if o.result_ok {
10935                         let result = unsafe { o.contents.result };
10936                         unsafe { o.contents.result = core::ptr::null_mut() };
10937                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
10938                 } else {
10939                         let err = unsafe { o.contents.err };
10940                         unsafe { o.contents.err = core::ptr::null_mut(); }
10941                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
10942                 };
10943                 Self {
10944                         contents,
10945                         result_ok: o.result_ok,
10946                 }
10947         }
10948 }
10949 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
10950         fn clone(&self) -> Self {
10951                 if self.result_ok {
10952                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10953                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
10954                         } }
10955                 } else {
10956                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
10957                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10958                         } }
10959                 }
10960         }
10961 }
10962 #[no_mangle]
10963 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
10964 /// but with all dynamically-allocated buffers duplicated in new buffers.
10965 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
10966 #[repr(C)]
10967 /// The contents of CResult_HTLCUpdateDecodeErrorZ
10968 pub union CResult_HTLCUpdateDecodeErrorZPtr {
10969         /// A pointer to the contents in the success state.
10970         /// Reading from this pointer when `result_ok` is not set is undefined.
10971         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
10972         /// A pointer to the contents in the error state.
10973         /// Reading from this pointer when `result_ok` is set is undefined.
10974         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10975 }
10976 #[repr(C)]
10977 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
10978 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10980 pub struct CResult_HTLCUpdateDecodeErrorZ {
10981         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
10982         /// `err` or `result` depending on the state of `result_ok`.
10983         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
10984         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
10985         pub result_ok: bool,
10986 }
10987 #[no_mangle]
10988 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10989 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
10990         CResult_HTLCUpdateDecodeErrorZ {
10991                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
10992                         result: Box::into_raw(Box::new(o)),
10993                 },
10994                 result_ok: true,
10995         }
10996 }
10997 #[no_mangle]
10998 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10999 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11000         CResult_HTLCUpdateDecodeErrorZ {
11001                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11002                         err: Box::into_raw(Box::new(e)),
11003                 },
11004                 result_ok: false,
11005         }
11006 }
11007 /// Checks if the given object is currently in the success state
11008 #[no_mangle]
11009 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11010         o.result_ok
11011 }
11012 #[no_mangle]
11013 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11014 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11015 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11016         fn drop(&mut self) {
11017                 if self.result_ok {
11018                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11019                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11020                         }
11021                 } else {
11022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11024                         }
11025                 }
11026         }
11027 }
11028 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11029         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11030                 let contents = if o.result_ok {
11031                         let result = unsafe { o.contents.result };
11032                         unsafe { o.contents.result = core::ptr::null_mut() };
11033                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11034                 } else {
11035                         let err = unsafe { o.contents.err };
11036                         unsafe { o.contents.err = core::ptr::null_mut(); }
11037                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11038                 };
11039                 Self {
11040                         contents,
11041                         result_ok: o.result_ok,
11042                 }
11043         }
11044 }
11045 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11046         fn clone(&self) -> Self {
11047                 if self.result_ok {
11048                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11049                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11050                         } }
11051                 } else {
11052                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11053                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11054                         } }
11055                 }
11056         }
11057 }
11058 #[no_mangle]
11059 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11060 /// but with all dynamically-allocated buffers duplicated in new buffers.
11061 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11062 #[repr(C)]
11063 /// A tuple of 2 elements. See the individual fields for the types contained.
11064 pub struct C2Tuple_OutPointScriptZ {
11065         /// The element at position 0
11066         pub a: crate::lightning::chain::transaction::OutPoint,
11067         /// The element at position 1
11068         pub b: crate::c_types::derived::CVec_u8Z,
11069 }
11070 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11071         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11072                 Self {
11073                         a: tup.0,
11074                         b: tup.1,
11075                 }
11076         }
11077 }
11078 impl C2Tuple_OutPointScriptZ {
11079         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11080                 (self.a, self.b)
11081         }
11082 }
11083 impl Clone for C2Tuple_OutPointScriptZ {
11084         fn clone(&self) -> Self {
11085                 Self {
11086                         a: Clone::clone(&self.a),
11087                         b: Clone::clone(&self.b),
11088                 }
11089         }
11090 }
11091 #[no_mangle]
11092 /// Creates a new tuple which has the same data as `orig`
11093 /// but with all dynamically-allocated buffers duplicated in new buffers.
11094 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11095 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11096 #[no_mangle]
11097 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11098         C2Tuple_OutPointScriptZ { a, b, }
11099 }
11100
11101 #[no_mangle]
11102 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11103 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11104 #[repr(C)]
11105 /// A tuple of 2 elements. See the individual fields for the types contained.
11106 pub struct C2Tuple_u32ScriptZ {
11107         /// The element at position 0
11108         pub a: u32,
11109         /// The element at position 1
11110         pub b: crate::c_types::derived::CVec_u8Z,
11111 }
11112 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11113         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11114                 Self {
11115                         a: tup.0,
11116                         b: tup.1,
11117                 }
11118         }
11119 }
11120 impl C2Tuple_u32ScriptZ {
11121         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11122                 (self.a, self.b)
11123         }
11124 }
11125 impl Clone for C2Tuple_u32ScriptZ {
11126         fn clone(&self) -> Self {
11127                 Self {
11128                         a: Clone::clone(&self.a),
11129                         b: Clone::clone(&self.b),
11130                 }
11131         }
11132 }
11133 #[no_mangle]
11134 /// Creates a new tuple which has the same data as `orig`
11135 /// but with all dynamically-allocated buffers duplicated in new buffers.
11136 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11137 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11138 #[no_mangle]
11139 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11140         C2Tuple_u32ScriptZ { a, b, }
11141 }
11142
11143 #[no_mangle]
11144 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11145 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11146 #[repr(C)]
11147 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11148 /// This corresponds to std::vector in C++
11149 pub struct CVec_C2Tuple_u32ScriptZZ {
11150         /// The elements in the array.
11151         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11152         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11153         /// The number of elements pointed to by `data`.
11154         pub datalen: usize
11155 }
11156 impl CVec_C2Tuple_u32ScriptZZ {
11157         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11158                 if self.datalen == 0 { return Vec::new(); }
11159                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11160                 self.data = core::ptr::null_mut();
11161                 self.datalen = 0;
11162                 ret
11163         }
11164         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11165                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11166         }
11167 }
11168 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11169         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11170                 let datalen = v.len();
11171                 let data = Box::into_raw(v.into_boxed_slice());
11172                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11173         }
11174 }
11175 #[no_mangle]
11176 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11177 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11178 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11179         fn drop(&mut self) {
11180                 if self.datalen == 0 { return; }
11181                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11182         }
11183 }
11184 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11185         fn clone(&self) -> Self {
11186                 let mut res = Vec::new();
11187                 if self.datalen == 0 { return Self::from(res); }
11188                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11189                 Self::from(res)
11190         }
11191 }
11192 #[repr(C)]
11193 /// A tuple of 2 elements. See the individual fields for the types contained.
11194 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11195         /// The element at position 0
11196         pub a: crate::c_types::ThirtyTwoBytes,
11197         /// The element at position 1
11198         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11199 }
11200 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11201         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11202                 Self {
11203                         a: tup.0,
11204                         b: tup.1,
11205                 }
11206         }
11207 }
11208 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11209         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11210                 (self.a, self.b)
11211         }
11212 }
11213 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11214         fn clone(&self) -> Self {
11215                 Self {
11216                         a: Clone::clone(&self.a),
11217                         b: Clone::clone(&self.b),
11218                 }
11219         }
11220 }
11221 #[no_mangle]
11222 /// Creates a new tuple which has the same data as `orig`
11223 /// but with all dynamically-allocated buffers duplicated in new buffers.
11224 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11225 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11226 #[no_mangle]
11227 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 {
11228         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11229 }
11230
11231 #[no_mangle]
11232 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11233 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11234 #[repr(C)]
11235 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11236 /// This corresponds to std::vector in C++
11237 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11238         /// The elements in the array.
11239         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11240         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11241         /// The number of elements pointed to by `data`.
11242         pub datalen: usize
11243 }
11244 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11245         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11246                 if self.datalen == 0 { return Vec::new(); }
11247                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11248                 self.data = core::ptr::null_mut();
11249                 self.datalen = 0;
11250                 ret
11251         }
11252         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11253                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11254         }
11255 }
11256 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11257         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11258                 let datalen = v.len();
11259                 let data = Box::into_raw(v.into_boxed_slice());
11260                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11261         }
11262 }
11263 #[no_mangle]
11264 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11265 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11266 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11267         fn drop(&mut self) {
11268                 if self.datalen == 0 { return; }
11269                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11270         }
11271 }
11272 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11273         fn clone(&self) -> Self {
11274                 let mut res = Vec::new();
11275                 if self.datalen == 0 { return Self::from(res); }
11276                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11277                 Self::from(res)
11278         }
11279 }
11280 #[repr(C)]
11281 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11282 /// This corresponds to std::vector in C++
11283 pub struct CVec_EventZ {
11284         /// The elements in the array.
11285         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11286         pub data: *mut crate::lightning::util::events::Event,
11287         /// The number of elements pointed to by `data`.
11288         pub datalen: usize
11289 }
11290 impl CVec_EventZ {
11291         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11292                 if self.datalen == 0 { return Vec::new(); }
11293                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11294                 self.data = core::ptr::null_mut();
11295                 self.datalen = 0;
11296                 ret
11297         }
11298         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11299                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11300         }
11301 }
11302 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11303         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11304                 let datalen = v.len();
11305                 let data = Box::into_raw(v.into_boxed_slice());
11306                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11307         }
11308 }
11309 #[no_mangle]
11310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11311 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11312 impl Drop for CVec_EventZ {
11313         fn drop(&mut self) {
11314                 if self.datalen == 0 { return; }
11315                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11316         }
11317 }
11318 impl Clone for CVec_EventZ {
11319         fn clone(&self) -> Self {
11320                 let mut res = Vec::new();
11321                 if self.datalen == 0 { return Self::from(res); }
11322                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11323                 Self::from(res)
11324         }
11325 }
11326 #[repr(C)]
11327 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11328 /// This corresponds to std::vector in C++
11329 pub struct CVec_TransactionZ {
11330         /// The elements in the array.
11331         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11332         pub data: *mut crate::c_types::Transaction,
11333         /// The number of elements pointed to by `data`.
11334         pub datalen: usize
11335 }
11336 impl CVec_TransactionZ {
11337         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11338                 if self.datalen == 0 { return Vec::new(); }
11339                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11340                 self.data = core::ptr::null_mut();
11341                 self.datalen = 0;
11342                 ret
11343         }
11344         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11345                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11346         }
11347 }
11348 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11349         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11350                 let datalen = v.len();
11351                 let data = Box::into_raw(v.into_boxed_slice());
11352                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11353         }
11354 }
11355 #[no_mangle]
11356 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11357 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11358 impl Drop for CVec_TransactionZ {
11359         fn drop(&mut self) {
11360                 if self.datalen == 0 { return; }
11361                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11362         }
11363 }
11364 impl Clone for CVec_TransactionZ {
11365         fn clone(&self) -> Self {
11366                 let mut res = Vec::new();
11367                 if self.datalen == 0 { return Self::from(res); }
11368                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11369                 Self::from(res)
11370         }
11371 }
11372 #[repr(C)]
11373 /// A tuple of 2 elements. See the individual fields for the types contained.
11374 pub struct C2Tuple_u32TxOutZ {
11375         /// The element at position 0
11376         pub a: u32,
11377         /// The element at position 1
11378         pub b: crate::c_types::TxOut,
11379 }
11380 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11381         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11382                 Self {
11383                         a: tup.0,
11384                         b: tup.1,
11385                 }
11386         }
11387 }
11388 impl C2Tuple_u32TxOutZ {
11389         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11390                 (self.a, self.b)
11391         }
11392 }
11393 impl Clone for C2Tuple_u32TxOutZ {
11394         fn clone(&self) -> Self {
11395                 Self {
11396                         a: Clone::clone(&self.a),
11397                         b: Clone::clone(&self.b),
11398                 }
11399         }
11400 }
11401 #[no_mangle]
11402 /// Creates a new tuple which has the same data as `orig`
11403 /// but with all dynamically-allocated buffers duplicated in new buffers.
11404 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11405 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11406 #[no_mangle]
11407 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11408         C2Tuple_u32TxOutZ { a, b, }
11409 }
11410
11411 #[no_mangle]
11412 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11413 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11414 #[repr(C)]
11415 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11416 /// This corresponds to std::vector in C++
11417 pub struct CVec_C2Tuple_u32TxOutZZ {
11418         /// The elements in the array.
11419         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11420         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11421         /// The number of elements pointed to by `data`.
11422         pub datalen: usize
11423 }
11424 impl CVec_C2Tuple_u32TxOutZZ {
11425         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11426                 if self.datalen == 0 { return Vec::new(); }
11427                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11428                 self.data = core::ptr::null_mut();
11429                 self.datalen = 0;
11430                 ret
11431         }
11432         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11433                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11434         }
11435 }
11436 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11437         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11438                 let datalen = v.len();
11439                 let data = Box::into_raw(v.into_boxed_slice());
11440                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11441         }
11442 }
11443 #[no_mangle]
11444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11445 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11446 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11447         fn drop(&mut self) {
11448                 if self.datalen == 0 { return; }
11449                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11450         }
11451 }
11452 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11453         fn clone(&self) -> Self {
11454                 let mut res = Vec::new();
11455                 if self.datalen == 0 { return Self::from(res); }
11456                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11457                 Self::from(res)
11458         }
11459 }
11460 #[repr(C)]
11461 /// A tuple of 2 elements. See the individual fields for the types contained.
11462 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11463         /// The element at position 0
11464         pub a: crate::c_types::ThirtyTwoBytes,
11465         /// The element at position 1
11466         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11467 }
11468 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11469         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11470                 Self {
11471                         a: tup.0,
11472                         b: tup.1,
11473                 }
11474         }
11475 }
11476 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11477         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11478                 (self.a, self.b)
11479         }
11480 }
11481 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11482         fn clone(&self) -> Self {
11483                 Self {
11484                         a: Clone::clone(&self.a),
11485                         b: Clone::clone(&self.b),
11486                 }
11487         }
11488 }
11489 #[no_mangle]
11490 /// Creates a new tuple which has the same data as `orig`
11491 /// but with all dynamically-allocated buffers duplicated in new buffers.
11492 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11493 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11494 #[no_mangle]
11495 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 {
11496         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11497 }
11498
11499 #[no_mangle]
11500 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11501 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11502 #[repr(C)]
11503 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11504 /// This corresponds to std::vector in C++
11505 pub struct CVec_TransactionOutputsZ {
11506         /// The elements in the array.
11507         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11508         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11509         /// The number of elements pointed to by `data`.
11510         pub datalen: usize
11511 }
11512 impl CVec_TransactionOutputsZ {
11513         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11514                 if self.datalen == 0 { return Vec::new(); }
11515                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11516                 self.data = core::ptr::null_mut();
11517                 self.datalen = 0;
11518                 ret
11519         }
11520         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11521                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11522         }
11523 }
11524 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11525         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11526                 let datalen = v.len();
11527                 let data = Box::into_raw(v.into_boxed_slice());
11528                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11529         }
11530 }
11531 #[no_mangle]
11532 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11533 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11534 impl Drop for CVec_TransactionOutputsZ {
11535         fn drop(&mut self) {
11536                 if self.datalen == 0 { return; }
11537                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11538         }
11539 }
11540 impl Clone for CVec_TransactionOutputsZ {
11541         fn clone(&self) -> Self {
11542                 let mut res = Vec::new();
11543                 if self.datalen == 0 { return Self::from(res); }
11544                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11545                 Self::from(res)
11546         }
11547 }
11548 #[repr(C)]
11549 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11550 /// This corresponds to std::vector in C++
11551 pub struct CVec_BalanceZ {
11552         /// The elements in the array.
11553         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11554         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11555         /// The number of elements pointed to by `data`.
11556         pub datalen: usize
11557 }
11558 impl CVec_BalanceZ {
11559         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11560                 if self.datalen == 0 { return Vec::new(); }
11561                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11562                 self.data = core::ptr::null_mut();
11563                 self.datalen = 0;
11564                 ret
11565         }
11566         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11567                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11568         }
11569 }
11570 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11571         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11572                 let datalen = v.len();
11573                 let data = Box::into_raw(v.into_boxed_slice());
11574                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11575         }
11576 }
11577 #[no_mangle]
11578 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11579 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11580 impl Drop for CVec_BalanceZ {
11581         fn drop(&mut self) {
11582                 if self.datalen == 0 { return; }
11583                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11584         }
11585 }
11586 impl Clone for CVec_BalanceZ {
11587         fn clone(&self) -> Self {
11588                 let mut res = Vec::new();
11589                 if self.datalen == 0 { return Self::from(res); }
11590                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11591                 Self::from(res)
11592         }
11593 }
11594 #[repr(C)]
11595 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11596 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11597         /// A pointer to the contents in the success state.
11598         /// Reading from this pointer when `result_ok` is not set is undefined.
11599         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11600         /// A pointer to the contents in the error state.
11601         /// Reading from this pointer when `result_ok` is set is undefined.
11602         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11603 }
11604 #[repr(C)]
11605 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11606 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11608 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11609         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11610         /// `err` or `result` depending on the state of `result_ok`.
11611         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11612         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11613         pub result_ok: bool,
11614 }
11615 #[no_mangle]
11616 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11617 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11618         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11619                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11620                         result: Box::into_raw(Box::new(o)),
11621                 },
11622                 result_ok: true,
11623         }
11624 }
11625 #[no_mangle]
11626 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11627 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11628         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11629                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11630                         err: Box::into_raw(Box::new(e)),
11631                 },
11632                 result_ok: false,
11633         }
11634 }
11635 /// Checks if the given object is currently in the success state
11636 #[no_mangle]
11637 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11638         o.result_ok
11639 }
11640 #[no_mangle]
11641 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11642 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11643 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11644         fn drop(&mut self) {
11645                 if self.result_ok {
11646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11648                         }
11649                 } else {
11650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11652                         }
11653                 }
11654         }
11655 }
11656 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11657         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11658                 let contents = if o.result_ok {
11659                         let result = unsafe { o.contents.result };
11660                         unsafe { o.contents.result = core::ptr::null_mut() };
11661                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11662                 } else {
11663                         let err = unsafe { o.contents.err };
11664                         unsafe { o.contents.err = core::ptr::null_mut(); }
11665                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11666                 };
11667                 Self {
11668                         contents,
11669                         result_ok: o.result_ok,
11670                 }
11671         }
11672 }
11673 #[repr(C)]
11674 /// A tuple of 2 elements. See the individual fields for the types contained.
11675 pub struct C2Tuple_PublicKeyTypeZ {
11676         /// The element at position 0
11677         pub a: crate::c_types::PublicKey,
11678         /// The element at position 1
11679         pub b: crate::lightning::ln::wire::Type,
11680 }
11681 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11682         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11683                 Self {
11684                         a: tup.0,
11685                         b: tup.1,
11686                 }
11687         }
11688 }
11689 impl C2Tuple_PublicKeyTypeZ {
11690         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11691                 (self.a, self.b)
11692         }
11693 }
11694 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11695 #[no_mangle]
11696 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11697         C2Tuple_PublicKeyTypeZ { a, b, }
11698 }
11699
11700 #[no_mangle]
11701 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11702 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11703 #[repr(C)]
11704 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11705 /// This corresponds to std::vector in C++
11706 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11707         /// The elements in the array.
11708         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11709         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11710         /// The number of elements pointed to by `data`.
11711         pub datalen: usize
11712 }
11713 impl CVec_C2Tuple_PublicKeyTypeZZ {
11714         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11715                 if self.datalen == 0 { return Vec::new(); }
11716                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11717                 self.data = core::ptr::null_mut();
11718                 self.datalen = 0;
11719                 ret
11720         }
11721         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11722                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11723         }
11724 }
11725 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11726         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11727                 let datalen = v.len();
11728                 let data = Box::into_raw(v.into_boxed_slice());
11729                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11730         }
11731 }
11732 #[no_mangle]
11733 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11734 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11735 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11736         fn drop(&mut self) {
11737                 if self.datalen == 0 { return; }
11738                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11739         }
11740 }
11741 #[repr(C)]
11742 #[derive(Clone)]
11743 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11744 pub enum COption_NetAddressZ {
11745         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11746         Some(crate::lightning::ln::msgs::NetAddress),
11747         /// When we're in this state, this COption_NetAddressZ contains nothing
11748         None
11749 }
11750 impl COption_NetAddressZ {
11751         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11752                 if let Self::None = self { false } else { true }
11753         }
11754         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11755                 !self.is_some()
11756         }
11757         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11758                 if let Self::Some(v) = self { v } else { unreachable!() }
11759         }
11760 }
11761 #[no_mangle]
11762 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11763 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11764         COption_NetAddressZ::Some(o)
11765 }
11766 #[no_mangle]
11767 /// Constructs a new COption_NetAddressZ containing nothing
11768 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11769         COption_NetAddressZ::None
11770 }
11771 #[no_mangle]
11772 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11773 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11774 #[no_mangle]
11775 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11776 /// but with all dynamically-allocated buffers duplicated in new buffers.
11777 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11778 #[repr(C)]
11779 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11780 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11781         /// A pointer to the contents in the success state.
11782         /// Reading from this pointer when `result_ok` is not set is undefined.
11783         pub result: *mut crate::c_types::derived::CVec_u8Z,
11784         /// A pointer to the contents in the error state.
11785         /// Reading from this pointer when `result_ok` is set is undefined.
11786         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11787 }
11788 #[repr(C)]
11789 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11790 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11792 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11793         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11794         /// `err` or `result` depending on the state of `result_ok`.
11795         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11796         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11797         pub result_ok: bool,
11798 }
11799 #[no_mangle]
11800 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11801 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11802         CResult_CVec_u8ZPeerHandleErrorZ {
11803                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11804                         result: Box::into_raw(Box::new(o)),
11805                 },
11806                 result_ok: true,
11807         }
11808 }
11809 #[no_mangle]
11810 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11811 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11812         CResult_CVec_u8ZPeerHandleErrorZ {
11813                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11814                         err: Box::into_raw(Box::new(e)),
11815                 },
11816                 result_ok: false,
11817         }
11818 }
11819 /// Checks if the given object is currently in the success state
11820 #[no_mangle]
11821 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11822         o.result_ok
11823 }
11824 #[no_mangle]
11825 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11826 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11827 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11828         fn drop(&mut self) {
11829                 if self.result_ok {
11830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11832                         }
11833                 } else {
11834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11836                         }
11837                 }
11838         }
11839 }
11840 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11841         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11842                 let contents = if o.result_ok {
11843                         let result = unsafe { o.contents.result };
11844                         unsafe { o.contents.result = core::ptr::null_mut() };
11845                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11846                 } else {
11847                         let err = unsafe { o.contents.err };
11848                         unsafe { o.contents.err = core::ptr::null_mut(); }
11849                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11850                 };
11851                 Self {
11852                         contents,
11853                         result_ok: o.result_ok,
11854                 }
11855         }
11856 }
11857 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11858         fn clone(&self) -> Self {
11859                 if self.result_ok {
11860                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11861                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11862                         } }
11863                 } else {
11864                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11865                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11866                         } }
11867                 }
11868         }
11869 }
11870 #[no_mangle]
11871 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11872 /// but with all dynamically-allocated buffers duplicated in new buffers.
11873 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
11874 #[repr(C)]
11875 /// The contents of CResult_NonePeerHandleErrorZ
11876 pub union CResult_NonePeerHandleErrorZPtr {
11877         /// Note that this value is always NULL, as there are no contents in the OK variant
11878         pub result: *mut core::ffi::c_void,
11879         /// A pointer to the contents in the error state.
11880         /// Reading from this pointer when `result_ok` is set is undefined.
11881         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11882 }
11883 #[repr(C)]
11884 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
11885 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11887 pub struct CResult_NonePeerHandleErrorZ {
11888         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
11889         /// `err` or `result` depending on the state of `result_ok`.
11890         pub contents: CResult_NonePeerHandleErrorZPtr,
11891         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
11892         pub result_ok: bool,
11893 }
11894 #[no_mangle]
11895 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
11896 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
11897         CResult_NonePeerHandleErrorZ {
11898                 contents: CResult_NonePeerHandleErrorZPtr {
11899                         result: core::ptr::null_mut(),
11900                 },
11901                 result_ok: true,
11902         }
11903 }
11904 #[no_mangle]
11905 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
11906 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
11907         CResult_NonePeerHandleErrorZ {
11908                 contents: CResult_NonePeerHandleErrorZPtr {
11909                         err: Box::into_raw(Box::new(e)),
11910                 },
11911                 result_ok: false,
11912         }
11913 }
11914 /// Checks if the given object is currently in the success state
11915 #[no_mangle]
11916 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
11917         o.result_ok
11918 }
11919 #[no_mangle]
11920 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
11921 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
11922 impl Drop for CResult_NonePeerHandleErrorZ {
11923         fn drop(&mut self) {
11924                 if self.result_ok {
11925                 } else {
11926                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11927                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11928                         }
11929                 }
11930         }
11931 }
11932 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
11933         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11934                 let contents = if o.result_ok {
11935                         let _ = unsafe { Box::from_raw(o.contents.result) };
11936                         o.contents.result = core::ptr::null_mut();
11937                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
11938                 } else {
11939                         let err = unsafe { o.contents.err };
11940                         unsafe { o.contents.err = core::ptr::null_mut(); }
11941                         CResult_NonePeerHandleErrorZPtr { err }
11942                 };
11943                 Self {
11944                         contents,
11945                         result_ok: o.result_ok,
11946                 }
11947         }
11948 }
11949 impl Clone for CResult_NonePeerHandleErrorZ {
11950         fn clone(&self) -> Self {
11951                 if self.result_ok {
11952                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
11953                                 result: core::ptr::null_mut()
11954                         } }
11955                 } else {
11956                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
11957                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
11958                         } }
11959                 }
11960         }
11961 }
11962 #[no_mangle]
11963 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11964 /// but with all dynamically-allocated buffers duplicated in new buffers.
11965 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
11966 #[repr(C)]
11967 /// The contents of CResult_boolPeerHandleErrorZ
11968 pub union CResult_boolPeerHandleErrorZPtr {
11969         /// A pointer to the contents in the success state.
11970         /// Reading from this pointer when `result_ok` is not set is undefined.
11971         pub result: *mut bool,
11972         /// A pointer to the contents in the error state.
11973         /// Reading from this pointer when `result_ok` is set is undefined.
11974         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11975 }
11976 #[repr(C)]
11977 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
11978 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11980 pub struct CResult_boolPeerHandleErrorZ {
11981         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
11982         /// `err` or `result` depending on the state of `result_ok`.
11983         pub contents: CResult_boolPeerHandleErrorZPtr,
11984         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
11985         pub result_ok: bool,
11986 }
11987 #[no_mangle]
11988 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
11989 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
11990         CResult_boolPeerHandleErrorZ {
11991                 contents: CResult_boolPeerHandleErrorZPtr {
11992                         result: Box::into_raw(Box::new(o)),
11993                 },
11994                 result_ok: true,
11995         }
11996 }
11997 #[no_mangle]
11998 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
11999 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12000         CResult_boolPeerHandleErrorZ {
12001                 contents: CResult_boolPeerHandleErrorZPtr {
12002                         err: Box::into_raw(Box::new(e)),
12003                 },
12004                 result_ok: false,
12005         }
12006 }
12007 /// Checks if the given object is currently in the success state
12008 #[no_mangle]
12009 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12010         o.result_ok
12011 }
12012 #[no_mangle]
12013 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12014 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12015 impl Drop for CResult_boolPeerHandleErrorZ {
12016         fn drop(&mut self) {
12017                 if self.result_ok {
12018                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12019                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12020                         }
12021                 } else {
12022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12024                         }
12025                 }
12026         }
12027 }
12028 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12029         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12030                 let contents = if o.result_ok {
12031                         let result = unsafe { o.contents.result };
12032                         unsafe { o.contents.result = core::ptr::null_mut() };
12033                         CResult_boolPeerHandleErrorZPtr { result }
12034                 } else {
12035                         let err = unsafe { o.contents.err };
12036                         unsafe { o.contents.err = core::ptr::null_mut(); }
12037                         CResult_boolPeerHandleErrorZPtr { err }
12038                 };
12039                 Self {
12040                         contents,
12041                         result_ok: o.result_ok,
12042                 }
12043         }
12044 }
12045 impl Clone for CResult_boolPeerHandleErrorZ {
12046         fn clone(&self) -> Self {
12047                 if self.result_ok {
12048                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12049                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12050                         } }
12051                 } else {
12052                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12053                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12054                         } }
12055                 }
12056         }
12057 }
12058 #[no_mangle]
12059 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12060 /// but with all dynamically-allocated buffers duplicated in new buffers.
12061 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12062 #[repr(C)]
12063 /// The contents of CResult_u32GraphSyncErrorZ
12064 pub union CResult_u32GraphSyncErrorZPtr {
12065         /// A pointer to the contents in the success state.
12066         /// Reading from this pointer when `result_ok` is not set is undefined.
12067         pub result: *mut u32,
12068         /// A pointer to the contents in the error state.
12069         /// Reading from this pointer when `result_ok` is set is undefined.
12070         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12071 }
12072 #[repr(C)]
12073 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12074 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12075 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12076 pub struct CResult_u32GraphSyncErrorZ {
12077         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12078         /// `err` or `result` depending on the state of `result_ok`.
12079         pub contents: CResult_u32GraphSyncErrorZPtr,
12080         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12081         pub result_ok: bool,
12082 }
12083 #[no_mangle]
12084 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12085 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12086         CResult_u32GraphSyncErrorZ {
12087                 contents: CResult_u32GraphSyncErrorZPtr {
12088                         result: Box::into_raw(Box::new(o)),
12089                 },
12090                 result_ok: true,
12091         }
12092 }
12093 #[no_mangle]
12094 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12095 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12096         CResult_u32GraphSyncErrorZ {
12097                 contents: CResult_u32GraphSyncErrorZPtr {
12098                         err: Box::into_raw(Box::new(e)),
12099                 },
12100                 result_ok: false,
12101         }
12102 }
12103 /// Checks if the given object is currently in the success state
12104 #[no_mangle]
12105 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12106         o.result_ok
12107 }
12108 #[no_mangle]
12109 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12110 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12111 impl Drop for CResult_u32GraphSyncErrorZ {
12112         fn drop(&mut self) {
12113                 if self.result_ok {
12114                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12115                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12116                         }
12117                 } else {
12118                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12119                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12120                         }
12121                 }
12122         }
12123 }
12124 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12125         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12126                 let contents = if o.result_ok {
12127                         let result = unsafe { o.contents.result };
12128                         unsafe { o.contents.result = core::ptr::null_mut() };
12129                         CResult_u32GraphSyncErrorZPtr { result }
12130                 } else {
12131                         let err = unsafe { o.contents.err };
12132                         unsafe { o.contents.err = core::ptr::null_mut(); }
12133                         CResult_u32GraphSyncErrorZPtr { err }
12134                 };
12135                 Self {
12136                         contents,
12137                         result_ok: o.result_ok,
12138                 }
12139         }
12140 }
12141 #[repr(C)]
12142 /// The contents of CResult_NetAddressDecodeErrorZ
12143 pub union CResult_NetAddressDecodeErrorZPtr {
12144         /// A pointer to the contents in the success state.
12145         /// Reading from this pointer when `result_ok` is not set is undefined.
12146         pub result: *mut crate::lightning::ln::msgs::NetAddress,
12147         /// A pointer to the contents in the error state.
12148         /// Reading from this pointer when `result_ok` is set is undefined.
12149         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12150 }
12151 #[repr(C)]
12152 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12153 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12154 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12155 pub struct CResult_NetAddressDecodeErrorZ {
12156         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12157         /// `err` or `result` depending on the state of `result_ok`.
12158         pub contents: CResult_NetAddressDecodeErrorZPtr,
12159         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12160         pub result_ok: bool,
12161 }
12162 #[no_mangle]
12163 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12164 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12165         CResult_NetAddressDecodeErrorZ {
12166                 contents: CResult_NetAddressDecodeErrorZPtr {
12167                         result: Box::into_raw(Box::new(o)),
12168                 },
12169                 result_ok: true,
12170         }
12171 }
12172 #[no_mangle]
12173 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12174 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12175         CResult_NetAddressDecodeErrorZ {
12176                 contents: CResult_NetAddressDecodeErrorZPtr {
12177                         err: Box::into_raw(Box::new(e)),
12178                 },
12179                 result_ok: false,
12180         }
12181 }
12182 /// Checks if the given object is currently in the success state
12183 #[no_mangle]
12184 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12185         o.result_ok
12186 }
12187 #[no_mangle]
12188 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12189 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12190 impl Drop for CResult_NetAddressDecodeErrorZ {
12191         fn drop(&mut self) {
12192                 if self.result_ok {
12193                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12194                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12195                         }
12196                 } else {
12197                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12198                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12199                         }
12200                 }
12201         }
12202 }
12203 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12204         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12205                 let contents = if o.result_ok {
12206                         let result = unsafe { o.contents.result };
12207                         unsafe { o.contents.result = core::ptr::null_mut() };
12208                         CResult_NetAddressDecodeErrorZPtr { result }
12209                 } else {
12210                         let err = unsafe { o.contents.err };
12211                         unsafe { o.contents.err = core::ptr::null_mut(); }
12212                         CResult_NetAddressDecodeErrorZPtr { err }
12213                 };
12214                 Self {
12215                         contents,
12216                         result_ok: o.result_ok,
12217                 }
12218         }
12219 }
12220 impl Clone for CResult_NetAddressDecodeErrorZ {
12221         fn clone(&self) -> Self {
12222                 if self.result_ok {
12223                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12224                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12225                         } }
12226                 } else {
12227                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12228                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12229                         } }
12230                 }
12231         }
12232 }
12233 #[no_mangle]
12234 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12235 /// but with all dynamically-allocated buffers duplicated in new buffers.
12236 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12237 #[repr(C)]
12238 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12239 /// This corresponds to std::vector in C++
12240 pub struct CVec_UpdateAddHTLCZ {
12241         /// The elements in the array.
12242         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12243         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12244         /// The number of elements pointed to by `data`.
12245         pub datalen: usize
12246 }
12247 impl CVec_UpdateAddHTLCZ {
12248         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12249                 if self.datalen == 0 { return Vec::new(); }
12250                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12251                 self.data = core::ptr::null_mut();
12252                 self.datalen = 0;
12253                 ret
12254         }
12255         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12256                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12257         }
12258 }
12259 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12260         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12261                 let datalen = v.len();
12262                 let data = Box::into_raw(v.into_boxed_slice());
12263                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12264         }
12265 }
12266 #[no_mangle]
12267 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12268 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12269 impl Drop for CVec_UpdateAddHTLCZ {
12270         fn drop(&mut self) {
12271                 if self.datalen == 0 { return; }
12272                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12273         }
12274 }
12275 impl Clone for CVec_UpdateAddHTLCZ {
12276         fn clone(&self) -> Self {
12277                 let mut res = Vec::new();
12278                 if self.datalen == 0 { return Self::from(res); }
12279                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12280                 Self::from(res)
12281         }
12282 }
12283 #[repr(C)]
12284 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12285 /// This corresponds to std::vector in C++
12286 pub struct CVec_UpdateFulfillHTLCZ {
12287         /// The elements in the array.
12288         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12289         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12290         /// The number of elements pointed to by `data`.
12291         pub datalen: usize
12292 }
12293 impl CVec_UpdateFulfillHTLCZ {
12294         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12295                 if self.datalen == 0 { return Vec::new(); }
12296                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12297                 self.data = core::ptr::null_mut();
12298                 self.datalen = 0;
12299                 ret
12300         }
12301         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12302                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12303         }
12304 }
12305 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12306         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12307                 let datalen = v.len();
12308                 let data = Box::into_raw(v.into_boxed_slice());
12309                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12310         }
12311 }
12312 #[no_mangle]
12313 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12314 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12315 impl Drop for CVec_UpdateFulfillHTLCZ {
12316         fn drop(&mut self) {
12317                 if self.datalen == 0 { return; }
12318                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12319         }
12320 }
12321 impl Clone for CVec_UpdateFulfillHTLCZ {
12322         fn clone(&self) -> Self {
12323                 let mut res = Vec::new();
12324                 if self.datalen == 0 { return Self::from(res); }
12325                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12326                 Self::from(res)
12327         }
12328 }
12329 #[repr(C)]
12330 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12331 /// This corresponds to std::vector in C++
12332 pub struct CVec_UpdateFailHTLCZ {
12333         /// The elements in the array.
12334         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12335         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12336         /// The number of elements pointed to by `data`.
12337         pub datalen: usize
12338 }
12339 impl CVec_UpdateFailHTLCZ {
12340         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12341                 if self.datalen == 0 { return Vec::new(); }
12342                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12343                 self.data = core::ptr::null_mut();
12344                 self.datalen = 0;
12345                 ret
12346         }
12347         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12348                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12349         }
12350 }
12351 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12352         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12353                 let datalen = v.len();
12354                 let data = Box::into_raw(v.into_boxed_slice());
12355                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12356         }
12357 }
12358 #[no_mangle]
12359 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12360 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12361 impl Drop for CVec_UpdateFailHTLCZ {
12362         fn drop(&mut self) {
12363                 if self.datalen == 0 { return; }
12364                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12365         }
12366 }
12367 impl Clone for CVec_UpdateFailHTLCZ {
12368         fn clone(&self) -> Self {
12369                 let mut res = Vec::new();
12370                 if self.datalen == 0 { return Self::from(res); }
12371                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12372                 Self::from(res)
12373         }
12374 }
12375 #[repr(C)]
12376 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12377 /// This corresponds to std::vector in C++
12378 pub struct CVec_UpdateFailMalformedHTLCZ {
12379         /// The elements in the array.
12380         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12381         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12382         /// The number of elements pointed to by `data`.
12383         pub datalen: usize
12384 }
12385 impl CVec_UpdateFailMalformedHTLCZ {
12386         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12387                 if self.datalen == 0 { return Vec::new(); }
12388                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12389                 self.data = core::ptr::null_mut();
12390                 self.datalen = 0;
12391                 ret
12392         }
12393         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12394                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12395         }
12396 }
12397 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12398         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12399                 let datalen = v.len();
12400                 let data = Box::into_raw(v.into_boxed_slice());
12401                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12402         }
12403 }
12404 #[no_mangle]
12405 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12406 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12407 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12408         fn drop(&mut self) {
12409                 if self.datalen == 0 { return; }
12410                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12411         }
12412 }
12413 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12414         fn clone(&self) -> Self {
12415                 let mut res = Vec::new();
12416                 if self.datalen == 0 { return Self::from(res); }
12417                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12418                 Self::from(res)
12419         }
12420 }
12421 #[repr(C)]
12422 /// The contents of CResult_AcceptChannelDecodeErrorZ
12423 pub union CResult_AcceptChannelDecodeErrorZPtr {
12424         /// A pointer to the contents in the success state.
12425         /// Reading from this pointer when `result_ok` is not set is undefined.
12426         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12427         /// A pointer to the contents in the error state.
12428         /// Reading from this pointer when `result_ok` is set is undefined.
12429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12430 }
12431 #[repr(C)]
12432 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12433 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12435 pub struct CResult_AcceptChannelDecodeErrorZ {
12436         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12437         /// `err` or `result` depending on the state of `result_ok`.
12438         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12439         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12440         pub result_ok: bool,
12441 }
12442 #[no_mangle]
12443 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12444 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12445         CResult_AcceptChannelDecodeErrorZ {
12446                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12447                         result: Box::into_raw(Box::new(o)),
12448                 },
12449                 result_ok: true,
12450         }
12451 }
12452 #[no_mangle]
12453 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12454 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12455         CResult_AcceptChannelDecodeErrorZ {
12456                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12457                         err: Box::into_raw(Box::new(e)),
12458                 },
12459                 result_ok: false,
12460         }
12461 }
12462 /// Checks if the given object is currently in the success state
12463 #[no_mangle]
12464 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12465         o.result_ok
12466 }
12467 #[no_mangle]
12468 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12469 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12470 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12471         fn drop(&mut self) {
12472                 if self.result_ok {
12473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12475                         }
12476                 } else {
12477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12479                         }
12480                 }
12481         }
12482 }
12483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12485                 let contents = if o.result_ok {
12486                         let result = unsafe { o.contents.result };
12487                         unsafe { o.contents.result = core::ptr::null_mut() };
12488                         CResult_AcceptChannelDecodeErrorZPtr { result }
12489                 } else {
12490                         let err = unsafe { o.contents.err };
12491                         unsafe { o.contents.err = core::ptr::null_mut(); }
12492                         CResult_AcceptChannelDecodeErrorZPtr { err }
12493                 };
12494                 Self {
12495                         contents,
12496                         result_ok: o.result_ok,
12497                 }
12498         }
12499 }
12500 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12501         fn clone(&self) -> Self {
12502                 if self.result_ok {
12503                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12504                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12505                         } }
12506                 } else {
12507                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12509                         } }
12510                 }
12511         }
12512 }
12513 #[no_mangle]
12514 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12515 /// but with all dynamically-allocated buffers duplicated in new buffers.
12516 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12517 #[repr(C)]
12518 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12519 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12520         /// A pointer to the contents in the success state.
12521         /// Reading from this pointer when `result_ok` is not set is undefined.
12522         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12523         /// A pointer to the contents in the error state.
12524         /// Reading from this pointer when `result_ok` is set is undefined.
12525         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12526 }
12527 #[repr(C)]
12528 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12529 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12531 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12532         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12533         /// `err` or `result` depending on the state of `result_ok`.
12534         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12535         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12536         pub result_ok: bool,
12537 }
12538 #[no_mangle]
12539 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12540 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12541         CResult_AnnouncementSignaturesDecodeErrorZ {
12542                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12543                         result: Box::into_raw(Box::new(o)),
12544                 },
12545                 result_ok: true,
12546         }
12547 }
12548 #[no_mangle]
12549 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12550 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12551         CResult_AnnouncementSignaturesDecodeErrorZ {
12552                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12553                         err: Box::into_raw(Box::new(e)),
12554                 },
12555                 result_ok: false,
12556         }
12557 }
12558 /// Checks if the given object is currently in the success state
12559 #[no_mangle]
12560 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12561         o.result_ok
12562 }
12563 #[no_mangle]
12564 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12565 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12566 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12567         fn drop(&mut self) {
12568                 if self.result_ok {
12569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12571                         }
12572                 } else {
12573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12575                         }
12576                 }
12577         }
12578 }
12579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12580         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12581                 let contents = if o.result_ok {
12582                         let result = unsafe { o.contents.result };
12583                         unsafe { o.contents.result = core::ptr::null_mut() };
12584                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12585                 } else {
12586                         let err = unsafe { o.contents.err };
12587                         unsafe { o.contents.err = core::ptr::null_mut(); }
12588                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12589                 };
12590                 Self {
12591                         contents,
12592                         result_ok: o.result_ok,
12593                 }
12594         }
12595 }
12596 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12597         fn clone(&self) -> Self {
12598                 if self.result_ok {
12599                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12600                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12601                         } }
12602                 } else {
12603                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12605                         } }
12606                 }
12607         }
12608 }
12609 #[no_mangle]
12610 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12611 /// but with all dynamically-allocated buffers duplicated in new buffers.
12612 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12613 #[repr(C)]
12614 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12615 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12616         /// A pointer to the contents in the success state.
12617         /// Reading from this pointer when `result_ok` is not set is undefined.
12618         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12619         /// A pointer to the contents in the error state.
12620         /// Reading from this pointer when `result_ok` is set is undefined.
12621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12622 }
12623 #[repr(C)]
12624 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12625 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12627 pub struct CResult_ChannelReestablishDecodeErrorZ {
12628         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12629         /// `err` or `result` depending on the state of `result_ok`.
12630         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12631         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12632         pub result_ok: bool,
12633 }
12634 #[no_mangle]
12635 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12636 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12637         CResult_ChannelReestablishDecodeErrorZ {
12638                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12639                         result: Box::into_raw(Box::new(o)),
12640                 },
12641                 result_ok: true,
12642         }
12643 }
12644 #[no_mangle]
12645 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12646 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12647         CResult_ChannelReestablishDecodeErrorZ {
12648                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12649                         err: Box::into_raw(Box::new(e)),
12650                 },
12651                 result_ok: false,
12652         }
12653 }
12654 /// Checks if the given object is currently in the success state
12655 #[no_mangle]
12656 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12657         o.result_ok
12658 }
12659 #[no_mangle]
12660 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12661 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12662 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12663         fn drop(&mut self) {
12664                 if self.result_ok {
12665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12667                         }
12668                 } else {
12669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12671                         }
12672                 }
12673         }
12674 }
12675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12677                 let contents = if o.result_ok {
12678                         let result = unsafe { o.contents.result };
12679                         unsafe { o.contents.result = core::ptr::null_mut() };
12680                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12681                 } else {
12682                         let err = unsafe { o.contents.err };
12683                         unsafe { o.contents.err = core::ptr::null_mut(); }
12684                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12685                 };
12686                 Self {
12687                         contents,
12688                         result_ok: o.result_ok,
12689                 }
12690         }
12691 }
12692 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12693         fn clone(&self) -> Self {
12694                 if self.result_ok {
12695                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12697                         } }
12698                 } else {
12699                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12701                         } }
12702                 }
12703         }
12704 }
12705 #[no_mangle]
12706 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12707 /// but with all dynamically-allocated buffers duplicated in new buffers.
12708 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12709 #[repr(C)]
12710 /// The contents of CResult_ClosingSignedDecodeErrorZ
12711 pub union CResult_ClosingSignedDecodeErrorZPtr {
12712         /// A pointer to the contents in the success state.
12713         /// Reading from this pointer when `result_ok` is not set is undefined.
12714         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12715         /// A pointer to the contents in the error state.
12716         /// Reading from this pointer when `result_ok` is set is undefined.
12717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12718 }
12719 #[repr(C)]
12720 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12721 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12723 pub struct CResult_ClosingSignedDecodeErrorZ {
12724         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12725         /// `err` or `result` depending on the state of `result_ok`.
12726         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12727         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12728         pub result_ok: bool,
12729 }
12730 #[no_mangle]
12731 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12732 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12733         CResult_ClosingSignedDecodeErrorZ {
12734                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12735                         result: Box::into_raw(Box::new(o)),
12736                 },
12737                 result_ok: true,
12738         }
12739 }
12740 #[no_mangle]
12741 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12742 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12743         CResult_ClosingSignedDecodeErrorZ {
12744                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12745                         err: Box::into_raw(Box::new(e)),
12746                 },
12747                 result_ok: false,
12748         }
12749 }
12750 /// Checks if the given object is currently in the success state
12751 #[no_mangle]
12752 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12753         o.result_ok
12754 }
12755 #[no_mangle]
12756 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12757 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12758 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12759         fn drop(&mut self) {
12760                 if self.result_ok {
12761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12763                         }
12764                 } else {
12765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12767                         }
12768                 }
12769         }
12770 }
12771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12773                 let contents = if o.result_ok {
12774                         let result = unsafe { o.contents.result };
12775                         unsafe { o.contents.result = core::ptr::null_mut() };
12776                         CResult_ClosingSignedDecodeErrorZPtr { result }
12777                 } else {
12778                         let err = unsafe { o.contents.err };
12779                         unsafe { o.contents.err = core::ptr::null_mut(); }
12780                         CResult_ClosingSignedDecodeErrorZPtr { err }
12781                 };
12782                 Self {
12783                         contents,
12784                         result_ok: o.result_ok,
12785                 }
12786         }
12787 }
12788 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12789         fn clone(&self) -> Self {
12790                 if self.result_ok {
12791                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12792                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12793                         } }
12794                 } else {
12795                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12797                         } }
12798                 }
12799         }
12800 }
12801 #[no_mangle]
12802 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12803 /// but with all dynamically-allocated buffers duplicated in new buffers.
12804 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12805 #[repr(C)]
12806 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12807 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12808         /// A pointer to the contents in the success state.
12809         /// Reading from this pointer when `result_ok` is not set is undefined.
12810         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12811         /// A pointer to the contents in the error state.
12812         /// Reading from this pointer when `result_ok` is set is undefined.
12813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12814 }
12815 #[repr(C)]
12816 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12817 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12819 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12820         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12821         /// `err` or `result` depending on the state of `result_ok`.
12822         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12823         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12824         pub result_ok: bool,
12825 }
12826 #[no_mangle]
12827 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12828 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12829         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12830                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12831                         result: Box::into_raw(Box::new(o)),
12832                 },
12833                 result_ok: true,
12834         }
12835 }
12836 #[no_mangle]
12837 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12838 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12839         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12840                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12841                         err: Box::into_raw(Box::new(e)),
12842                 },
12843                 result_ok: false,
12844         }
12845 }
12846 /// Checks if the given object is currently in the success state
12847 #[no_mangle]
12848 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12849         o.result_ok
12850 }
12851 #[no_mangle]
12852 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12853 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12854 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12855         fn drop(&mut self) {
12856                 if self.result_ok {
12857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12859                         }
12860                 } else {
12861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12863                         }
12864                 }
12865         }
12866 }
12867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12869                 let contents = if o.result_ok {
12870                         let result = unsafe { o.contents.result };
12871                         unsafe { o.contents.result = core::ptr::null_mut() };
12872                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12873                 } else {
12874                         let err = unsafe { o.contents.err };
12875                         unsafe { o.contents.err = core::ptr::null_mut(); }
12876                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12877                 };
12878                 Self {
12879                         contents,
12880                         result_ok: o.result_ok,
12881                 }
12882         }
12883 }
12884 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12885         fn clone(&self) -> Self {
12886                 if self.result_ok {
12887                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12888                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12889                         } }
12890                 } else {
12891                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12893                         } }
12894                 }
12895         }
12896 }
12897 #[no_mangle]
12898 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12899 /// but with all dynamically-allocated buffers duplicated in new buffers.
12900 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12901 #[repr(C)]
12902 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12903 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12904         /// A pointer to the contents in the success state.
12905         /// Reading from this pointer when `result_ok` is not set is undefined.
12906         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12907         /// A pointer to the contents in the error state.
12908         /// Reading from this pointer when `result_ok` is set is undefined.
12909         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12910 }
12911 #[repr(C)]
12912 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12913 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12915 pub struct CResult_CommitmentSignedDecodeErrorZ {
12916         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12917         /// `err` or `result` depending on the state of `result_ok`.
12918         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12919         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12920         pub result_ok: bool,
12921 }
12922 #[no_mangle]
12923 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12924 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12925         CResult_CommitmentSignedDecodeErrorZ {
12926                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12927                         result: Box::into_raw(Box::new(o)),
12928                 },
12929                 result_ok: true,
12930         }
12931 }
12932 #[no_mangle]
12933 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12934 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12935         CResult_CommitmentSignedDecodeErrorZ {
12936                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12937                         err: Box::into_raw(Box::new(e)),
12938                 },
12939                 result_ok: false,
12940         }
12941 }
12942 /// Checks if the given object is currently in the success state
12943 #[no_mangle]
12944 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12945         o.result_ok
12946 }
12947 #[no_mangle]
12948 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12949 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12950 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12951         fn drop(&mut self) {
12952                 if self.result_ok {
12953                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12954                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12955                         }
12956                 } else {
12957                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12958                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12959                         }
12960                 }
12961         }
12962 }
12963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12964         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12965                 let contents = if o.result_ok {
12966                         let result = unsafe { o.contents.result };
12967                         unsafe { o.contents.result = core::ptr::null_mut() };
12968                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12969                 } else {
12970                         let err = unsafe { o.contents.err };
12971                         unsafe { o.contents.err = core::ptr::null_mut(); }
12972                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12973                 };
12974                 Self {
12975                         contents,
12976                         result_ok: o.result_ok,
12977                 }
12978         }
12979 }
12980 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12981         fn clone(&self) -> Self {
12982                 if self.result_ok {
12983                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12984                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12985                         } }
12986                 } else {
12987                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12988                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12989                         } }
12990                 }
12991         }
12992 }
12993 #[no_mangle]
12994 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12995 /// but with all dynamically-allocated buffers duplicated in new buffers.
12996 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12997 #[repr(C)]
12998 /// The contents of CResult_FundingCreatedDecodeErrorZ
12999 pub union CResult_FundingCreatedDecodeErrorZPtr {
13000         /// A pointer to the contents in the success state.
13001         /// Reading from this pointer when `result_ok` is not set is undefined.
13002         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13003         /// A pointer to the contents in the error state.
13004         /// Reading from this pointer when `result_ok` is set is undefined.
13005         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13006 }
13007 #[repr(C)]
13008 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13009 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13011 pub struct CResult_FundingCreatedDecodeErrorZ {
13012         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13013         /// `err` or `result` depending on the state of `result_ok`.
13014         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13015         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13016         pub result_ok: bool,
13017 }
13018 #[no_mangle]
13019 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13020 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13021         CResult_FundingCreatedDecodeErrorZ {
13022                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13023                         result: Box::into_raw(Box::new(o)),
13024                 },
13025                 result_ok: true,
13026         }
13027 }
13028 #[no_mangle]
13029 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13030 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13031         CResult_FundingCreatedDecodeErrorZ {
13032                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13033                         err: Box::into_raw(Box::new(e)),
13034                 },
13035                 result_ok: false,
13036         }
13037 }
13038 /// Checks if the given object is currently in the success state
13039 #[no_mangle]
13040 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13041         o.result_ok
13042 }
13043 #[no_mangle]
13044 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13045 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13046 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13047         fn drop(&mut self) {
13048                 if self.result_ok {
13049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13051                         }
13052                 } else {
13053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13055                         }
13056                 }
13057         }
13058 }
13059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13061                 let contents = if o.result_ok {
13062                         let result = unsafe { o.contents.result };
13063                         unsafe { o.contents.result = core::ptr::null_mut() };
13064                         CResult_FundingCreatedDecodeErrorZPtr { result }
13065                 } else {
13066                         let err = unsafe { o.contents.err };
13067                         unsafe { o.contents.err = core::ptr::null_mut(); }
13068                         CResult_FundingCreatedDecodeErrorZPtr { err }
13069                 };
13070                 Self {
13071                         contents,
13072                         result_ok: o.result_ok,
13073                 }
13074         }
13075 }
13076 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13077         fn clone(&self) -> Self {
13078                 if self.result_ok {
13079                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13080                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13081                         } }
13082                 } else {
13083                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13085                         } }
13086                 }
13087         }
13088 }
13089 #[no_mangle]
13090 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13091 /// but with all dynamically-allocated buffers duplicated in new buffers.
13092 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13093 #[repr(C)]
13094 /// The contents of CResult_FundingSignedDecodeErrorZ
13095 pub union CResult_FundingSignedDecodeErrorZPtr {
13096         /// A pointer to the contents in the success state.
13097         /// Reading from this pointer when `result_ok` is not set is undefined.
13098         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13099         /// A pointer to the contents in the error state.
13100         /// Reading from this pointer when `result_ok` is set is undefined.
13101         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13102 }
13103 #[repr(C)]
13104 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13105 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13107 pub struct CResult_FundingSignedDecodeErrorZ {
13108         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13109         /// `err` or `result` depending on the state of `result_ok`.
13110         pub contents: CResult_FundingSignedDecodeErrorZPtr,
13111         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13112         pub result_ok: bool,
13113 }
13114 #[no_mangle]
13115 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13116 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13117         CResult_FundingSignedDecodeErrorZ {
13118                 contents: CResult_FundingSignedDecodeErrorZPtr {
13119                         result: Box::into_raw(Box::new(o)),
13120                 },
13121                 result_ok: true,
13122         }
13123 }
13124 #[no_mangle]
13125 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13126 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13127         CResult_FundingSignedDecodeErrorZ {
13128                 contents: CResult_FundingSignedDecodeErrorZPtr {
13129                         err: Box::into_raw(Box::new(e)),
13130                 },
13131                 result_ok: false,
13132         }
13133 }
13134 /// Checks if the given object is currently in the success state
13135 #[no_mangle]
13136 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13137         o.result_ok
13138 }
13139 #[no_mangle]
13140 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13141 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13142 impl Drop for CResult_FundingSignedDecodeErrorZ {
13143         fn drop(&mut self) {
13144                 if self.result_ok {
13145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13147                         }
13148                 } else {
13149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13151                         }
13152                 }
13153         }
13154 }
13155 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13156         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13157                 let contents = if o.result_ok {
13158                         let result = unsafe { o.contents.result };
13159                         unsafe { o.contents.result = core::ptr::null_mut() };
13160                         CResult_FundingSignedDecodeErrorZPtr { result }
13161                 } else {
13162                         let err = unsafe { o.contents.err };
13163                         unsafe { o.contents.err = core::ptr::null_mut(); }
13164                         CResult_FundingSignedDecodeErrorZPtr { err }
13165                 };
13166                 Self {
13167                         contents,
13168                         result_ok: o.result_ok,
13169                 }
13170         }
13171 }
13172 impl Clone for CResult_FundingSignedDecodeErrorZ {
13173         fn clone(&self) -> Self {
13174                 if self.result_ok {
13175                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13176                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13177                         } }
13178                 } else {
13179                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13180                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13181                         } }
13182                 }
13183         }
13184 }
13185 #[no_mangle]
13186 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13187 /// but with all dynamically-allocated buffers duplicated in new buffers.
13188 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13189 #[repr(C)]
13190 /// The contents of CResult_ChannelReadyDecodeErrorZ
13191 pub union CResult_ChannelReadyDecodeErrorZPtr {
13192         /// A pointer to the contents in the success state.
13193         /// Reading from this pointer when `result_ok` is not set is undefined.
13194         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13195         /// A pointer to the contents in the error state.
13196         /// Reading from this pointer when `result_ok` is set is undefined.
13197         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13198 }
13199 #[repr(C)]
13200 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13201 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13203 pub struct CResult_ChannelReadyDecodeErrorZ {
13204         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13205         /// `err` or `result` depending on the state of `result_ok`.
13206         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13207         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13208         pub result_ok: bool,
13209 }
13210 #[no_mangle]
13211 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13212 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13213         CResult_ChannelReadyDecodeErrorZ {
13214                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13215                         result: Box::into_raw(Box::new(o)),
13216                 },
13217                 result_ok: true,
13218         }
13219 }
13220 #[no_mangle]
13221 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13222 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13223         CResult_ChannelReadyDecodeErrorZ {
13224                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13225                         err: Box::into_raw(Box::new(e)),
13226                 },
13227                 result_ok: false,
13228         }
13229 }
13230 /// Checks if the given object is currently in the success state
13231 #[no_mangle]
13232 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13233         o.result_ok
13234 }
13235 #[no_mangle]
13236 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13237 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13238 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13239         fn drop(&mut self) {
13240                 if self.result_ok {
13241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13243                         }
13244                 } else {
13245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13247                         }
13248                 }
13249         }
13250 }
13251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13252         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13253                 let contents = if o.result_ok {
13254                         let result = unsafe { o.contents.result };
13255                         unsafe { o.contents.result = core::ptr::null_mut() };
13256                         CResult_ChannelReadyDecodeErrorZPtr { result }
13257                 } else {
13258                         let err = unsafe { o.contents.err };
13259                         unsafe { o.contents.err = core::ptr::null_mut(); }
13260                         CResult_ChannelReadyDecodeErrorZPtr { err }
13261                 };
13262                 Self {
13263                         contents,
13264                         result_ok: o.result_ok,
13265                 }
13266         }
13267 }
13268 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13269         fn clone(&self) -> Self {
13270                 if self.result_ok {
13271                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13272                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13273                         } }
13274                 } else {
13275                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13276                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13277                         } }
13278                 }
13279         }
13280 }
13281 #[no_mangle]
13282 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13283 /// but with all dynamically-allocated buffers duplicated in new buffers.
13284 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13285 #[repr(C)]
13286 /// The contents of CResult_InitDecodeErrorZ
13287 pub union CResult_InitDecodeErrorZPtr {
13288         /// A pointer to the contents in the success state.
13289         /// Reading from this pointer when `result_ok` is not set is undefined.
13290         pub result: *mut crate::lightning::ln::msgs::Init,
13291         /// A pointer to the contents in the error state.
13292         /// Reading from this pointer when `result_ok` is set is undefined.
13293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13294 }
13295 #[repr(C)]
13296 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13297 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13299 pub struct CResult_InitDecodeErrorZ {
13300         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13301         /// `err` or `result` depending on the state of `result_ok`.
13302         pub contents: CResult_InitDecodeErrorZPtr,
13303         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13304         pub result_ok: bool,
13305 }
13306 #[no_mangle]
13307 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13308 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13309         CResult_InitDecodeErrorZ {
13310                 contents: CResult_InitDecodeErrorZPtr {
13311                         result: Box::into_raw(Box::new(o)),
13312                 },
13313                 result_ok: true,
13314         }
13315 }
13316 #[no_mangle]
13317 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13318 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13319         CResult_InitDecodeErrorZ {
13320                 contents: CResult_InitDecodeErrorZPtr {
13321                         err: Box::into_raw(Box::new(e)),
13322                 },
13323                 result_ok: false,
13324         }
13325 }
13326 /// Checks if the given object is currently in the success state
13327 #[no_mangle]
13328 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13329         o.result_ok
13330 }
13331 #[no_mangle]
13332 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13333 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13334 impl Drop for CResult_InitDecodeErrorZ {
13335         fn drop(&mut self) {
13336                 if self.result_ok {
13337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13339                         }
13340                 } else {
13341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13343                         }
13344                 }
13345         }
13346 }
13347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13349                 let contents = if o.result_ok {
13350                         let result = unsafe { o.contents.result };
13351                         unsafe { o.contents.result = core::ptr::null_mut() };
13352                         CResult_InitDecodeErrorZPtr { result }
13353                 } else {
13354                         let err = unsafe { o.contents.err };
13355                         unsafe { o.contents.err = core::ptr::null_mut(); }
13356                         CResult_InitDecodeErrorZPtr { err }
13357                 };
13358                 Self {
13359                         contents,
13360                         result_ok: o.result_ok,
13361                 }
13362         }
13363 }
13364 impl Clone for CResult_InitDecodeErrorZ {
13365         fn clone(&self) -> Self {
13366                 if self.result_ok {
13367                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13368                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13369                         } }
13370                 } else {
13371                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13373                         } }
13374                 }
13375         }
13376 }
13377 #[no_mangle]
13378 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13379 /// but with all dynamically-allocated buffers duplicated in new buffers.
13380 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13381 #[repr(C)]
13382 /// The contents of CResult_OpenChannelDecodeErrorZ
13383 pub union CResult_OpenChannelDecodeErrorZPtr {
13384         /// A pointer to the contents in the success state.
13385         /// Reading from this pointer when `result_ok` is not set is undefined.
13386         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13387         /// A pointer to the contents in the error state.
13388         /// Reading from this pointer when `result_ok` is set is undefined.
13389         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13390 }
13391 #[repr(C)]
13392 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13393 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13395 pub struct CResult_OpenChannelDecodeErrorZ {
13396         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13397         /// `err` or `result` depending on the state of `result_ok`.
13398         pub contents: CResult_OpenChannelDecodeErrorZPtr,
13399         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13400         pub result_ok: bool,
13401 }
13402 #[no_mangle]
13403 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13404 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13405         CResult_OpenChannelDecodeErrorZ {
13406                 contents: CResult_OpenChannelDecodeErrorZPtr {
13407                         result: Box::into_raw(Box::new(o)),
13408                 },
13409                 result_ok: true,
13410         }
13411 }
13412 #[no_mangle]
13413 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13414 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13415         CResult_OpenChannelDecodeErrorZ {
13416                 contents: CResult_OpenChannelDecodeErrorZPtr {
13417                         err: Box::into_raw(Box::new(e)),
13418                 },
13419                 result_ok: false,
13420         }
13421 }
13422 /// Checks if the given object is currently in the success state
13423 #[no_mangle]
13424 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13425         o.result_ok
13426 }
13427 #[no_mangle]
13428 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13429 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13430 impl Drop for CResult_OpenChannelDecodeErrorZ {
13431         fn drop(&mut self) {
13432                 if self.result_ok {
13433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13435                         }
13436                 } else {
13437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13439                         }
13440                 }
13441         }
13442 }
13443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13445                 let contents = if o.result_ok {
13446                         let result = unsafe { o.contents.result };
13447                         unsafe { o.contents.result = core::ptr::null_mut() };
13448                         CResult_OpenChannelDecodeErrorZPtr { result }
13449                 } else {
13450                         let err = unsafe { o.contents.err };
13451                         unsafe { o.contents.err = core::ptr::null_mut(); }
13452                         CResult_OpenChannelDecodeErrorZPtr { err }
13453                 };
13454                 Self {
13455                         contents,
13456                         result_ok: o.result_ok,
13457                 }
13458         }
13459 }
13460 impl Clone for CResult_OpenChannelDecodeErrorZ {
13461         fn clone(&self) -> Self {
13462                 if self.result_ok {
13463                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13464                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13465                         } }
13466                 } else {
13467                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13468                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13469                         } }
13470                 }
13471         }
13472 }
13473 #[no_mangle]
13474 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13475 /// but with all dynamically-allocated buffers duplicated in new buffers.
13476 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13477 #[repr(C)]
13478 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13479 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13480         /// A pointer to the contents in the success state.
13481         /// Reading from this pointer when `result_ok` is not set is undefined.
13482         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13483         /// A pointer to the contents in the error state.
13484         /// Reading from this pointer when `result_ok` is set is undefined.
13485         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13486 }
13487 #[repr(C)]
13488 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13489 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13491 pub struct CResult_RevokeAndACKDecodeErrorZ {
13492         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13493         /// `err` or `result` depending on the state of `result_ok`.
13494         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13495         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13496         pub result_ok: bool,
13497 }
13498 #[no_mangle]
13499 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13500 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13501         CResult_RevokeAndACKDecodeErrorZ {
13502                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13503                         result: Box::into_raw(Box::new(o)),
13504                 },
13505                 result_ok: true,
13506         }
13507 }
13508 #[no_mangle]
13509 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13510 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13511         CResult_RevokeAndACKDecodeErrorZ {
13512                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13513                         err: Box::into_raw(Box::new(e)),
13514                 },
13515                 result_ok: false,
13516         }
13517 }
13518 /// Checks if the given object is currently in the success state
13519 #[no_mangle]
13520 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13521         o.result_ok
13522 }
13523 #[no_mangle]
13524 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13525 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13526 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13527         fn drop(&mut self) {
13528                 if self.result_ok {
13529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13531                         }
13532                 } else {
13533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13535                         }
13536                 }
13537         }
13538 }
13539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13540         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13541                 let contents = if o.result_ok {
13542                         let result = unsafe { o.contents.result };
13543                         unsafe { o.contents.result = core::ptr::null_mut() };
13544                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13545                 } else {
13546                         let err = unsafe { o.contents.err };
13547                         unsafe { o.contents.err = core::ptr::null_mut(); }
13548                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13549                 };
13550                 Self {
13551                         contents,
13552                         result_ok: o.result_ok,
13553                 }
13554         }
13555 }
13556 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13557         fn clone(&self) -> Self {
13558                 if self.result_ok {
13559                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13560                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13561                         } }
13562                 } else {
13563                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13564                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13565                         } }
13566                 }
13567         }
13568 }
13569 #[no_mangle]
13570 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13571 /// but with all dynamically-allocated buffers duplicated in new buffers.
13572 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13573 #[repr(C)]
13574 /// The contents of CResult_ShutdownDecodeErrorZ
13575 pub union CResult_ShutdownDecodeErrorZPtr {
13576         /// A pointer to the contents in the success state.
13577         /// Reading from this pointer when `result_ok` is not set is undefined.
13578         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13579         /// A pointer to the contents in the error state.
13580         /// Reading from this pointer when `result_ok` is set is undefined.
13581         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13582 }
13583 #[repr(C)]
13584 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13585 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13587 pub struct CResult_ShutdownDecodeErrorZ {
13588         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13589         /// `err` or `result` depending on the state of `result_ok`.
13590         pub contents: CResult_ShutdownDecodeErrorZPtr,
13591         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13592         pub result_ok: bool,
13593 }
13594 #[no_mangle]
13595 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13596 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13597         CResult_ShutdownDecodeErrorZ {
13598                 contents: CResult_ShutdownDecodeErrorZPtr {
13599                         result: Box::into_raw(Box::new(o)),
13600                 },
13601                 result_ok: true,
13602         }
13603 }
13604 #[no_mangle]
13605 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13606 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13607         CResult_ShutdownDecodeErrorZ {
13608                 contents: CResult_ShutdownDecodeErrorZPtr {
13609                         err: Box::into_raw(Box::new(e)),
13610                 },
13611                 result_ok: false,
13612         }
13613 }
13614 /// Checks if the given object is currently in the success state
13615 #[no_mangle]
13616 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13617         o.result_ok
13618 }
13619 #[no_mangle]
13620 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13621 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13622 impl Drop for CResult_ShutdownDecodeErrorZ {
13623         fn drop(&mut self) {
13624                 if self.result_ok {
13625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13627                         }
13628                 } else {
13629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13631                         }
13632                 }
13633         }
13634 }
13635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13637                 let contents = if o.result_ok {
13638                         let result = unsafe { o.contents.result };
13639                         unsafe { o.contents.result = core::ptr::null_mut() };
13640                         CResult_ShutdownDecodeErrorZPtr { result }
13641                 } else {
13642                         let err = unsafe { o.contents.err };
13643                         unsafe { o.contents.err = core::ptr::null_mut(); }
13644                         CResult_ShutdownDecodeErrorZPtr { err }
13645                 };
13646                 Self {
13647                         contents,
13648                         result_ok: o.result_ok,
13649                 }
13650         }
13651 }
13652 impl Clone for CResult_ShutdownDecodeErrorZ {
13653         fn clone(&self) -> Self {
13654                 if self.result_ok {
13655                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13656                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13657                         } }
13658                 } else {
13659                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13661                         } }
13662                 }
13663         }
13664 }
13665 #[no_mangle]
13666 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13667 /// but with all dynamically-allocated buffers duplicated in new buffers.
13668 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13669 #[repr(C)]
13670 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13671 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13672         /// A pointer to the contents in the success state.
13673         /// Reading from this pointer when `result_ok` is not set is undefined.
13674         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13675         /// A pointer to the contents in the error state.
13676         /// Reading from this pointer when `result_ok` is set is undefined.
13677         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13678 }
13679 #[repr(C)]
13680 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13681 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13683 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13684         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13685         /// `err` or `result` depending on the state of `result_ok`.
13686         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13687         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13688         pub result_ok: bool,
13689 }
13690 #[no_mangle]
13691 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13692 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13693         CResult_UpdateFailHTLCDecodeErrorZ {
13694                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13695                         result: Box::into_raw(Box::new(o)),
13696                 },
13697                 result_ok: true,
13698         }
13699 }
13700 #[no_mangle]
13701 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13702 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13703         CResult_UpdateFailHTLCDecodeErrorZ {
13704                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13705                         err: Box::into_raw(Box::new(e)),
13706                 },
13707                 result_ok: false,
13708         }
13709 }
13710 /// Checks if the given object is currently in the success state
13711 #[no_mangle]
13712 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13713         o.result_ok
13714 }
13715 #[no_mangle]
13716 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13717 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13718 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13719         fn drop(&mut self) {
13720                 if self.result_ok {
13721                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13722                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13723                         }
13724                 } else {
13725                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13726                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13727                         }
13728                 }
13729         }
13730 }
13731 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13732         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13733                 let contents = if o.result_ok {
13734                         let result = unsafe { o.contents.result };
13735                         unsafe { o.contents.result = core::ptr::null_mut() };
13736                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13737                 } else {
13738                         let err = unsafe { o.contents.err };
13739                         unsafe { o.contents.err = core::ptr::null_mut(); }
13740                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13741                 };
13742                 Self {
13743                         contents,
13744                         result_ok: o.result_ok,
13745                 }
13746         }
13747 }
13748 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13749         fn clone(&self) -> Self {
13750                 if self.result_ok {
13751                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13752                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13753                         } }
13754                 } else {
13755                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13756                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13757                         } }
13758                 }
13759         }
13760 }
13761 #[no_mangle]
13762 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13763 /// but with all dynamically-allocated buffers duplicated in new buffers.
13764 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13765 #[repr(C)]
13766 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13767 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13768         /// A pointer to the contents in the success state.
13769         /// Reading from this pointer when `result_ok` is not set is undefined.
13770         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13771         /// A pointer to the contents in the error state.
13772         /// Reading from this pointer when `result_ok` is set is undefined.
13773         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13774 }
13775 #[repr(C)]
13776 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13777 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13779 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13780         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13781         /// `err` or `result` depending on the state of `result_ok`.
13782         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13783         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13784         pub result_ok: bool,
13785 }
13786 #[no_mangle]
13787 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13788 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13789         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13790                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13791                         result: Box::into_raw(Box::new(o)),
13792                 },
13793                 result_ok: true,
13794         }
13795 }
13796 #[no_mangle]
13797 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13798 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13799         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13800                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13801                         err: Box::into_raw(Box::new(e)),
13802                 },
13803                 result_ok: false,
13804         }
13805 }
13806 /// Checks if the given object is currently in the success state
13807 #[no_mangle]
13808 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13809         o.result_ok
13810 }
13811 #[no_mangle]
13812 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13813 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13814 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13815         fn drop(&mut self) {
13816                 if self.result_ok {
13817                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13818                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13819                         }
13820                 } else {
13821                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13822                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13823                         }
13824                 }
13825         }
13826 }
13827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13828         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13829                 let contents = if o.result_ok {
13830                         let result = unsafe { o.contents.result };
13831                         unsafe { o.contents.result = core::ptr::null_mut() };
13832                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13833                 } else {
13834                         let err = unsafe { o.contents.err };
13835                         unsafe { o.contents.err = core::ptr::null_mut(); }
13836                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13837                 };
13838                 Self {
13839                         contents,
13840                         result_ok: o.result_ok,
13841                 }
13842         }
13843 }
13844 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13845         fn clone(&self) -> Self {
13846                 if self.result_ok {
13847                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13848                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13849                         } }
13850                 } else {
13851                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13852                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13853                         } }
13854                 }
13855         }
13856 }
13857 #[no_mangle]
13858 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13859 /// but with all dynamically-allocated buffers duplicated in new buffers.
13860 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13861 #[repr(C)]
13862 /// The contents of CResult_UpdateFeeDecodeErrorZ
13863 pub union CResult_UpdateFeeDecodeErrorZPtr {
13864         /// A pointer to the contents in the success state.
13865         /// Reading from this pointer when `result_ok` is not set is undefined.
13866         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13867         /// A pointer to the contents in the error state.
13868         /// Reading from this pointer when `result_ok` is set is undefined.
13869         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13870 }
13871 #[repr(C)]
13872 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13873 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13875 pub struct CResult_UpdateFeeDecodeErrorZ {
13876         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13877         /// `err` or `result` depending on the state of `result_ok`.
13878         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13879         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13880         pub result_ok: bool,
13881 }
13882 #[no_mangle]
13883 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13884 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13885         CResult_UpdateFeeDecodeErrorZ {
13886                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13887                         result: Box::into_raw(Box::new(o)),
13888                 },
13889                 result_ok: true,
13890         }
13891 }
13892 #[no_mangle]
13893 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13894 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13895         CResult_UpdateFeeDecodeErrorZ {
13896                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13897                         err: Box::into_raw(Box::new(e)),
13898                 },
13899                 result_ok: false,
13900         }
13901 }
13902 /// Checks if the given object is currently in the success state
13903 #[no_mangle]
13904 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13905         o.result_ok
13906 }
13907 #[no_mangle]
13908 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13909 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13910 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13911         fn drop(&mut self) {
13912                 if self.result_ok {
13913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13915                         }
13916                 } else {
13917                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13918                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13919                         }
13920                 }
13921         }
13922 }
13923 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13924         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13925                 let contents = if o.result_ok {
13926                         let result = unsafe { o.contents.result };
13927                         unsafe { o.contents.result = core::ptr::null_mut() };
13928                         CResult_UpdateFeeDecodeErrorZPtr { result }
13929                 } else {
13930                         let err = unsafe { o.contents.err };
13931                         unsafe { o.contents.err = core::ptr::null_mut(); }
13932                         CResult_UpdateFeeDecodeErrorZPtr { err }
13933                 };
13934                 Self {
13935                         contents,
13936                         result_ok: o.result_ok,
13937                 }
13938         }
13939 }
13940 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13941         fn clone(&self) -> Self {
13942                 if self.result_ok {
13943                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13944                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13945                         } }
13946                 } else {
13947                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13948                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13949                         } }
13950                 }
13951         }
13952 }
13953 #[no_mangle]
13954 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13955 /// but with all dynamically-allocated buffers duplicated in new buffers.
13956 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13957 #[repr(C)]
13958 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13959 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13960         /// A pointer to the contents in the success state.
13961         /// Reading from this pointer when `result_ok` is not set is undefined.
13962         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13963         /// A pointer to the contents in the error state.
13964         /// Reading from this pointer when `result_ok` is set is undefined.
13965         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13966 }
13967 #[repr(C)]
13968 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13969 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13971 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13972         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13973         /// `err` or `result` depending on the state of `result_ok`.
13974         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13975         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13976         pub result_ok: bool,
13977 }
13978 #[no_mangle]
13979 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13980 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13981         CResult_UpdateFulfillHTLCDecodeErrorZ {
13982                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13983                         result: Box::into_raw(Box::new(o)),
13984                 },
13985                 result_ok: true,
13986         }
13987 }
13988 #[no_mangle]
13989 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13990 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13991         CResult_UpdateFulfillHTLCDecodeErrorZ {
13992                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13993                         err: Box::into_raw(Box::new(e)),
13994                 },
13995                 result_ok: false,
13996         }
13997 }
13998 /// Checks if the given object is currently in the success state
13999 #[no_mangle]
14000 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14001         o.result_ok
14002 }
14003 #[no_mangle]
14004 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14005 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14006 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14007         fn drop(&mut self) {
14008                 if self.result_ok {
14009                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14010                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14011                         }
14012                 } else {
14013                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14014                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14015                         }
14016                 }
14017         }
14018 }
14019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14020         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14021                 let contents = if o.result_ok {
14022                         let result = unsafe { o.contents.result };
14023                         unsafe { o.contents.result = core::ptr::null_mut() };
14024                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14025                 } else {
14026                         let err = unsafe { o.contents.err };
14027                         unsafe { o.contents.err = core::ptr::null_mut(); }
14028                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14029                 };
14030                 Self {
14031                         contents,
14032                         result_ok: o.result_ok,
14033                 }
14034         }
14035 }
14036 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14037         fn clone(&self) -> Self {
14038                 if self.result_ok {
14039                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14040                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14041                         } }
14042                 } else {
14043                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14044                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14045                         } }
14046                 }
14047         }
14048 }
14049 #[no_mangle]
14050 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14051 /// but with all dynamically-allocated buffers duplicated in new buffers.
14052 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14053 #[repr(C)]
14054 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14055 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14056         /// A pointer to the contents in the success state.
14057         /// Reading from this pointer when `result_ok` is not set is undefined.
14058         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14059         /// A pointer to the contents in the error state.
14060         /// Reading from this pointer when `result_ok` is set is undefined.
14061         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14062 }
14063 #[repr(C)]
14064 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14065 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14067 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14068         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14069         /// `err` or `result` depending on the state of `result_ok`.
14070         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14071         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14072         pub result_ok: bool,
14073 }
14074 #[no_mangle]
14075 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14076 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14077         CResult_UpdateAddHTLCDecodeErrorZ {
14078                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14079                         result: Box::into_raw(Box::new(o)),
14080                 },
14081                 result_ok: true,
14082         }
14083 }
14084 #[no_mangle]
14085 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14086 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14087         CResult_UpdateAddHTLCDecodeErrorZ {
14088                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14089                         err: Box::into_raw(Box::new(e)),
14090                 },
14091                 result_ok: false,
14092         }
14093 }
14094 /// Checks if the given object is currently in the success state
14095 #[no_mangle]
14096 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14097         o.result_ok
14098 }
14099 #[no_mangle]
14100 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14101 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14102 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14103         fn drop(&mut self) {
14104                 if self.result_ok {
14105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14107                         }
14108                 } else {
14109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14111                         }
14112                 }
14113         }
14114 }
14115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14117                 let contents = if o.result_ok {
14118                         let result = unsafe { o.contents.result };
14119                         unsafe { o.contents.result = core::ptr::null_mut() };
14120                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14121                 } else {
14122                         let err = unsafe { o.contents.err };
14123                         unsafe { o.contents.err = core::ptr::null_mut(); }
14124                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14125                 };
14126                 Self {
14127                         contents,
14128                         result_ok: o.result_ok,
14129                 }
14130         }
14131 }
14132 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14133         fn clone(&self) -> Self {
14134                 if self.result_ok {
14135                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14137                         } }
14138                 } else {
14139                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14141                         } }
14142                 }
14143         }
14144 }
14145 #[no_mangle]
14146 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14147 /// but with all dynamically-allocated buffers duplicated in new buffers.
14148 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14149 #[repr(C)]
14150 /// The contents of CResult_PingDecodeErrorZ
14151 pub union CResult_PingDecodeErrorZPtr {
14152         /// A pointer to the contents in the success state.
14153         /// Reading from this pointer when `result_ok` is not set is undefined.
14154         pub result: *mut crate::lightning::ln::msgs::Ping,
14155         /// A pointer to the contents in the error state.
14156         /// Reading from this pointer when `result_ok` is set is undefined.
14157         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14158 }
14159 #[repr(C)]
14160 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14161 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14162 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14163 pub struct CResult_PingDecodeErrorZ {
14164         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14165         /// `err` or `result` depending on the state of `result_ok`.
14166         pub contents: CResult_PingDecodeErrorZPtr,
14167         /// Whether this CResult_PingDecodeErrorZ represents a success state.
14168         pub result_ok: bool,
14169 }
14170 #[no_mangle]
14171 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14172 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14173         CResult_PingDecodeErrorZ {
14174                 contents: CResult_PingDecodeErrorZPtr {
14175                         result: Box::into_raw(Box::new(o)),
14176                 },
14177                 result_ok: true,
14178         }
14179 }
14180 #[no_mangle]
14181 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14182 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14183         CResult_PingDecodeErrorZ {
14184                 contents: CResult_PingDecodeErrorZPtr {
14185                         err: Box::into_raw(Box::new(e)),
14186                 },
14187                 result_ok: false,
14188         }
14189 }
14190 /// Checks if the given object is currently in the success state
14191 #[no_mangle]
14192 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14193         o.result_ok
14194 }
14195 #[no_mangle]
14196 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14197 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14198 impl Drop for CResult_PingDecodeErrorZ {
14199         fn drop(&mut self) {
14200                 if self.result_ok {
14201                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14202                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14203                         }
14204                 } else {
14205                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14206                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14207                         }
14208                 }
14209         }
14210 }
14211 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14212         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14213                 let contents = if o.result_ok {
14214                         let result = unsafe { o.contents.result };
14215                         unsafe { o.contents.result = core::ptr::null_mut() };
14216                         CResult_PingDecodeErrorZPtr { result }
14217                 } else {
14218                         let err = unsafe { o.contents.err };
14219                         unsafe { o.contents.err = core::ptr::null_mut(); }
14220                         CResult_PingDecodeErrorZPtr { err }
14221                 };
14222                 Self {
14223                         contents,
14224                         result_ok: o.result_ok,
14225                 }
14226         }
14227 }
14228 impl Clone for CResult_PingDecodeErrorZ {
14229         fn clone(&self) -> Self {
14230                 if self.result_ok {
14231                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14232                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14233                         } }
14234                 } else {
14235                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14236                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14237                         } }
14238                 }
14239         }
14240 }
14241 #[no_mangle]
14242 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14243 /// but with all dynamically-allocated buffers duplicated in new buffers.
14244 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14245 #[repr(C)]
14246 /// The contents of CResult_PongDecodeErrorZ
14247 pub union CResult_PongDecodeErrorZPtr {
14248         /// A pointer to the contents in the success state.
14249         /// Reading from this pointer when `result_ok` is not set is undefined.
14250         pub result: *mut crate::lightning::ln::msgs::Pong,
14251         /// A pointer to the contents in the error state.
14252         /// Reading from this pointer when `result_ok` is set is undefined.
14253         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14254 }
14255 #[repr(C)]
14256 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14257 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14258 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14259 pub struct CResult_PongDecodeErrorZ {
14260         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14261         /// `err` or `result` depending on the state of `result_ok`.
14262         pub contents: CResult_PongDecodeErrorZPtr,
14263         /// Whether this CResult_PongDecodeErrorZ represents a success state.
14264         pub result_ok: bool,
14265 }
14266 #[no_mangle]
14267 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14268 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14269         CResult_PongDecodeErrorZ {
14270                 contents: CResult_PongDecodeErrorZPtr {
14271                         result: Box::into_raw(Box::new(o)),
14272                 },
14273                 result_ok: true,
14274         }
14275 }
14276 #[no_mangle]
14277 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14278 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14279         CResult_PongDecodeErrorZ {
14280                 contents: CResult_PongDecodeErrorZPtr {
14281                         err: Box::into_raw(Box::new(e)),
14282                 },
14283                 result_ok: false,
14284         }
14285 }
14286 /// Checks if the given object is currently in the success state
14287 #[no_mangle]
14288 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14289         o.result_ok
14290 }
14291 #[no_mangle]
14292 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14293 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14294 impl Drop for CResult_PongDecodeErrorZ {
14295         fn drop(&mut self) {
14296                 if self.result_ok {
14297                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14298                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14299                         }
14300                 } else {
14301                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14302                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14303                         }
14304                 }
14305         }
14306 }
14307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14308         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14309                 let contents = if o.result_ok {
14310                         let result = unsafe { o.contents.result };
14311                         unsafe { o.contents.result = core::ptr::null_mut() };
14312                         CResult_PongDecodeErrorZPtr { result }
14313                 } else {
14314                         let err = unsafe { o.contents.err };
14315                         unsafe { o.contents.err = core::ptr::null_mut(); }
14316                         CResult_PongDecodeErrorZPtr { err }
14317                 };
14318                 Self {
14319                         contents,
14320                         result_ok: o.result_ok,
14321                 }
14322         }
14323 }
14324 impl Clone for CResult_PongDecodeErrorZ {
14325         fn clone(&self) -> Self {
14326                 if self.result_ok {
14327                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14328                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14329                         } }
14330                 } else {
14331                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14332                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14333                         } }
14334                 }
14335         }
14336 }
14337 #[no_mangle]
14338 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14339 /// but with all dynamically-allocated buffers duplicated in new buffers.
14340 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14341 #[repr(C)]
14342 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14343 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14344         /// A pointer to the contents in the success state.
14345         /// Reading from this pointer when `result_ok` is not set is undefined.
14346         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14347         /// A pointer to the contents in the error state.
14348         /// Reading from this pointer when `result_ok` is set is undefined.
14349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14350 }
14351 #[repr(C)]
14352 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14353 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14355 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14356         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14357         /// `err` or `result` depending on the state of `result_ok`.
14358         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14359         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14360         pub result_ok: bool,
14361 }
14362 #[no_mangle]
14363 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14364 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14365         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14366                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14367                         result: Box::into_raw(Box::new(o)),
14368                 },
14369                 result_ok: true,
14370         }
14371 }
14372 #[no_mangle]
14373 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14374 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14375         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14376                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14377                         err: Box::into_raw(Box::new(e)),
14378                 },
14379                 result_ok: false,
14380         }
14381 }
14382 /// Checks if the given object is currently in the success state
14383 #[no_mangle]
14384 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14385         o.result_ok
14386 }
14387 #[no_mangle]
14388 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14389 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14390 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14391         fn drop(&mut self) {
14392                 if self.result_ok {
14393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14395                         }
14396                 } else {
14397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14399                         }
14400                 }
14401         }
14402 }
14403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14405                 let contents = if o.result_ok {
14406                         let result = unsafe { o.contents.result };
14407                         unsafe { o.contents.result = core::ptr::null_mut() };
14408                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14409                 } else {
14410                         let err = unsafe { o.contents.err };
14411                         unsafe { o.contents.err = core::ptr::null_mut(); }
14412                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14413                 };
14414                 Self {
14415                         contents,
14416                         result_ok: o.result_ok,
14417                 }
14418         }
14419 }
14420 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14421         fn clone(&self) -> Self {
14422                 if self.result_ok {
14423                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14425                         } }
14426                 } else {
14427                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14429                         } }
14430                 }
14431         }
14432 }
14433 #[no_mangle]
14434 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14435 /// but with all dynamically-allocated buffers duplicated in new buffers.
14436 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14437 #[repr(C)]
14438 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14439 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14440         /// A pointer to the contents in the success state.
14441         /// Reading from this pointer when `result_ok` is not set is undefined.
14442         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14443         /// A pointer to the contents in the error state.
14444         /// Reading from this pointer when `result_ok` is set is undefined.
14445         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14446 }
14447 #[repr(C)]
14448 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14449 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14450 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14451 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14452         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14453         /// `err` or `result` depending on the state of `result_ok`.
14454         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14455         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14456         pub result_ok: bool,
14457 }
14458 #[no_mangle]
14459 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14460 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14461         CResult_ChannelAnnouncementDecodeErrorZ {
14462                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14463                         result: Box::into_raw(Box::new(o)),
14464                 },
14465                 result_ok: true,
14466         }
14467 }
14468 #[no_mangle]
14469 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14470 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14471         CResult_ChannelAnnouncementDecodeErrorZ {
14472                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14473                         err: Box::into_raw(Box::new(e)),
14474                 },
14475                 result_ok: false,
14476         }
14477 }
14478 /// Checks if the given object is currently in the success state
14479 #[no_mangle]
14480 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14481         o.result_ok
14482 }
14483 #[no_mangle]
14484 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14485 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14486 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14487         fn drop(&mut self) {
14488                 if self.result_ok {
14489                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14490                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14491                         }
14492                 } else {
14493                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14494                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14495                         }
14496                 }
14497         }
14498 }
14499 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14500         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14501                 let contents = if o.result_ok {
14502                         let result = unsafe { o.contents.result };
14503                         unsafe { o.contents.result = core::ptr::null_mut() };
14504                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14505                 } else {
14506                         let err = unsafe { o.contents.err };
14507                         unsafe { o.contents.err = core::ptr::null_mut(); }
14508                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14509                 };
14510                 Self {
14511                         contents,
14512                         result_ok: o.result_ok,
14513                 }
14514         }
14515 }
14516 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14517         fn clone(&self) -> Self {
14518                 if self.result_ok {
14519                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14520                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14521                         } }
14522                 } else {
14523                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14524                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14525                         } }
14526                 }
14527         }
14528 }
14529 #[no_mangle]
14530 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14531 /// but with all dynamically-allocated buffers duplicated in new buffers.
14532 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14533 #[repr(C)]
14534 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14535 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14536         /// A pointer to the contents in the success state.
14537         /// Reading from this pointer when `result_ok` is not set is undefined.
14538         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14539         /// A pointer to the contents in the error state.
14540         /// Reading from this pointer when `result_ok` is set is undefined.
14541         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14542 }
14543 #[repr(C)]
14544 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14545 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14546 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14547 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14548         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14549         /// `err` or `result` depending on the state of `result_ok`.
14550         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14551         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14552         pub result_ok: bool,
14553 }
14554 #[no_mangle]
14555 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14556 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14557         CResult_UnsignedChannelUpdateDecodeErrorZ {
14558                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14559                         result: Box::into_raw(Box::new(o)),
14560                 },
14561                 result_ok: true,
14562         }
14563 }
14564 #[no_mangle]
14565 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14566 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14567         CResult_UnsignedChannelUpdateDecodeErrorZ {
14568                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14569                         err: Box::into_raw(Box::new(e)),
14570                 },
14571                 result_ok: false,
14572         }
14573 }
14574 /// Checks if the given object is currently in the success state
14575 #[no_mangle]
14576 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14577         o.result_ok
14578 }
14579 #[no_mangle]
14580 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14581 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14582 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14583         fn drop(&mut self) {
14584                 if self.result_ok {
14585                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14586                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14587                         }
14588                 } else {
14589                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14590                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14591                         }
14592                 }
14593         }
14594 }
14595 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14596         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14597                 let contents = if o.result_ok {
14598                         let result = unsafe { o.contents.result };
14599                         unsafe { o.contents.result = core::ptr::null_mut() };
14600                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14601                 } else {
14602                         let err = unsafe { o.contents.err };
14603                         unsafe { o.contents.err = core::ptr::null_mut(); }
14604                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14605                 };
14606                 Self {
14607                         contents,
14608                         result_ok: o.result_ok,
14609                 }
14610         }
14611 }
14612 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14613         fn clone(&self) -> Self {
14614                 if self.result_ok {
14615                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14616                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14617                         } }
14618                 } else {
14619                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14620                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14621                         } }
14622                 }
14623         }
14624 }
14625 #[no_mangle]
14626 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14627 /// but with all dynamically-allocated buffers duplicated in new buffers.
14628 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14629 #[repr(C)]
14630 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14631 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14632         /// A pointer to the contents in the success state.
14633         /// Reading from this pointer when `result_ok` is not set is undefined.
14634         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14635         /// A pointer to the contents in the error state.
14636         /// Reading from this pointer when `result_ok` is set is undefined.
14637         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14638 }
14639 #[repr(C)]
14640 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14641 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14643 pub struct CResult_ChannelUpdateDecodeErrorZ {
14644         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14645         /// `err` or `result` depending on the state of `result_ok`.
14646         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14647         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14648         pub result_ok: bool,
14649 }
14650 #[no_mangle]
14651 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14652 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14653         CResult_ChannelUpdateDecodeErrorZ {
14654                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14655                         result: Box::into_raw(Box::new(o)),
14656                 },
14657                 result_ok: true,
14658         }
14659 }
14660 #[no_mangle]
14661 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14662 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14663         CResult_ChannelUpdateDecodeErrorZ {
14664                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14665                         err: Box::into_raw(Box::new(e)),
14666                 },
14667                 result_ok: false,
14668         }
14669 }
14670 /// Checks if the given object is currently in the success state
14671 #[no_mangle]
14672 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14673         o.result_ok
14674 }
14675 #[no_mangle]
14676 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14677 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14678 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14679         fn drop(&mut self) {
14680                 if self.result_ok {
14681                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14682                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14683                         }
14684                 } else {
14685                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14686                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14687                         }
14688                 }
14689         }
14690 }
14691 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14692         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14693                 let contents = if o.result_ok {
14694                         let result = unsafe { o.contents.result };
14695                         unsafe { o.contents.result = core::ptr::null_mut() };
14696                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14697                 } else {
14698                         let err = unsafe { o.contents.err };
14699                         unsafe { o.contents.err = core::ptr::null_mut(); }
14700                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14701                 };
14702                 Self {
14703                         contents,
14704                         result_ok: o.result_ok,
14705                 }
14706         }
14707 }
14708 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14709         fn clone(&self) -> Self {
14710                 if self.result_ok {
14711                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14712                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14713                         } }
14714                 } else {
14715                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14716                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14717                         } }
14718                 }
14719         }
14720 }
14721 #[no_mangle]
14722 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14723 /// but with all dynamically-allocated buffers duplicated in new buffers.
14724 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14725 #[repr(C)]
14726 /// The contents of CResult_ErrorMessageDecodeErrorZ
14727 pub union CResult_ErrorMessageDecodeErrorZPtr {
14728         /// A pointer to the contents in the success state.
14729         /// Reading from this pointer when `result_ok` is not set is undefined.
14730         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14731         /// A pointer to the contents in the error state.
14732         /// Reading from this pointer when `result_ok` is set is undefined.
14733         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14734 }
14735 #[repr(C)]
14736 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14737 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14738 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14739 pub struct CResult_ErrorMessageDecodeErrorZ {
14740         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14741         /// `err` or `result` depending on the state of `result_ok`.
14742         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14743         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14744         pub result_ok: bool,
14745 }
14746 #[no_mangle]
14747 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14748 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14749         CResult_ErrorMessageDecodeErrorZ {
14750                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14751                         result: Box::into_raw(Box::new(o)),
14752                 },
14753                 result_ok: true,
14754         }
14755 }
14756 #[no_mangle]
14757 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14758 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14759         CResult_ErrorMessageDecodeErrorZ {
14760                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14761                         err: Box::into_raw(Box::new(e)),
14762                 },
14763                 result_ok: false,
14764         }
14765 }
14766 /// Checks if the given object is currently in the success state
14767 #[no_mangle]
14768 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14769         o.result_ok
14770 }
14771 #[no_mangle]
14772 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14773 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14774 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14775         fn drop(&mut self) {
14776                 if self.result_ok {
14777                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14778                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14779                         }
14780                 } else {
14781                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14782                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14783                         }
14784                 }
14785         }
14786 }
14787 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14788         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14789                 let contents = if o.result_ok {
14790                         let result = unsafe { o.contents.result };
14791                         unsafe { o.contents.result = core::ptr::null_mut() };
14792                         CResult_ErrorMessageDecodeErrorZPtr { result }
14793                 } else {
14794                         let err = unsafe { o.contents.err };
14795                         unsafe { o.contents.err = core::ptr::null_mut(); }
14796                         CResult_ErrorMessageDecodeErrorZPtr { err }
14797                 };
14798                 Self {
14799                         contents,
14800                         result_ok: o.result_ok,
14801                 }
14802         }
14803 }
14804 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14805         fn clone(&self) -> Self {
14806                 if self.result_ok {
14807                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14808                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14809                         } }
14810                 } else {
14811                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14812                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14813                         } }
14814                 }
14815         }
14816 }
14817 #[no_mangle]
14818 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14819 /// but with all dynamically-allocated buffers duplicated in new buffers.
14820 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14821 #[repr(C)]
14822 /// The contents of CResult_WarningMessageDecodeErrorZ
14823 pub union CResult_WarningMessageDecodeErrorZPtr {
14824         /// A pointer to the contents in the success state.
14825         /// Reading from this pointer when `result_ok` is not set is undefined.
14826         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14827         /// A pointer to the contents in the error state.
14828         /// Reading from this pointer when `result_ok` is set is undefined.
14829         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14830 }
14831 #[repr(C)]
14832 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14833 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14834 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14835 pub struct CResult_WarningMessageDecodeErrorZ {
14836         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14837         /// `err` or `result` depending on the state of `result_ok`.
14838         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14839         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14840         pub result_ok: bool,
14841 }
14842 #[no_mangle]
14843 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14844 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14845         CResult_WarningMessageDecodeErrorZ {
14846                 contents: CResult_WarningMessageDecodeErrorZPtr {
14847                         result: Box::into_raw(Box::new(o)),
14848                 },
14849                 result_ok: true,
14850         }
14851 }
14852 #[no_mangle]
14853 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14854 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14855         CResult_WarningMessageDecodeErrorZ {
14856                 contents: CResult_WarningMessageDecodeErrorZPtr {
14857                         err: Box::into_raw(Box::new(e)),
14858                 },
14859                 result_ok: false,
14860         }
14861 }
14862 /// Checks if the given object is currently in the success state
14863 #[no_mangle]
14864 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14865         o.result_ok
14866 }
14867 #[no_mangle]
14868 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14869 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14870 impl Drop for CResult_WarningMessageDecodeErrorZ {
14871         fn drop(&mut self) {
14872                 if self.result_ok {
14873                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14874                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14875                         }
14876                 } else {
14877                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14878                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14879                         }
14880                 }
14881         }
14882 }
14883 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14884         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14885                 let contents = if o.result_ok {
14886                         let result = unsafe { o.contents.result };
14887                         unsafe { o.contents.result = core::ptr::null_mut() };
14888                         CResult_WarningMessageDecodeErrorZPtr { result }
14889                 } else {
14890                         let err = unsafe { o.contents.err };
14891                         unsafe { o.contents.err = core::ptr::null_mut(); }
14892                         CResult_WarningMessageDecodeErrorZPtr { err }
14893                 };
14894                 Self {
14895                         contents,
14896                         result_ok: o.result_ok,
14897                 }
14898         }
14899 }
14900 impl Clone for CResult_WarningMessageDecodeErrorZ {
14901         fn clone(&self) -> Self {
14902                 if self.result_ok {
14903                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14904                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14905                         } }
14906                 } else {
14907                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14908                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14909                         } }
14910                 }
14911         }
14912 }
14913 #[no_mangle]
14914 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14915 /// but with all dynamically-allocated buffers duplicated in new buffers.
14916 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14917 #[repr(C)]
14918 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14919 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14920         /// A pointer to the contents in the success state.
14921         /// Reading from this pointer when `result_ok` is not set is undefined.
14922         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14923         /// A pointer to the contents in the error state.
14924         /// Reading from this pointer when `result_ok` is set is undefined.
14925         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14926 }
14927 #[repr(C)]
14928 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14929 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14931 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14932         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14933         /// `err` or `result` depending on the state of `result_ok`.
14934         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14935         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14936         pub result_ok: bool,
14937 }
14938 #[no_mangle]
14939 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14940 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14941         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14942                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14943                         result: Box::into_raw(Box::new(o)),
14944                 },
14945                 result_ok: true,
14946         }
14947 }
14948 #[no_mangle]
14949 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14950 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14951         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14952                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14953                         err: Box::into_raw(Box::new(e)),
14954                 },
14955                 result_ok: false,
14956         }
14957 }
14958 /// Checks if the given object is currently in the success state
14959 #[no_mangle]
14960 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14961         o.result_ok
14962 }
14963 #[no_mangle]
14964 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14965 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14966 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14967         fn drop(&mut self) {
14968                 if self.result_ok {
14969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14971                         }
14972                 } else {
14973                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14974                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14975                         }
14976                 }
14977         }
14978 }
14979 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14980         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14981                 let contents = if o.result_ok {
14982                         let result = unsafe { o.contents.result };
14983                         unsafe { o.contents.result = core::ptr::null_mut() };
14984                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14985                 } else {
14986                         let err = unsafe { o.contents.err };
14987                         unsafe { o.contents.err = core::ptr::null_mut(); }
14988                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14989                 };
14990                 Self {
14991                         contents,
14992                         result_ok: o.result_ok,
14993                 }
14994         }
14995 }
14996 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14997         fn clone(&self) -> Self {
14998                 if self.result_ok {
14999                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15000                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15001                         } }
15002                 } else {
15003                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15004                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15005                         } }
15006                 }
15007         }
15008 }
15009 #[no_mangle]
15010 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15011 /// but with all dynamically-allocated buffers duplicated in new buffers.
15012 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15013 #[repr(C)]
15014 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15015 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15016         /// A pointer to the contents in the success state.
15017         /// Reading from this pointer when `result_ok` is not set is undefined.
15018         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15019         /// A pointer to the contents in the error state.
15020         /// Reading from this pointer when `result_ok` is set is undefined.
15021         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15022 }
15023 #[repr(C)]
15024 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15025 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15027 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15028         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15029         /// `err` or `result` depending on the state of `result_ok`.
15030         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15031         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15032         pub result_ok: bool,
15033 }
15034 #[no_mangle]
15035 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15036 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15037         CResult_NodeAnnouncementDecodeErrorZ {
15038                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15039                         result: Box::into_raw(Box::new(o)),
15040                 },
15041                 result_ok: true,
15042         }
15043 }
15044 #[no_mangle]
15045 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15046 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15047         CResult_NodeAnnouncementDecodeErrorZ {
15048                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15049                         err: Box::into_raw(Box::new(e)),
15050                 },
15051                 result_ok: false,
15052         }
15053 }
15054 /// Checks if the given object is currently in the success state
15055 #[no_mangle]
15056 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15057         o.result_ok
15058 }
15059 #[no_mangle]
15060 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15061 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15062 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15063         fn drop(&mut self) {
15064                 if self.result_ok {
15065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15067                         }
15068                 } else {
15069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15071                         }
15072                 }
15073         }
15074 }
15075 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15076         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15077                 let contents = if o.result_ok {
15078                         let result = unsafe { o.contents.result };
15079                         unsafe { o.contents.result = core::ptr::null_mut() };
15080                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
15081                 } else {
15082                         let err = unsafe { o.contents.err };
15083                         unsafe { o.contents.err = core::ptr::null_mut(); }
15084                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
15085                 };
15086                 Self {
15087                         contents,
15088                         result_ok: o.result_ok,
15089                 }
15090         }
15091 }
15092 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15093         fn clone(&self) -> Self {
15094                 if self.result_ok {
15095                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15096                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15097                         } }
15098                 } else {
15099                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15100                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15101                         } }
15102                 }
15103         }
15104 }
15105 #[no_mangle]
15106 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15107 /// but with all dynamically-allocated buffers duplicated in new buffers.
15108 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15109 #[repr(C)]
15110 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15111 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15112         /// A pointer to the contents in the success state.
15113         /// Reading from this pointer when `result_ok` is not set is undefined.
15114         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15115         /// A pointer to the contents in the error state.
15116         /// Reading from this pointer when `result_ok` is set is undefined.
15117         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15118 }
15119 #[repr(C)]
15120 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15121 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15123 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15124         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15125         /// `err` or `result` depending on the state of `result_ok`.
15126         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15127         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15128         pub result_ok: bool,
15129 }
15130 #[no_mangle]
15131 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15132 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15133         CResult_QueryShortChannelIdsDecodeErrorZ {
15134                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15135                         result: Box::into_raw(Box::new(o)),
15136                 },
15137                 result_ok: true,
15138         }
15139 }
15140 #[no_mangle]
15141 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15142 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15143         CResult_QueryShortChannelIdsDecodeErrorZ {
15144                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15145                         err: Box::into_raw(Box::new(e)),
15146                 },
15147                 result_ok: false,
15148         }
15149 }
15150 /// Checks if the given object is currently in the success state
15151 #[no_mangle]
15152 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15153         o.result_ok
15154 }
15155 #[no_mangle]
15156 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15157 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15158 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15159         fn drop(&mut self) {
15160                 if self.result_ok {
15161                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15162                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15163                         }
15164                 } else {
15165                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15166                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15167                         }
15168                 }
15169         }
15170 }
15171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15172         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15173                 let contents = if o.result_ok {
15174                         let result = unsafe { o.contents.result };
15175                         unsafe { o.contents.result = core::ptr::null_mut() };
15176                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15177                 } else {
15178                         let err = unsafe { o.contents.err };
15179                         unsafe { o.contents.err = core::ptr::null_mut(); }
15180                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15181                 };
15182                 Self {
15183                         contents,
15184                         result_ok: o.result_ok,
15185                 }
15186         }
15187 }
15188 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15189         fn clone(&self) -> Self {
15190                 if self.result_ok {
15191                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15192                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15193                         } }
15194                 } else {
15195                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15196                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15197                         } }
15198                 }
15199         }
15200 }
15201 #[no_mangle]
15202 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15203 /// but with all dynamically-allocated buffers duplicated in new buffers.
15204 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15205 #[repr(C)]
15206 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15207 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15208         /// A pointer to the contents in the success state.
15209         /// Reading from this pointer when `result_ok` is not set is undefined.
15210         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15211         /// A pointer to the contents in the error state.
15212         /// Reading from this pointer when `result_ok` is set is undefined.
15213         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15214 }
15215 #[repr(C)]
15216 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15217 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15219 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15220         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15221         /// `err` or `result` depending on the state of `result_ok`.
15222         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15223         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15224         pub result_ok: bool,
15225 }
15226 #[no_mangle]
15227 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15228 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15229         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15230                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15231                         result: Box::into_raw(Box::new(o)),
15232                 },
15233                 result_ok: true,
15234         }
15235 }
15236 #[no_mangle]
15237 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15238 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15239         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15240                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15241                         err: Box::into_raw(Box::new(e)),
15242                 },
15243                 result_ok: false,
15244         }
15245 }
15246 /// Checks if the given object is currently in the success state
15247 #[no_mangle]
15248 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15249         o.result_ok
15250 }
15251 #[no_mangle]
15252 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15253 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15254 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15255         fn drop(&mut self) {
15256                 if self.result_ok {
15257                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15258                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15259                         }
15260                 } else {
15261                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15262                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15263                         }
15264                 }
15265         }
15266 }
15267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15268         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15269                 let contents = if o.result_ok {
15270                         let result = unsafe { o.contents.result };
15271                         unsafe { o.contents.result = core::ptr::null_mut() };
15272                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15273                 } else {
15274                         let err = unsafe { o.contents.err };
15275                         unsafe { o.contents.err = core::ptr::null_mut(); }
15276                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15277                 };
15278                 Self {
15279                         contents,
15280                         result_ok: o.result_ok,
15281                 }
15282         }
15283 }
15284 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15285         fn clone(&self) -> Self {
15286                 if self.result_ok {
15287                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15288                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15289                         } }
15290                 } else {
15291                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15292                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15293                         } }
15294                 }
15295         }
15296 }
15297 #[no_mangle]
15298 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15299 /// but with all dynamically-allocated buffers duplicated in new buffers.
15300 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15301 #[repr(C)]
15302 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15303 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15304         /// A pointer to the contents in the success state.
15305         /// Reading from this pointer when `result_ok` is not set is undefined.
15306         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15307         /// A pointer to the contents in the error state.
15308         /// Reading from this pointer when `result_ok` is set is undefined.
15309         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15310 }
15311 #[repr(C)]
15312 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15313 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15315 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15316         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15317         /// `err` or `result` depending on the state of `result_ok`.
15318         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15319         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15320         pub result_ok: bool,
15321 }
15322 #[no_mangle]
15323 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15324 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15325         CResult_QueryChannelRangeDecodeErrorZ {
15326                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15327                         result: Box::into_raw(Box::new(o)),
15328                 },
15329                 result_ok: true,
15330         }
15331 }
15332 #[no_mangle]
15333 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15334 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15335         CResult_QueryChannelRangeDecodeErrorZ {
15336                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15337                         err: Box::into_raw(Box::new(e)),
15338                 },
15339                 result_ok: false,
15340         }
15341 }
15342 /// Checks if the given object is currently in the success state
15343 #[no_mangle]
15344 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15345         o.result_ok
15346 }
15347 #[no_mangle]
15348 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15349 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15350 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15351         fn drop(&mut self) {
15352                 if self.result_ok {
15353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15355                         }
15356                 } else {
15357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15359                         }
15360                 }
15361         }
15362 }
15363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15365                 let contents = if o.result_ok {
15366                         let result = unsafe { o.contents.result };
15367                         unsafe { o.contents.result = core::ptr::null_mut() };
15368                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
15369                 } else {
15370                         let err = unsafe { o.contents.err };
15371                         unsafe { o.contents.err = core::ptr::null_mut(); }
15372                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
15373                 };
15374                 Self {
15375                         contents,
15376                         result_ok: o.result_ok,
15377                 }
15378         }
15379 }
15380 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15381         fn clone(&self) -> Self {
15382                 if self.result_ok {
15383                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15385                         } }
15386                 } else {
15387                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15389                         } }
15390                 }
15391         }
15392 }
15393 #[no_mangle]
15394 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15395 /// but with all dynamically-allocated buffers duplicated in new buffers.
15396 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15397 #[repr(C)]
15398 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15399 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15400         /// A pointer to the contents in the success state.
15401         /// Reading from this pointer when `result_ok` is not set is undefined.
15402         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15403         /// A pointer to the contents in the error state.
15404         /// Reading from this pointer when `result_ok` is set is undefined.
15405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15406 }
15407 #[repr(C)]
15408 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15409 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15411 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15412         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15413         /// `err` or `result` depending on the state of `result_ok`.
15414         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15415         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15416         pub result_ok: bool,
15417 }
15418 #[no_mangle]
15419 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15420 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15421         CResult_ReplyChannelRangeDecodeErrorZ {
15422                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15423                         result: Box::into_raw(Box::new(o)),
15424                 },
15425                 result_ok: true,
15426         }
15427 }
15428 #[no_mangle]
15429 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15430 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15431         CResult_ReplyChannelRangeDecodeErrorZ {
15432                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15433                         err: Box::into_raw(Box::new(e)),
15434                 },
15435                 result_ok: false,
15436         }
15437 }
15438 /// Checks if the given object is currently in the success state
15439 #[no_mangle]
15440 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15441         o.result_ok
15442 }
15443 #[no_mangle]
15444 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15445 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15446 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15447         fn drop(&mut self) {
15448                 if self.result_ok {
15449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15451                         }
15452                 } else {
15453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15455                         }
15456                 }
15457         }
15458 }
15459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15461                 let contents = if o.result_ok {
15462                         let result = unsafe { o.contents.result };
15463                         unsafe { o.contents.result = core::ptr::null_mut() };
15464                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15465                 } else {
15466                         let err = unsafe { o.contents.err };
15467                         unsafe { o.contents.err = core::ptr::null_mut(); }
15468                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15469                 };
15470                 Self {
15471                         contents,
15472                         result_ok: o.result_ok,
15473                 }
15474         }
15475 }
15476 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15477         fn clone(&self) -> Self {
15478                 if self.result_ok {
15479                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15480                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15481                         } }
15482                 } else {
15483                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15485                         } }
15486                 }
15487         }
15488 }
15489 #[no_mangle]
15490 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15491 /// but with all dynamically-allocated buffers duplicated in new buffers.
15492 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15493 #[repr(C)]
15494 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15495 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15496         /// A pointer to the contents in the success state.
15497         /// Reading from this pointer when `result_ok` is not set is undefined.
15498         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15499         /// A pointer to the contents in the error state.
15500         /// Reading from this pointer when `result_ok` is set is undefined.
15501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15502 }
15503 #[repr(C)]
15504 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15505 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15507 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15508         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15509         /// `err` or `result` depending on the state of `result_ok`.
15510         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15511         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15512         pub result_ok: bool,
15513 }
15514 #[no_mangle]
15515 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15516 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15517         CResult_GossipTimestampFilterDecodeErrorZ {
15518                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15519                         result: Box::into_raw(Box::new(o)),
15520                 },
15521                 result_ok: true,
15522         }
15523 }
15524 #[no_mangle]
15525 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15526 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15527         CResult_GossipTimestampFilterDecodeErrorZ {
15528                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15529                         err: Box::into_raw(Box::new(e)),
15530                 },
15531                 result_ok: false,
15532         }
15533 }
15534 /// Checks if the given object is currently in the success state
15535 #[no_mangle]
15536 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15537         o.result_ok
15538 }
15539 #[no_mangle]
15540 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15541 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15542 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15543         fn drop(&mut self) {
15544                 if self.result_ok {
15545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15547                         }
15548                 } else {
15549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15551                         }
15552                 }
15553         }
15554 }
15555 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15557                 let contents = if o.result_ok {
15558                         let result = unsafe { o.contents.result };
15559                         unsafe { o.contents.result = core::ptr::null_mut() };
15560                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15561                 } else {
15562                         let err = unsafe { o.contents.err };
15563                         unsafe { o.contents.err = core::ptr::null_mut(); }
15564                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15565                 };
15566                 Self {
15567                         contents,
15568                         result_ok: o.result_ok,
15569                 }
15570         }
15571 }
15572 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15573         fn clone(&self) -> Self {
15574                 if self.result_ok {
15575                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15576                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15577                         } }
15578                 } else {
15579                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15581                         } }
15582                 }
15583         }
15584 }
15585 #[no_mangle]
15586 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15587 /// but with all dynamically-allocated buffers duplicated in new buffers.
15588 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15589 #[repr(C)]
15590 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15591 /// This corresponds to std::vector in C++
15592 pub struct CVec_PhantomRouteHintsZ {
15593         /// The elements in the array.
15594         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15595         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15596         /// The number of elements pointed to by `data`.
15597         pub datalen: usize
15598 }
15599 impl CVec_PhantomRouteHintsZ {
15600         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15601                 if self.datalen == 0 { return Vec::new(); }
15602                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15603                 self.data = core::ptr::null_mut();
15604                 self.datalen = 0;
15605                 ret
15606         }
15607         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15608                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15609         }
15610 }
15611 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15612         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15613                 let datalen = v.len();
15614                 let data = Box::into_raw(v.into_boxed_slice());
15615                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15616         }
15617 }
15618 #[no_mangle]
15619 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15620 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15621 impl Drop for CVec_PhantomRouteHintsZ {
15622         fn drop(&mut self) {
15623                 if self.datalen == 0 { return; }
15624                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15625         }
15626 }
15627 impl Clone for CVec_PhantomRouteHintsZ {
15628         fn clone(&self) -> Self {
15629                 let mut res = Vec::new();
15630                 if self.datalen == 0 { return Self::from(res); }
15631                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15632                 Self::from(res)
15633         }
15634 }
15635 #[repr(C)]
15636 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15637 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15638         /// A pointer to the contents in the success state.
15639         /// Reading from this pointer when `result_ok` is not set is undefined.
15640         pub result: *mut crate::lightning_invoice::Invoice,
15641         /// A pointer to the contents in the error state.
15642         /// Reading from this pointer when `result_ok` is set is undefined.
15643         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15644 }
15645 #[repr(C)]
15646 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15647 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15649 pub struct CResult_InvoiceSignOrCreationErrorZ {
15650         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15651         /// `err` or `result` depending on the state of `result_ok`.
15652         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15653         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15654         pub result_ok: bool,
15655 }
15656 #[no_mangle]
15657 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15658 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15659         CResult_InvoiceSignOrCreationErrorZ {
15660                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15661                         result: Box::into_raw(Box::new(o)),
15662                 },
15663                 result_ok: true,
15664         }
15665 }
15666 #[no_mangle]
15667 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15668 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15669         CResult_InvoiceSignOrCreationErrorZ {
15670                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15671                         err: Box::into_raw(Box::new(e)),
15672                 },
15673                 result_ok: false,
15674         }
15675 }
15676 /// Checks if the given object is currently in the success state
15677 #[no_mangle]
15678 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15679         o.result_ok
15680 }
15681 #[no_mangle]
15682 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15683 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15684 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15685         fn drop(&mut self) {
15686                 if self.result_ok {
15687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15689                         }
15690                 } else {
15691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15693                         }
15694                 }
15695         }
15696 }
15697 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15698         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15699                 let contents = if o.result_ok {
15700                         let result = unsafe { o.contents.result };
15701                         unsafe { o.contents.result = core::ptr::null_mut() };
15702                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15703                 } else {
15704                         let err = unsafe { o.contents.err };
15705                         unsafe { o.contents.err = core::ptr::null_mut(); }
15706                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15707                 };
15708                 Self {
15709                         contents,
15710                         result_ok: o.result_ok,
15711                 }
15712         }
15713 }
15714 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15715         fn clone(&self) -> Self {
15716                 if self.result_ok {
15717                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15718                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15719                         } }
15720                 } else {
15721                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15722                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15723                         } }
15724                 }
15725         }
15726 }
15727 #[no_mangle]
15728 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15729 /// but with all dynamically-allocated buffers duplicated in new buffers.
15730 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15731 #[repr(C)]
15732 /// An enum which can either contain a crate::lightning::chain::Filter or not
15733 pub enum COption_FilterZ {
15734         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15735         Some(crate::lightning::chain::Filter),
15736         /// When we're in this state, this COption_FilterZ contains nothing
15737         None
15738 }
15739 impl COption_FilterZ {
15740         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15741                 if let Self::None = self { false } else { true }
15742         }
15743         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15744                 !self.is_some()
15745         }
15746         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15747                 if let Self::Some(v) = self { v } else { unreachable!() }
15748         }
15749 }
15750 #[no_mangle]
15751 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15752 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15753         COption_FilterZ::Some(o)
15754 }
15755 #[no_mangle]
15756 /// Constructs a new COption_FilterZ containing nothing
15757 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15758         COption_FilterZ::None
15759 }
15760 #[no_mangle]
15761 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15762 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15763 #[repr(C)]
15764 /// The contents of CResult_LockedChannelMonitorNoneZ
15765 pub union CResult_LockedChannelMonitorNoneZPtr {
15766         /// A pointer to the contents in the success state.
15767         /// Reading from this pointer when `result_ok` is not set is undefined.
15768         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15769         /// Note that this value is always NULL, as there are no contents in the Err variant
15770         pub err: *mut core::ffi::c_void,
15771 }
15772 #[repr(C)]
15773 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15774 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15775 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15776 pub struct CResult_LockedChannelMonitorNoneZ {
15777         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15778         /// `err` or `result` depending on the state of `result_ok`.
15779         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15780         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15781         pub result_ok: bool,
15782 }
15783 #[no_mangle]
15784 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15785 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15786         CResult_LockedChannelMonitorNoneZ {
15787                 contents: CResult_LockedChannelMonitorNoneZPtr {
15788                         result: Box::into_raw(Box::new(o)),
15789                 },
15790                 result_ok: true,
15791         }
15792 }
15793 #[no_mangle]
15794 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15795 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15796         CResult_LockedChannelMonitorNoneZ {
15797                 contents: CResult_LockedChannelMonitorNoneZPtr {
15798                         err: core::ptr::null_mut(),
15799                 },
15800                 result_ok: false,
15801         }
15802 }
15803 /// Checks if the given object is currently in the success state
15804 #[no_mangle]
15805 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15806         o.result_ok
15807 }
15808 #[no_mangle]
15809 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15810 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15811 impl Drop for CResult_LockedChannelMonitorNoneZ {
15812         fn drop(&mut self) {
15813                 if self.result_ok {
15814                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15815                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15816                         }
15817                 } else {
15818                 }
15819         }
15820 }
15821 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15822         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15823                 let contents = if o.result_ok {
15824                         let result = unsafe { o.contents.result };
15825                         unsafe { o.contents.result = core::ptr::null_mut() };
15826                         CResult_LockedChannelMonitorNoneZPtr { result }
15827                 } else {
15828                         let _ = unsafe { Box::from_raw(o.contents.err) };
15829                         o.contents.err = core::ptr::null_mut();
15830                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15831                 };
15832                 Self {
15833                         contents,
15834                         result_ok: o.result_ok,
15835                 }
15836         }
15837 }
15838 #[repr(C)]
15839 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15840 /// This corresponds to std::vector in C++
15841 pub struct CVec_OutPointZ {
15842         /// The elements in the array.
15843         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15844         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15845         /// The number of elements pointed to by `data`.
15846         pub datalen: usize
15847 }
15848 impl CVec_OutPointZ {
15849         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15850                 if self.datalen == 0 { return Vec::new(); }
15851                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15852                 self.data = core::ptr::null_mut();
15853                 self.datalen = 0;
15854                 ret
15855         }
15856         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15857                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15858         }
15859 }
15860 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15861         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15862                 let datalen = v.len();
15863                 let data = Box::into_raw(v.into_boxed_slice());
15864                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15865         }
15866 }
15867 #[no_mangle]
15868 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15869 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15870 impl Drop for CVec_OutPointZ {
15871         fn drop(&mut self) {
15872                 if self.datalen == 0 { return; }
15873                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15874         }
15875 }
15876 impl Clone for CVec_OutPointZ {
15877         fn clone(&self) -> Self {
15878                 let mut res = Vec::new();
15879                 if self.datalen == 0 { return Self::from(res); }
15880                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15881                 Self::from(res)
15882         }
15883 }