Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830         /// A pointer to the contents in the success state.
2831         /// Reading from this pointer when `result_ok` is not set is undefined.
2832         pub result: *mut crate::c_types::TxOut,
2833         /// A pointer to the contents in the error state.
2834         /// Reading from this pointer when `result_ok` is set is undefined.
2835         pub err: *mut crate::lightning::chain::AccessError,
2836 }
2837 #[repr(C)]
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843         /// `err` or `result` depending on the state of `result_ok`.
2844         pub contents: CResult_TxOutAccessErrorZPtr,
2845         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846         pub result_ok: bool,
2847 }
2848 #[no_mangle]
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851         CResult_TxOutAccessErrorZ {
2852                 contents: CResult_TxOutAccessErrorZPtr {
2853                         result: Box::into_raw(Box::new(o)),
2854                 },
2855                 result_ok: true,
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861         CResult_TxOutAccessErrorZ {
2862                 contents: CResult_TxOutAccessErrorZPtr {
2863                         err: Box::into_raw(Box::new(e)),
2864                 },
2865                 result_ok: false,
2866         }
2867 }
2868 /// Checks if the given object is currently in the success state
2869 #[no_mangle]
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2871         o.result_ok
2872 }
2873 #[no_mangle]
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877         fn drop(&mut self) {
2878                 if self.result_ok {
2879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2881                         }
2882                 } else {
2883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2885                         }
2886                 }
2887         }
2888 }
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891                 let contents = if o.result_ok {
2892                         let result = unsafe { o.contents.result };
2893                         unsafe { o.contents.result = core::ptr::null_mut() };
2894                         CResult_TxOutAccessErrorZPtr { result }
2895                 } else {
2896                         let err = unsafe { o.contents.err };
2897                         unsafe { o.contents.err = core::ptr::null_mut(); }
2898                         CResult_TxOutAccessErrorZPtr { err }
2899                 };
2900                 Self {
2901                         contents,
2902                         result_ok: o.result_ok,
2903                 }
2904         }
2905 }
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907         fn clone(&self) -> Self {
2908                 if self.result_ok {
2909                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2911                         } }
2912                 } else {
2913                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2915                         } }
2916                 }
2917         }
2918 }
2919 #[no_mangle]
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2923 #[repr(C)]
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926         /// The element at position 0
2927         pub a: usize,
2928         /// The element at position 1
2929         pub b: crate::c_types::Transaction,
2930 }
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2933                 Self {
2934                         a: tup.0,
2935                         b: tup.1,
2936                 }
2937         }
2938 }
2939 impl C2Tuple_usizeTransactionZ {
2940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2941                 (self.a, self.b)
2942         }
2943 }
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945         fn clone(&self) -> Self {
2946                 Self {
2947                         a: Clone::clone(&self.a),
2948                         b: Clone::clone(&self.b),
2949                 }
2950         }
2951 }
2952 #[no_mangle]
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2957 #[no_mangle]
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959         C2Tuple_usizeTransactionZ { a, b, }
2960 }
2961
2962 #[no_mangle]
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2965 #[repr(C)]
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969         /// The elements in the array.
2970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972         /// The number of elements pointed to by `data`.
2973         pub datalen: usize
2974 }
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977                 if self.datalen == 0 { return Vec::new(); }
2978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979                 self.data = core::ptr::null_mut();
2980                 self.datalen = 0;
2981                 ret
2982         }
2983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2985         }
2986 }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989                 let datalen = v.len();
2990                 let data = Box::into_raw(v.into_boxed_slice());
2991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2992         }
2993 }
2994 #[no_mangle]
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998         fn drop(&mut self) {
2999                 if self.datalen == 0 { return; }
3000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3001         }
3002 }
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004         fn clone(&self) -> Self {
3005                 let mut res = Vec::new();
3006                 if self.datalen == 0 { return Self::from(res); }
3007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3008                 Self::from(res)
3009         }
3010 }
3011 #[repr(C)]
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015         /// The elements in the array.
3016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017         pub data: *mut crate::c_types::ThirtyTwoBytes,
3018         /// The number of elements pointed to by `data`.
3019         pub datalen: usize
3020 }
3021 impl CVec_TxidZ {
3022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023                 if self.datalen == 0 { return Vec::new(); }
3024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025                 self.data = core::ptr::null_mut();
3026                 self.datalen = 0;
3027                 ret
3028         }
3029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3031         }
3032 }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035                 let datalen = v.len();
3036                 let data = Box::into_raw(v.into_boxed_slice());
3037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3038         }
3039 }
3040 #[no_mangle]
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044         fn drop(&mut self) {
3045                 if self.datalen == 0 { return; }
3046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3047         }
3048 }
3049 impl Clone for CVec_TxidZ {
3050         fn clone(&self) -> Self {
3051                 let mut res = Vec::new();
3052                 if self.datalen == 0 { return Self::from(res); }
3053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3054                 Self::from(res)
3055         }
3056 }
3057 #[repr(C)]
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060         /// Note that this value is always NULL, as there are no contents in the OK variant
3061         pub result: *mut core::ffi::c_void,
3062         /// A pointer to the contents in the error state.
3063         /// Reading from this pointer when `result_ok` is set is undefined.
3064         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3065 }
3066 #[repr(C)]
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072         /// `err` or `result` depending on the state of `result_ok`.
3073         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075         pub result_ok: bool,
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080         CResult_NoneChannelMonitorUpdateErrZ {
3081                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082                         result: core::ptr::null_mut(),
3083                 },
3084                 result_ok: true,
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090         CResult_NoneChannelMonitorUpdateErrZ {
3091                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092                         err: Box::into_raw(Box::new(e)),
3093                 },
3094                 result_ok: false,
3095         }
3096 }
3097 /// Checks if the given object is currently in the success state
3098 #[no_mangle]
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3100         o.result_ok
3101 }
3102 #[no_mangle]
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106         fn drop(&mut self) {
3107                 if self.result_ok {
3108                 } else {
3109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3111                         }
3112                 }
3113         }
3114 }
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117                 let contents = if o.result_ok {
3118                         let _ = unsafe { Box::from_raw(o.contents.result) };
3119                         o.contents.result = core::ptr::null_mut();
3120                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3121                 } else {
3122                         let err = unsafe { o.contents.err };
3123                         unsafe { o.contents.err = core::ptr::null_mut(); }
3124                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3125                 };
3126                 Self {
3127                         contents,
3128                         result_ok: o.result_ok,
3129                 }
3130         }
3131 }
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133         fn clone(&self) -> Self {
3134                 if self.result_ok {
3135                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136                                 result: core::ptr::null_mut()
3137                         } }
3138                 } else {
3139                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3141                         } }
3142                 }
3143         }
3144 }
3145 #[no_mangle]
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3149 #[repr(C)]
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153         /// The elements in the array.
3154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156         /// The number of elements pointed to by `data`.
3157         pub datalen: usize
3158 }
3159 impl CVec_MonitorEventZ {
3160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161                 if self.datalen == 0 { return Vec::new(); }
3162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163                 self.data = core::ptr::null_mut();
3164                 self.datalen = 0;
3165                 ret
3166         }
3167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3169         }
3170 }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173                 let datalen = v.len();
3174                 let data = Box::into_raw(v.into_boxed_slice());
3175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176         }
3177 }
3178 #[no_mangle]
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182         fn drop(&mut self) {
3183                 if self.datalen == 0 { return; }
3184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3185         }
3186 }
3187 impl Clone for CVec_MonitorEventZ {
3188         fn clone(&self) -> Self {
3189                 let mut res = Vec::new();
3190                 if self.datalen == 0 { return Self::from(res); }
3191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3192                 Self::from(res)
3193         }
3194 }
3195 #[repr(C)]
3196 #[derive(Clone)]
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3202         None
3203 }
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206                 if let Self::None = self { false } else { true }
3207         }
3208         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3209                 !self.is_some()
3210         }
3211         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212                 if let Self::Some(v) = self { v } else { unreachable!() }
3213         }
3214 }
3215 #[no_mangle]
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218         COption_C2Tuple_usizeTransactionZZ::Some(o)
3219 }
3220 #[no_mangle]
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223         COption_C2Tuple_usizeTransactionZZ::None
3224 }
3225 #[no_mangle]
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3228 #[no_mangle]
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3232 #[repr(C)]
3233 #[derive(Clone)]
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237         Some(crate::lightning::util::events::ClosureReason),
3238         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3239         None
3240 }
3241 impl COption_ClosureReasonZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255         COption_ClosureReasonZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260         COption_ClosureReasonZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3265 #[no_mangle]
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3269 #[repr(C)]
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272         /// A pointer to the contents in the success state.
3273         /// Reading from this pointer when `result_ok` is not set is undefined.
3274         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275         /// A pointer to the contents in the error state.
3276         /// Reading from this pointer when `result_ok` is set is undefined.
3277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3278 }
3279 #[repr(C)]
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285         /// `err` or `result` depending on the state of `result_ok`.
3286         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288         pub result_ok: bool,
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293         CResult_COption_ClosureReasonZDecodeErrorZ {
3294                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                         result: Box::into_raw(Box::new(o)),
3296                 },
3297                 result_ok: true,
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303         CResult_COption_ClosureReasonZDecodeErrorZ {
3304                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305                         err: Box::into_raw(Box::new(e)),
3306                 },
3307                 result_ok: false,
3308         }
3309 }
3310 /// Checks if the given object is currently in the success state
3311 #[no_mangle]
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3313         o.result_ok
3314 }
3315 #[no_mangle]
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319         fn drop(&mut self) {
3320                 if self.result_ok {
3321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3323                         }
3324                 } else {
3325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3327                         }
3328                 }
3329         }
3330 }
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333                 let contents = if o.result_ok {
3334                         let result = unsafe { o.contents.result };
3335                         unsafe { o.contents.result = core::ptr::null_mut() };
3336                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3337                 } else {
3338                         let err = unsafe { o.contents.err };
3339                         unsafe { o.contents.err = core::ptr::null_mut(); }
3340                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3341                 };
3342                 Self {
3343                         contents,
3344                         result_ok: o.result_ok,
3345                 }
3346         }
3347 }
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349         fn clone(&self) -> Self {
3350                 if self.result_ok {
3351                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3353                         } }
3354                 } else {
3355                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3357                         } }
3358                 }
3359         }
3360 }
3361 #[no_mangle]
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3372         None
3373 }
3374 impl COption_NetworkUpdateZ {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388         COption_NetworkUpdateZ::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393         COption_NetworkUpdateZ::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3398 #[no_mangle]
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_SpendableOutputDescriptorZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 #[derive(Clone)]
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453         Some(crate::lightning::util::events::Event),
3454         /// When we're in this state, this COption_EventZ contains nothing
3455         None
3456 }
3457 impl COption_EventZ {
3458         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459                 if let Self::None = self { false } else { true }
3460         }
3461         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3462                 !self.is_some()
3463         }
3464         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465                 if let Self::Some(v) = self { v } else { unreachable!() }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471         COption_EventZ::Some(o)
3472 }
3473 #[no_mangle]
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476         COption_EventZ::None
3477 }
3478 #[no_mangle]
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3481 #[no_mangle]
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3485 #[repr(C)]
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488         /// A pointer to the contents in the success state.
3489         /// Reading from this pointer when `result_ok` is not set is undefined.
3490         pub result: *mut crate::c_types::derived::COption_EventZ,
3491         /// A pointer to the contents in the error state.
3492         /// Reading from this pointer when `result_ok` is set is undefined.
3493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3494 }
3495 #[repr(C)]
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501         /// `err` or `result` depending on the state of `result_ok`.
3502         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504         pub result_ok: bool,
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509         CResult_COption_EventZDecodeErrorZ {
3510                 contents: CResult_COption_EventZDecodeErrorZPtr {
3511                         result: Box::into_raw(Box::new(o)),
3512                 },
3513                 result_ok: true,
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519         CResult_COption_EventZDecodeErrorZ {
3520                 contents: CResult_COption_EventZDecodeErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 /// Checks if the given object is currently in the success state
3527 #[no_mangle]
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3529         o.result_ok
3530 }
3531 #[no_mangle]
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535         fn drop(&mut self) {
3536                 if self.result_ok {
3537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3539                         }
3540                 } else {
3541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3543                         }
3544                 }
3545         }
3546 }
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549                 let contents = if o.result_ok {
3550                         let result = unsafe { o.contents.result };
3551                         unsafe { o.contents.result = core::ptr::null_mut() };
3552                         CResult_COption_EventZDecodeErrorZPtr { result }
3553                 } else {
3554                         let err = unsafe { o.contents.err };
3555                         unsafe { o.contents.err = core::ptr::null_mut(); }
3556                         CResult_COption_EventZDecodeErrorZPtr { err }
3557                 };
3558                 Self {
3559                         contents,
3560                         result_ok: o.result_ok,
3561                 }
3562         }
3563 }
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565         fn clone(&self) -> Self {
3566                 if self.result_ok {
3567                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3569                         } }
3570                 } else {
3571                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3573                         } }
3574                 }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3581 #[repr(C)]
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585         /// The elements in the array.
3586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588         /// The number of elements pointed to by `data`.
3589         pub datalen: usize
3590 }
3591 impl CVec_MessageSendEventZ {
3592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593                 if self.datalen == 0 { return Vec::new(); }
3594                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595                 self.data = core::ptr::null_mut();
3596                 self.datalen = 0;
3597                 ret
3598         }
3599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3601         }
3602 }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605                 let datalen = v.len();
3606                 let data = Box::into_raw(v.into_boxed_slice());
3607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614         fn drop(&mut self) {
3615                 if self.datalen == 0 { return; }
3616                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3617         }
3618 }
3619 impl Clone for CVec_MessageSendEventZ {
3620         fn clone(&self) -> Self {
3621                 let mut res = Vec::new();
3622                 if self.datalen == 0 { return Self::from(res); }
3623                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3624                 Self::from(res)
3625         }
3626 }
3627 #[repr(C)]
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630         /// A pointer to the contents in the success state.
3631         /// Reading from this pointer when `result_ok` is not set is undefined.
3632         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633         /// A pointer to the contents in the error state.
3634         /// Reading from this pointer when `result_ok` is set is undefined.
3635         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3636 }
3637 #[repr(C)]
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643         /// `err` or `result` depending on the state of `result_ok`.
3644         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646         pub result_ok: bool,
3647 }
3648 #[no_mangle]
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651         CResult_FixedPenaltyScorerDecodeErrorZ {
3652                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653                         result: Box::into_raw(Box::new(o)),
3654                 },
3655                 result_ok: true,
3656         }
3657 }
3658 #[no_mangle]
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661         CResult_FixedPenaltyScorerDecodeErrorZ {
3662                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663                         err: Box::into_raw(Box::new(e)),
3664                 },
3665                 result_ok: false,
3666         }
3667 }
3668 /// Checks if the given object is currently in the success state
3669 #[no_mangle]
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3671         o.result_ok
3672 }
3673 #[no_mangle]
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3681                         }
3682                 } else {
3683                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3685                         }
3686                 }
3687         }
3688 }
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691                 let contents = if o.result_ok {
3692                         let result = unsafe { o.contents.result };
3693                         unsafe { o.contents.result = core::ptr::null_mut() };
3694                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3695                 } else {
3696                         let err = unsafe { o.contents.err };
3697                         unsafe { o.contents.err = core::ptr::null_mut(); }
3698                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3699                 };
3700                 Self {
3701                         contents,
3702                         result_ok: o.result_ok,
3703                 }
3704         }
3705 }
3706 #[repr(C)]
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709         /// A pointer to the contents in the success state.
3710         /// Reading from this pointer when `result_ok` is not set is undefined.
3711         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712         /// A pointer to the contents in the error state.
3713         /// Reading from this pointer when `result_ok` is set is undefined.
3714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3715 }
3716 #[repr(C)]
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722         /// `err` or `result` depending on the state of `result_ok`.
3723         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725         pub result_ok: bool,
3726 }
3727 #[no_mangle]
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730         CResult_ScoringParametersDecodeErrorZ {
3731                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732                         result: Box::into_raw(Box::new(o)),
3733                 },
3734                 result_ok: true,
3735         }
3736 }
3737 #[no_mangle]
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740         CResult_ScoringParametersDecodeErrorZ {
3741                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742                         err: Box::into_raw(Box::new(e)),
3743                 },
3744                 result_ok: false,
3745         }
3746 }
3747 /// Checks if the given object is currently in the success state
3748 #[no_mangle]
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3750         o.result_ok
3751 }
3752 #[no_mangle]
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756         fn drop(&mut self) {
3757                 if self.result_ok {
3758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3760                         }
3761                 } else {
3762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3764                         }
3765                 }
3766         }
3767 }
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770                 let contents = if o.result_ok {
3771                         let result = unsafe { o.contents.result };
3772                         unsafe { o.contents.result = core::ptr::null_mut() };
3773                         CResult_ScoringParametersDecodeErrorZPtr { result }
3774                 } else {
3775                         let err = unsafe { o.contents.err };
3776                         unsafe { o.contents.err = core::ptr::null_mut(); }
3777                         CResult_ScoringParametersDecodeErrorZPtr { err }
3778                 };
3779                 Self {
3780                         contents,
3781                         result_ok: o.result_ok,
3782                 }
3783         }
3784 }
3785 #[repr(C)]
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788         /// A pointer to the contents in the success state.
3789         /// Reading from this pointer when `result_ok` is not set is undefined.
3790         pub result: *mut crate::lightning::routing::scoring::Scorer,
3791         /// A pointer to the contents in the error state.
3792         /// Reading from this pointer when `result_ok` is set is undefined.
3793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3794 }
3795 #[repr(C)]
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801         /// `err` or `result` depending on the state of `result_ok`.
3802         pub contents: CResult_ScorerDecodeErrorZPtr,
3803         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804         pub result_ok: bool,
3805 }
3806 #[no_mangle]
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809         CResult_ScorerDecodeErrorZ {
3810                 contents: CResult_ScorerDecodeErrorZPtr {
3811                         result: Box::into_raw(Box::new(o)),
3812                 },
3813                 result_ok: true,
3814         }
3815 }
3816 #[no_mangle]
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819         CResult_ScorerDecodeErrorZ {
3820                 contents: CResult_ScorerDecodeErrorZPtr {
3821                         err: Box::into_raw(Box::new(e)),
3822                 },
3823                 result_ok: false,
3824         }
3825 }
3826 /// Checks if the given object is currently in the success state
3827 #[no_mangle]
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3829         o.result_ok
3830 }
3831 #[no_mangle]
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835         fn drop(&mut self) {
3836                 if self.result_ok {
3837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3839                         }
3840                 } else {
3841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3843                         }
3844                 }
3845         }
3846 }
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849                 let contents = if o.result_ok {
3850                         let result = unsafe { o.contents.result };
3851                         unsafe { o.contents.result = core::ptr::null_mut() };
3852                         CResult_ScorerDecodeErrorZPtr { result }
3853                 } else {
3854                         let err = unsafe { o.contents.err };
3855                         unsafe { o.contents.err = core::ptr::null_mut(); }
3856                         CResult_ScorerDecodeErrorZPtr { err }
3857                 };
3858                 Self {
3859                         contents,
3860                         result_ok: o.result_ok,
3861                 }
3862         }
3863 }
3864 #[repr(C)]
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867         /// A pointer to the contents in the success state.
3868         /// Reading from this pointer when `result_ok` is not set is undefined.
3869         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870         /// A pointer to the contents in the error state.
3871         /// Reading from this pointer when `result_ok` is set is undefined.
3872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3873 }
3874 #[repr(C)]
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879         /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880         /// `err` or `result` depending on the state of `result_ok`.
3881         pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882         /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883         pub result_ok: bool,
3884 }
3885 #[no_mangle]
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890                         result: Box::into_raw(Box::new(o)),
3891                 },
3892                 result_ok: true,
3893         }
3894 }
3895 #[no_mangle]
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900                         err: Box::into_raw(Box::new(e)),
3901                 },
3902                 result_ok: false,
3903         }
3904 }
3905 /// Checks if the given object is currently in the success state
3906 #[no_mangle]
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3908         o.result_ok
3909 }
3910 #[no_mangle]
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914         fn drop(&mut self) {
3915                 if self.result_ok {
3916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3918                         }
3919                 } else {
3920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3922                         }
3923                 }
3924         }
3925 }
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928                 let contents = if o.result_ok {
3929                         let result = unsafe { o.contents.result };
3930                         unsafe { o.contents.result = core::ptr::null_mut() };
3931                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3932                 } else {
3933                         let err = unsafe { o.contents.err };
3934                         unsafe { o.contents.err = core::ptr::null_mut(); }
3935                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3936                 };
3937                 Self {
3938                         contents,
3939                         result_ok: o.result_ok,
3940                 }
3941         }
3942 }
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944         fn clone(&self) -> Self {
3945                 if self.result_ok {
3946                         Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3948                         } }
3949                 } else {
3950                         Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3952                         } }
3953                 }
3954         }
3955 }
3956 #[no_mangle]
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3960 #[repr(C)]
3961 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3962 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3963         /// A pointer to the contents in the success state.
3964         /// Reading from this pointer when `result_ok` is not set is undefined.
3965         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3966         /// A pointer to the contents in the error state.
3967         /// Reading from this pointer when `result_ok` is set is undefined.
3968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3969 }
3970 #[repr(C)]
3971 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3972 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3974 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3975         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3976         /// `err` or `result` depending on the state of `result_ok`.
3977         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3978         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3979         pub result_ok: bool,
3980 }
3981 #[no_mangle]
3982 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3983 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3984         CResult_ProbabilisticScorerDecodeErrorZ {
3985                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3986                         result: Box::into_raw(Box::new(o)),
3987                 },
3988                 result_ok: true,
3989         }
3990 }
3991 #[no_mangle]
3992 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3993 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3994         CResult_ProbabilisticScorerDecodeErrorZ {
3995                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3996                         err: Box::into_raw(Box::new(e)),
3997                 },
3998                 result_ok: false,
3999         }
4000 }
4001 /// Checks if the given object is currently in the success state
4002 #[no_mangle]
4003 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4004         o.result_ok
4005 }
4006 #[no_mangle]
4007 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4008 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4009 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4010         fn drop(&mut self) {
4011                 if self.result_ok {
4012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4014                         }
4015                 } else {
4016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4018                         }
4019                 }
4020         }
4021 }
4022 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4024                 let contents = if o.result_ok {
4025                         let result = unsafe { o.contents.result };
4026                         unsafe { o.contents.result = core::ptr::null_mut() };
4027                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4028                 } else {
4029                         let err = unsafe { o.contents.err };
4030                         unsafe { o.contents.err = core::ptr::null_mut(); }
4031                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4032                 };
4033                 Self {
4034                         contents,
4035                         result_ok: o.result_ok,
4036                 }
4037         }
4038 }
4039 #[repr(C)]
4040 /// The contents of CResult_InitFeaturesDecodeErrorZ
4041 pub union CResult_InitFeaturesDecodeErrorZPtr {
4042         /// A pointer to the contents in the success state.
4043         /// Reading from this pointer when `result_ok` is not set is undefined.
4044         pub result: *mut crate::lightning::ln::features::InitFeatures,
4045         /// A pointer to the contents in the error state.
4046         /// Reading from this pointer when `result_ok` is set is undefined.
4047         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4048 }
4049 #[repr(C)]
4050 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4051 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4053 pub struct CResult_InitFeaturesDecodeErrorZ {
4054         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4055         /// `err` or `result` depending on the state of `result_ok`.
4056         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4057         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4058         pub result_ok: bool,
4059 }
4060 #[no_mangle]
4061 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4062 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4063         CResult_InitFeaturesDecodeErrorZ {
4064                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4065                         result: Box::into_raw(Box::new(o)),
4066                 },
4067                 result_ok: true,
4068         }
4069 }
4070 #[no_mangle]
4071 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4072 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4073         CResult_InitFeaturesDecodeErrorZ {
4074                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4075                         err: Box::into_raw(Box::new(e)),
4076                 },
4077                 result_ok: false,
4078         }
4079 }
4080 /// Checks if the given object is currently in the success state
4081 #[no_mangle]
4082 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4083         o.result_ok
4084 }
4085 #[no_mangle]
4086 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4087 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4088 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4089         fn drop(&mut self) {
4090                 if self.result_ok {
4091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4093                         }
4094                 } else {
4095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4097                         }
4098                 }
4099         }
4100 }
4101 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4102         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4103                 let contents = if o.result_ok {
4104                         let result = unsafe { o.contents.result };
4105                         unsafe { o.contents.result = core::ptr::null_mut() };
4106                         CResult_InitFeaturesDecodeErrorZPtr { result }
4107                 } else {
4108                         let err = unsafe { o.contents.err };
4109                         unsafe { o.contents.err = core::ptr::null_mut(); }
4110                         CResult_InitFeaturesDecodeErrorZPtr { err }
4111                 };
4112                 Self {
4113                         contents,
4114                         result_ok: o.result_ok,
4115                 }
4116         }
4117 }
4118 #[repr(C)]
4119 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4120 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4121         /// A pointer to the contents in the success state.
4122         /// Reading from this pointer when `result_ok` is not set is undefined.
4123         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4124         /// A pointer to the contents in the error state.
4125         /// Reading from this pointer when `result_ok` is set is undefined.
4126         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4127 }
4128 #[repr(C)]
4129 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4130 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4131 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4132 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4133         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4134         /// `err` or `result` depending on the state of `result_ok`.
4135         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4136         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4137         pub result_ok: bool,
4138 }
4139 #[no_mangle]
4140 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4141 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4142         CResult_ChannelFeaturesDecodeErrorZ {
4143                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4144                         result: Box::into_raw(Box::new(o)),
4145                 },
4146                 result_ok: true,
4147         }
4148 }
4149 #[no_mangle]
4150 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4151 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4152         CResult_ChannelFeaturesDecodeErrorZ {
4153                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4154                         err: Box::into_raw(Box::new(e)),
4155                 },
4156                 result_ok: false,
4157         }
4158 }
4159 /// Checks if the given object is currently in the success state
4160 #[no_mangle]
4161 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4162         o.result_ok
4163 }
4164 #[no_mangle]
4165 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4166 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4167 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4168         fn drop(&mut self) {
4169                 if self.result_ok {
4170                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4171                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4172                         }
4173                 } else {
4174                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4175                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4176                         }
4177                 }
4178         }
4179 }
4180 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4181         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4182                 let contents = if o.result_ok {
4183                         let result = unsafe { o.contents.result };
4184                         unsafe { o.contents.result = core::ptr::null_mut() };
4185                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4186                 } else {
4187                         let err = unsafe { o.contents.err };
4188                         unsafe { o.contents.err = core::ptr::null_mut(); }
4189                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4190                 };
4191                 Self {
4192                         contents,
4193                         result_ok: o.result_ok,
4194                 }
4195         }
4196 }
4197 #[repr(C)]
4198 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4199 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4200         /// A pointer to the contents in the success state.
4201         /// Reading from this pointer when `result_ok` is not set is undefined.
4202         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4203         /// A pointer to the contents in the error state.
4204         /// Reading from this pointer when `result_ok` is set is undefined.
4205         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4206 }
4207 #[repr(C)]
4208 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4209 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4211 pub struct CResult_NodeFeaturesDecodeErrorZ {
4212         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4213         /// `err` or `result` depending on the state of `result_ok`.
4214         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4215         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4216         pub result_ok: bool,
4217 }
4218 #[no_mangle]
4219 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4220 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4221         CResult_NodeFeaturesDecodeErrorZ {
4222                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4223                         result: Box::into_raw(Box::new(o)),
4224                 },
4225                 result_ok: true,
4226         }
4227 }
4228 #[no_mangle]
4229 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4230 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4231         CResult_NodeFeaturesDecodeErrorZ {
4232                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4233                         err: Box::into_raw(Box::new(e)),
4234                 },
4235                 result_ok: false,
4236         }
4237 }
4238 /// Checks if the given object is currently in the success state
4239 #[no_mangle]
4240 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4241         o.result_ok
4242 }
4243 #[no_mangle]
4244 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4245 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4246 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4247         fn drop(&mut self) {
4248                 if self.result_ok {
4249                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4250                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4251                         }
4252                 } else {
4253                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4254                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4255                         }
4256                 }
4257         }
4258 }
4259 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4260         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4261                 let contents = if o.result_ok {
4262                         let result = unsafe { o.contents.result };
4263                         unsafe { o.contents.result = core::ptr::null_mut() };
4264                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4265                 } else {
4266                         let err = unsafe { o.contents.err };
4267                         unsafe { o.contents.err = core::ptr::null_mut(); }
4268                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4269                 };
4270                 Self {
4271                         contents,
4272                         result_ok: o.result_ok,
4273                 }
4274         }
4275 }
4276 #[repr(C)]
4277 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4278 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4279         /// A pointer to the contents in the success state.
4280         /// Reading from this pointer when `result_ok` is not set is undefined.
4281         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4282         /// A pointer to the contents in the error state.
4283         /// Reading from this pointer when `result_ok` is set is undefined.
4284         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4285 }
4286 #[repr(C)]
4287 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4288 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4289 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4290 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4291         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4292         /// `err` or `result` depending on the state of `result_ok`.
4293         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4294         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4295         pub result_ok: bool,
4296 }
4297 #[no_mangle]
4298 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4299 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4300         CResult_InvoiceFeaturesDecodeErrorZ {
4301                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4302                         result: Box::into_raw(Box::new(o)),
4303                 },
4304                 result_ok: true,
4305         }
4306 }
4307 #[no_mangle]
4308 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4309 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4310         CResult_InvoiceFeaturesDecodeErrorZ {
4311                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4312                         err: Box::into_raw(Box::new(e)),
4313                 },
4314                 result_ok: false,
4315         }
4316 }
4317 /// Checks if the given object is currently in the success state
4318 #[no_mangle]
4319 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4320         o.result_ok
4321 }
4322 #[no_mangle]
4323 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4324 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4325 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4326         fn drop(&mut self) {
4327                 if self.result_ok {
4328                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4329                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4330                         }
4331                 } else {
4332                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4333                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4334                         }
4335                 }
4336         }
4337 }
4338 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4339         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4340                 let contents = if o.result_ok {
4341                         let result = unsafe { o.contents.result };
4342                         unsafe { o.contents.result = core::ptr::null_mut() };
4343                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4344                 } else {
4345                         let err = unsafe { o.contents.err };
4346                         unsafe { o.contents.err = core::ptr::null_mut(); }
4347                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4348                 };
4349                 Self {
4350                         contents,
4351                         result_ok: o.result_ok,
4352                 }
4353         }
4354 }
4355 #[repr(C)]
4356 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4357 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4358         /// A pointer to the contents in the success state.
4359         /// Reading from this pointer when `result_ok` is not set is undefined.
4360         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4361         /// A pointer to the contents in the error state.
4362         /// Reading from this pointer when `result_ok` is set is undefined.
4363         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4364 }
4365 #[repr(C)]
4366 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4367 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4369 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4370         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4371         /// `err` or `result` depending on the state of `result_ok`.
4372         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4373         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4374         pub result_ok: bool,
4375 }
4376 #[no_mangle]
4377 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4378 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4379         CResult_ChannelTypeFeaturesDecodeErrorZ {
4380                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4381                         result: Box::into_raw(Box::new(o)),
4382                 },
4383                 result_ok: true,
4384         }
4385 }
4386 #[no_mangle]
4387 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4388 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4389         CResult_ChannelTypeFeaturesDecodeErrorZ {
4390                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4391                         err: Box::into_raw(Box::new(e)),
4392                 },
4393                 result_ok: false,
4394         }
4395 }
4396 /// Checks if the given object is currently in the success state
4397 #[no_mangle]
4398 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4399         o.result_ok
4400 }
4401 #[no_mangle]
4402 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4403 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4404 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4405         fn drop(&mut self) {
4406                 if self.result_ok {
4407                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4408                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4409                         }
4410                 } else {
4411                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4412                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4413                         }
4414                 }
4415         }
4416 }
4417 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4418         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4419                 let contents = if o.result_ok {
4420                         let result = unsafe { o.contents.result };
4421                         unsafe { o.contents.result = core::ptr::null_mut() };
4422                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4423                 } else {
4424                         let err = unsafe { o.contents.err };
4425                         unsafe { o.contents.err = core::ptr::null_mut(); }
4426                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4427                 };
4428                 Self {
4429                         contents,
4430                         result_ok: o.result_ok,
4431                 }
4432         }
4433 }
4434 #[repr(C)]
4435 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4436 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4437         /// A pointer to the contents in the success state.
4438         /// Reading from this pointer when `result_ok` is not set is undefined.
4439         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4440         /// A pointer to the contents in the error state.
4441         /// Reading from this pointer when `result_ok` is set is undefined.
4442         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4443 }
4444 #[repr(C)]
4445 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4446 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4448 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4449         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4450         /// `err` or `result` depending on the state of `result_ok`.
4451         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4452         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4453         pub result_ok: bool,
4454 }
4455 #[no_mangle]
4456 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4457 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4458         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4459                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4460                         result: Box::into_raw(Box::new(o)),
4461                 },
4462                 result_ok: true,
4463         }
4464 }
4465 #[no_mangle]
4466 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4468         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4469                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4470                         err: Box::into_raw(Box::new(e)),
4471                 },
4472                 result_ok: false,
4473         }
4474 }
4475 /// Checks if the given object is currently in the success state
4476 #[no_mangle]
4477 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4478         o.result_ok
4479 }
4480 #[no_mangle]
4481 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4482 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4483 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4484         fn drop(&mut self) {
4485                 if self.result_ok {
4486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4488                         }
4489                 } else {
4490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4492                         }
4493                 }
4494         }
4495 }
4496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4498                 let contents = if o.result_ok {
4499                         let result = unsafe { o.contents.result };
4500                         unsafe { o.contents.result = core::ptr::null_mut() };
4501                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4502                 } else {
4503                         let err = unsafe { o.contents.err };
4504                         unsafe { o.contents.err = core::ptr::null_mut(); }
4505                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4506                 };
4507                 Self {
4508                         contents,
4509                         result_ok: o.result_ok,
4510                 }
4511         }
4512 }
4513 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4514         fn clone(&self) -> Self {
4515                 if self.result_ok {
4516                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4517                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4518                         } }
4519                 } else {
4520                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4521                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4522                         } }
4523                 }
4524         }
4525 }
4526 #[no_mangle]
4527 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4528 /// but with all dynamically-allocated buffers duplicated in new buffers.
4529 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4530 #[repr(C)]
4531 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4532 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4533         /// A pointer to the contents in the success state.
4534         /// Reading from this pointer when `result_ok` is not set is undefined.
4535         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4536         /// A pointer to the contents in the error state.
4537         /// Reading from this pointer when `result_ok` is set is undefined.
4538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4539 }
4540 #[repr(C)]
4541 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4542 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4544 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4545         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4546         /// `err` or `result` depending on the state of `result_ok`.
4547         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4548         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4549         pub result_ok: bool,
4550 }
4551 #[no_mangle]
4552 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4553 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4554         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4555                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4556                         result: Box::into_raw(Box::new(o)),
4557                 },
4558                 result_ok: true,
4559         }
4560 }
4561 #[no_mangle]
4562 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4564         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4565                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4566                         err: Box::into_raw(Box::new(e)),
4567                 },
4568                 result_ok: false,
4569         }
4570 }
4571 /// Checks if the given object is currently in the success state
4572 #[no_mangle]
4573 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4574         o.result_ok
4575 }
4576 #[no_mangle]
4577 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4578 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4579 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4580         fn drop(&mut self) {
4581                 if self.result_ok {
4582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4584                         }
4585                 } else {
4586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4588                         }
4589                 }
4590         }
4591 }
4592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4594                 let contents = if o.result_ok {
4595                         let result = unsafe { o.contents.result };
4596                         unsafe { o.contents.result = core::ptr::null_mut() };
4597                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4598                 } else {
4599                         let err = unsafe { o.contents.err };
4600                         unsafe { o.contents.err = core::ptr::null_mut(); }
4601                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4602                 };
4603                 Self {
4604                         contents,
4605                         result_ok: o.result_ok,
4606                 }
4607         }
4608 }
4609 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4610         fn clone(&self) -> Self {
4611                 if self.result_ok {
4612                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4613                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4614                         } }
4615                 } else {
4616                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4618                         } }
4619                 }
4620         }
4621 }
4622 #[no_mangle]
4623 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4624 /// but with all dynamically-allocated buffers duplicated in new buffers.
4625 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4626 #[repr(C)]
4627 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4628 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4629         /// A pointer to the contents in the success state.
4630         /// Reading from this pointer when `result_ok` is not set is undefined.
4631         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4632         /// A pointer to the contents in the error state.
4633         /// Reading from this pointer when `result_ok` is set is undefined.
4634         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4635 }
4636 #[repr(C)]
4637 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4638 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4639 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4640 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4641         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4642         /// `err` or `result` depending on the state of `result_ok`.
4643         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4644         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4645         pub result_ok: bool,
4646 }
4647 #[no_mangle]
4648 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4649 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4650         CResult_SpendableOutputDescriptorDecodeErrorZ {
4651                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4652                         result: Box::into_raw(Box::new(o)),
4653                 },
4654                 result_ok: true,
4655         }
4656 }
4657 #[no_mangle]
4658 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4660         CResult_SpendableOutputDescriptorDecodeErrorZ {
4661                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4662                         err: Box::into_raw(Box::new(e)),
4663                 },
4664                 result_ok: false,
4665         }
4666 }
4667 /// Checks if the given object is currently in the success state
4668 #[no_mangle]
4669 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4670         o.result_ok
4671 }
4672 #[no_mangle]
4673 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4674 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4675 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4676         fn drop(&mut self) {
4677                 if self.result_ok {
4678                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4679                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4680                         }
4681                 } else {
4682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4684                         }
4685                 }
4686         }
4687 }
4688 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4689         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4690                 let contents = if o.result_ok {
4691                         let result = unsafe { o.contents.result };
4692                         unsafe { o.contents.result = core::ptr::null_mut() };
4693                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4694                 } else {
4695                         let err = unsafe { o.contents.err };
4696                         unsafe { o.contents.err = core::ptr::null_mut(); }
4697                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4698                 };
4699                 Self {
4700                         contents,
4701                         result_ok: o.result_ok,
4702                 }
4703         }
4704 }
4705 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4706         fn clone(&self) -> Self {
4707                 if self.result_ok {
4708                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4709                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4710                         } }
4711                 } else {
4712                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4714                         } }
4715                 }
4716         }
4717 }
4718 #[no_mangle]
4719 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4720 /// but with all dynamically-allocated buffers duplicated in new buffers.
4721 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4722 #[repr(C)]
4723 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4724 /// This corresponds to std::vector in C++
4725 pub struct CVec_PaymentPreimageZ {
4726         /// The elements in the array.
4727         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4728         pub data: *mut crate::c_types::ThirtyTwoBytes,
4729         /// The number of elements pointed to by `data`.
4730         pub datalen: usize
4731 }
4732 impl CVec_PaymentPreimageZ {
4733         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4734                 if self.datalen == 0 { return Vec::new(); }
4735                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4736                 self.data = core::ptr::null_mut();
4737                 self.datalen = 0;
4738                 ret
4739         }
4740         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4741                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4742         }
4743 }
4744 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4745         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4746                 let datalen = v.len();
4747                 let data = Box::into_raw(v.into_boxed_slice());
4748                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4749         }
4750 }
4751 #[no_mangle]
4752 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4753 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4754 impl Drop for CVec_PaymentPreimageZ {
4755         fn drop(&mut self) {
4756                 if self.datalen == 0 { return; }
4757                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4758         }
4759 }
4760 impl Clone for CVec_PaymentPreimageZ {
4761         fn clone(&self) -> Self {
4762                 let mut res = Vec::new();
4763                 if self.datalen == 0 { return Self::from(res); }
4764                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4765                 Self::from(res)
4766         }
4767 }
4768 #[repr(C)]
4769 /// A tuple of 2 elements. See the individual fields for the types contained.
4770 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4771         /// The element at position 0
4772         pub a: crate::c_types::Signature,
4773         /// The element at position 1
4774         pub b: crate::c_types::derived::CVec_SignatureZ,
4775 }
4776 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4777         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4778                 Self {
4779                         a: tup.0,
4780                         b: tup.1,
4781                 }
4782         }
4783 }
4784 impl C2Tuple_SignatureCVec_SignatureZZ {
4785         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4786                 (self.a, self.b)
4787         }
4788 }
4789 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4790         fn clone(&self) -> Self {
4791                 Self {
4792                         a: Clone::clone(&self.a),
4793                         b: Clone::clone(&self.b),
4794                 }
4795         }
4796 }
4797 #[no_mangle]
4798 /// Creates a new tuple which has the same data as `orig`
4799 /// but with all dynamically-allocated buffers duplicated in new buffers.
4800 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4801 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4802 #[no_mangle]
4803 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4804         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4805 }
4806
4807 #[no_mangle]
4808 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4809 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4810 #[repr(C)]
4811 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4812 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4813         /// A pointer to the contents in the success state.
4814         /// Reading from this pointer when `result_ok` is not set is undefined.
4815         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4816         /// Note that this value is always NULL, as there are no contents in the Err variant
4817         pub err: *mut core::ffi::c_void,
4818 }
4819 #[repr(C)]
4820 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4821 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4822 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4823 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4825         /// `err` or `result` depending on the state of `result_ok`.
4826         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4827         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4828         pub result_ok: bool,
4829 }
4830 #[no_mangle]
4831 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4832 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4833         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4834                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4835                         result: Box::into_raw(Box::new(o)),
4836                 },
4837                 result_ok: true,
4838         }
4839 }
4840 #[no_mangle]
4841 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4842 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4843         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4844                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4845                         err: core::ptr::null_mut(),
4846                 },
4847                 result_ok: false,
4848         }
4849 }
4850 /// Checks if the given object is currently in the success state
4851 #[no_mangle]
4852 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4853         o.result_ok
4854 }
4855 #[no_mangle]
4856 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4857 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4858 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4859         fn drop(&mut self) {
4860                 if self.result_ok {
4861                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4862                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4863                         }
4864                 } else {
4865                 }
4866         }
4867 }
4868 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4869         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4870                 let contents = if o.result_ok {
4871                         let result = unsafe { o.contents.result };
4872                         unsafe { o.contents.result = core::ptr::null_mut() };
4873                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4874                 } else {
4875                         let _ = unsafe { Box::from_raw(o.contents.err) };
4876                         o.contents.err = core::ptr::null_mut();
4877                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4878                 };
4879                 Self {
4880                         contents,
4881                         result_ok: o.result_ok,
4882                 }
4883         }
4884 }
4885 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4886         fn clone(&self) -> Self {
4887                 if self.result_ok {
4888                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4889                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4890                         } }
4891                 } else {
4892                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4893                                 err: core::ptr::null_mut()
4894                         } }
4895                 }
4896         }
4897 }
4898 #[no_mangle]
4899 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4900 /// but with all dynamically-allocated buffers duplicated in new buffers.
4901 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4902 #[repr(C)]
4903 /// The contents of CResult_SignatureNoneZ
4904 pub union CResult_SignatureNoneZPtr {
4905         /// A pointer to the contents in the success state.
4906         /// Reading from this pointer when `result_ok` is not set is undefined.
4907         pub result: *mut crate::c_types::Signature,
4908         /// Note that this value is always NULL, as there are no contents in the Err variant
4909         pub err: *mut core::ffi::c_void,
4910 }
4911 #[repr(C)]
4912 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4913 /// containing a crate::c_types::Signature on success and a () on failure.
4914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4915 pub struct CResult_SignatureNoneZ {
4916         /// The contents of this CResult_SignatureNoneZ, accessible via either
4917         /// `err` or `result` depending on the state of `result_ok`.
4918         pub contents: CResult_SignatureNoneZPtr,
4919         /// Whether this CResult_SignatureNoneZ represents a success state.
4920         pub result_ok: bool,
4921 }
4922 #[no_mangle]
4923 /// Creates a new CResult_SignatureNoneZ in the success state.
4924 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4925         CResult_SignatureNoneZ {
4926                 contents: CResult_SignatureNoneZPtr {
4927                         result: Box::into_raw(Box::new(o)),
4928                 },
4929                 result_ok: true,
4930         }
4931 }
4932 #[no_mangle]
4933 /// Creates a new CResult_SignatureNoneZ in the error state.
4934 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4935         CResult_SignatureNoneZ {
4936                 contents: CResult_SignatureNoneZPtr {
4937                         err: core::ptr::null_mut(),
4938                 },
4939                 result_ok: false,
4940         }
4941 }
4942 /// Checks if the given object is currently in the success state
4943 #[no_mangle]
4944 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4945         o.result_ok
4946 }
4947 #[no_mangle]
4948 /// Frees any resources used by the CResult_SignatureNoneZ.
4949 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4950 impl Drop for CResult_SignatureNoneZ {
4951         fn drop(&mut self) {
4952                 if self.result_ok {
4953                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4954                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4955                         }
4956                 } else {
4957                 }
4958         }
4959 }
4960 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4961         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4962                 let contents = if o.result_ok {
4963                         let result = unsafe { o.contents.result };
4964                         unsafe { o.contents.result = core::ptr::null_mut() };
4965                         CResult_SignatureNoneZPtr { result }
4966                 } else {
4967                         let _ = unsafe { Box::from_raw(o.contents.err) };
4968                         o.contents.err = core::ptr::null_mut();
4969                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4970                 };
4971                 Self {
4972                         contents,
4973                         result_ok: o.result_ok,
4974                 }
4975         }
4976 }
4977 impl Clone for CResult_SignatureNoneZ {
4978         fn clone(&self) -> Self {
4979                 if self.result_ok {
4980                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4981                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4982                         } }
4983                 } else {
4984                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4985                                 err: core::ptr::null_mut()
4986                         } }
4987                 }
4988         }
4989 }
4990 #[no_mangle]
4991 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4992 /// but with all dynamically-allocated buffers duplicated in new buffers.
4993 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4994 #[repr(C)]
4995 /// A tuple of 2 elements. See the individual fields for the types contained.
4996 pub struct C2Tuple_SignatureSignatureZ {
4997         /// The element at position 0
4998         pub a: crate::c_types::Signature,
4999         /// The element at position 1
5000         pub b: crate::c_types::Signature,
5001 }
5002 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5003         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5004                 Self {
5005                         a: tup.0,
5006                         b: tup.1,
5007                 }
5008         }
5009 }
5010 impl C2Tuple_SignatureSignatureZ {
5011         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5012                 (self.a, self.b)
5013         }
5014 }
5015 impl Clone for C2Tuple_SignatureSignatureZ {
5016         fn clone(&self) -> Self {
5017                 Self {
5018                         a: Clone::clone(&self.a),
5019                         b: Clone::clone(&self.b),
5020                 }
5021         }
5022 }
5023 #[no_mangle]
5024 /// Creates a new tuple which has the same data as `orig`
5025 /// but with all dynamically-allocated buffers duplicated in new buffers.
5026 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5027 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5028 #[no_mangle]
5029 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5030         C2Tuple_SignatureSignatureZ { a, b, }
5031 }
5032
5033 #[no_mangle]
5034 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5035 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5036 #[repr(C)]
5037 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5038 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5039         /// A pointer to the contents in the success state.
5040         /// Reading from this pointer when `result_ok` is not set is undefined.
5041         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5042         /// Note that this value is always NULL, as there are no contents in the Err variant
5043         pub err: *mut core::ffi::c_void,
5044 }
5045 #[repr(C)]
5046 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5047 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5049 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5050         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5051         /// `err` or `result` depending on the state of `result_ok`.
5052         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5053         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5054         pub result_ok: bool,
5055 }
5056 #[no_mangle]
5057 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5058 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5059         CResult_C2Tuple_SignatureSignatureZNoneZ {
5060                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5061                         result: Box::into_raw(Box::new(o)),
5062                 },
5063                 result_ok: true,
5064         }
5065 }
5066 #[no_mangle]
5067 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5068 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5069         CResult_C2Tuple_SignatureSignatureZNoneZ {
5070                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5071                         err: core::ptr::null_mut(),
5072                 },
5073                 result_ok: false,
5074         }
5075 }
5076 /// Checks if the given object is currently in the success state
5077 #[no_mangle]
5078 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5079         o.result_ok
5080 }
5081 #[no_mangle]
5082 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5083 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5084 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5085         fn drop(&mut self) {
5086                 if self.result_ok {
5087                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5088                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5089                         }
5090                 } else {
5091                 }
5092         }
5093 }
5094 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5095         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5096                 let contents = if o.result_ok {
5097                         let result = unsafe { o.contents.result };
5098                         unsafe { o.contents.result = core::ptr::null_mut() };
5099                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5100                 } else {
5101                         let _ = unsafe { Box::from_raw(o.contents.err) };
5102                         o.contents.err = core::ptr::null_mut();
5103                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5104                 };
5105                 Self {
5106                         contents,
5107                         result_ok: o.result_ok,
5108                 }
5109         }
5110 }
5111 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5112         fn clone(&self) -> Self {
5113                 if self.result_ok {
5114                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5115                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5116                         } }
5117                 } else {
5118                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5119                                 err: core::ptr::null_mut()
5120                         } }
5121                 }
5122         }
5123 }
5124 #[no_mangle]
5125 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5126 /// but with all dynamically-allocated buffers duplicated in new buffers.
5127 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5128 #[repr(C)]
5129 /// The contents of CResult_SecretKeyNoneZ
5130 pub union CResult_SecretKeyNoneZPtr {
5131         /// A pointer to the contents in the success state.
5132         /// Reading from this pointer when `result_ok` is not set is undefined.
5133         pub result: *mut crate::c_types::SecretKey,
5134         /// Note that this value is always NULL, as there are no contents in the Err variant
5135         pub err: *mut core::ffi::c_void,
5136 }
5137 #[repr(C)]
5138 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5139 /// containing a crate::c_types::SecretKey on success and a () on failure.
5140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5141 pub struct CResult_SecretKeyNoneZ {
5142         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5143         /// `err` or `result` depending on the state of `result_ok`.
5144         pub contents: CResult_SecretKeyNoneZPtr,
5145         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5146         pub result_ok: bool,
5147 }
5148 #[no_mangle]
5149 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5150 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5151         CResult_SecretKeyNoneZ {
5152                 contents: CResult_SecretKeyNoneZPtr {
5153                         result: Box::into_raw(Box::new(o)),
5154                 },
5155                 result_ok: true,
5156         }
5157 }
5158 #[no_mangle]
5159 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5160 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5161         CResult_SecretKeyNoneZ {
5162                 contents: CResult_SecretKeyNoneZPtr {
5163                         err: core::ptr::null_mut(),
5164                 },
5165                 result_ok: false,
5166         }
5167 }
5168 /// Checks if the given object is currently in the success state
5169 #[no_mangle]
5170 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5171         o.result_ok
5172 }
5173 #[no_mangle]
5174 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5175 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5176 impl Drop for CResult_SecretKeyNoneZ {
5177         fn drop(&mut self) {
5178                 if self.result_ok {
5179                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5180                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5181                         }
5182                 } else {
5183                 }
5184         }
5185 }
5186 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5187         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5188                 let contents = if o.result_ok {
5189                         let result = unsafe { o.contents.result };
5190                         unsafe { o.contents.result = core::ptr::null_mut() };
5191                         CResult_SecretKeyNoneZPtr { result }
5192                 } else {
5193                         let _ = unsafe { Box::from_raw(o.contents.err) };
5194                         o.contents.err = core::ptr::null_mut();
5195                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5196                 };
5197                 Self {
5198                         contents,
5199                         result_ok: o.result_ok,
5200                 }
5201         }
5202 }
5203 impl Clone for CResult_SecretKeyNoneZ {
5204         fn clone(&self) -> Self {
5205                 if self.result_ok {
5206                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5207                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5208                         } }
5209                 } else {
5210                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5211                                 err: core::ptr::null_mut()
5212                         } }
5213                 }
5214         }
5215 }
5216 #[no_mangle]
5217 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5218 /// but with all dynamically-allocated buffers duplicated in new buffers.
5219 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5220 #[repr(C)]
5221 /// The contents of CResult_SignDecodeErrorZ
5222 pub union CResult_SignDecodeErrorZPtr {
5223         /// A pointer to the contents in the success state.
5224         /// Reading from this pointer when `result_ok` is not set is undefined.
5225         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5226         /// A pointer to the contents in the error state.
5227         /// Reading from this pointer when `result_ok` is set is undefined.
5228         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5229 }
5230 #[repr(C)]
5231 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5232 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5233 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5234 pub struct CResult_SignDecodeErrorZ {
5235         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5236         /// `err` or `result` depending on the state of `result_ok`.
5237         pub contents: CResult_SignDecodeErrorZPtr,
5238         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5239         pub result_ok: bool,
5240 }
5241 #[no_mangle]
5242 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5243 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5244         CResult_SignDecodeErrorZ {
5245                 contents: CResult_SignDecodeErrorZPtr {
5246                         result: Box::into_raw(Box::new(o)),
5247                 },
5248                 result_ok: true,
5249         }
5250 }
5251 #[no_mangle]
5252 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5254         CResult_SignDecodeErrorZ {
5255                 contents: CResult_SignDecodeErrorZPtr {
5256                         err: Box::into_raw(Box::new(e)),
5257                 },
5258                 result_ok: false,
5259         }
5260 }
5261 /// Checks if the given object is currently in the success state
5262 #[no_mangle]
5263 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5264         o.result_ok
5265 }
5266 #[no_mangle]
5267 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5268 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5269 impl Drop for CResult_SignDecodeErrorZ {
5270         fn drop(&mut self) {
5271                 if self.result_ok {
5272                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5273                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5274                         }
5275                 } else {
5276                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5277                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5278                         }
5279                 }
5280         }
5281 }
5282 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5283         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5284                 let contents = if o.result_ok {
5285                         let result = unsafe { o.contents.result };
5286                         unsafe { o.contents.result = core::ptr::null_mut() };
5287                         CResult_SignDecodeErrorZPtr { result }
5288                 } else {
5289                         let err = unsafe { o.contents.err };
5290                         unsafe { o.contents.err = core::ptr::null_mut(); }
5291                         CResult_SignDecodeErrorZPtr { err }
5292                 };
5293                 Self {
5294                         contents,
5295                         result_ok: o.result_ok,
5296                 }
5297         }
5298 }
5299 impl Clone for CResult_SignDecodeErrorZ {
5300         fn clone(&self) -> Self {
5301                 if self.result_ok {
5302                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5303                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5304                         } }
5305                 } else {
5306                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5307                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5308                         } }
5309                 }
5310         }
5311 }
5312 #[no_mangle]
5313 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5314 /// but with all dynamically-allocated buffers duplicated in new buffers.
5315 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5316 #[repr(C)]
5317 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5318 /// This corresponds to std::vector in C++
5319 pub struct CVec_u5Z {
5320         /// The elements in the array.
5321         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5322         pub data: *mut crate::c_types::u5,
5323         /// The number of elements pointed to by `data`.
5324         pub datalen: usize
5325 }
5326 impl CVec_u5Z {
5327         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5328                 if self.datalen == 0 { return Vec::new(); }
5329                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5330                 self.data = core::ptr::null_mut();
5331                 self.datalen = 0;
5332                 ret
5333         }
5334         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5335                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5336         }
5337 }
5338 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5339         fn from(v: Vec<crate::c_types::u5>) -> Self {
5340                 let datalen = v.len();
5341                 let data = Box::into_raw(v.into_boxed_slice());
5342                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5343         }
5344 }
5345 #[no_mangle]
5346 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5347 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5348 impl Drop for CVec_u5Z {
5349         fn drop(&mut self) {
5350                 if self.datalen == 0 { return; }
5351                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5352         }
5353 }
5354 impl Clone for CVec_u5Z {
5355         fn clone(&self) -> Self {
5356                 let mut res = Vec::new();
5357                 if self.datalen == 0 { return Self::from(res); }
5358                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5359                 Self::from(res)
5360         }
5361 }
5362 #[repr(C)]
5363 /// The contents of CResult_RecoverableSignatureNoneZ
5364 pub union CResult_RecoverableSignatureNoneZPtr {
5365         /// A pointer to the contents in the success state.
5366         /// Reading from this pointer when `result_ok` is not set is undefined.
5367         pub result: *mut crate::c_types::RecoverableSignature,
5368         /// Note that this value is always NULL, as there are no contents in the Err variant
5369         pub err: *mut core::ffi::c_void,
5370 }
5371 #[repr(C)]
5372 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5373 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5375 pub struct CResult_RecoverableSignatureNoneZ {
5376         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5377         /// `err` or `result` depending on the state of `result_ok`.
5378         pub contents: CResult_RecoverableSignatureNoneZPtr,
5379         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5380         pub result_ok: bool,
5381 }
5382 #[no_mangle]
5383 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5384 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5385         CResult_RecoverableSignatureNoneZ {
5386                 contents: CResult_RecoverableSignatureNoneZPtr {
5387                         result: Box::into_raw(Box::new(o)),
5388                 },
5389                 result_ok: true,
5390         }
5391 }
5392 #[no_mangle]
5393 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5394 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5395         CResult_RecoverableSignatureNoneZ {
5396                 contents: CResult_RecoverableSignatureNoneZPtr {
5397                         err: core::ptr::null_mut(),
5398                 },
5399                 result_ok: false,
5400         }
5401 }
5402 /// Checks if the given object is currently in the success state
5403 #[no_mangle]
5404 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5405         o.result_ok
5406 }
5407 #[no_mangle]
5408 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5409 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5410 impl Drop for CResult_RecoverableSignatureNoneZ {
5411         fn drop(&mut self) {
5412                 if self.result_ok {
5413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5415                         }
5416                 } else {
5417                 }
5418         }
5419 }
5420 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5421         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5422                 let contents = if o.result_ok {
5423                         let result = unsafe { o.contents.result };
5424                         unsafe { o.contents.result = core::ptr::null_mut() };
5425                         CResult_RecoverableSignatureNoneZPtr { result }
5426                 } else {
5427                         let _ = unsafe { Box::from_raw(o.contents.err) };
5428                         o.contents.err = core::ptr::null_mut();
5429                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5430                 };
5431                 Self {
5432                         contents,
5433                         result_ok: o.result_ok,
5434                 }
5435         }
5436 }
5437 impl Clone for CResult_RecoverableSignatureNoneZ {
5438         fn clone(&self) -> Self {
5439                 if self.result_ok {
5440                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5441                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5442                         } }
5443                 } else {
5444                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5445                                 err: core::ptr::null_mut()
5446                         } }
5447                 }
5448         }
5449 }
5450 #[no_mangle]
5451 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5452 /// but with all dynamically-allocated buffers duplicated in new buffers.
5453 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5454 #[repr(C)]
5455 /// A dynamically-allocated array of u8s of arbitrary size.
5456 /// This corresponds to std::vector in C++
5457 pub struct CVec_u8Z {
5458         /// The elements in the array.
5459         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5460         pub data: *mut u8,
5461         /// The number of elements pointed to by `data`.
5462         pub datalen: usize
5463 }
5464 impl CVec_u8Z {
5465         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5466                 if self.datalen == 0 { return Vec::new(); }
5467                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5468                 self.data = core::ptr::null_mut();
5469                 self.datalen = 0;
5470                 ret
5471         }
5472         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5473                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5474         }
5475 }
5476 impl From<Vec<u8>> for CVec_u8Z {
5477         fn from(v: Vec<u8>) -> Self {
5478                 let datalen = v.len();
5479                 let data = Box::into_raw(v.into_boxed_slice());
5480                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5481         }
5482 }
5483 #[no_mangle]
5484 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5485 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5486 impl Drop for CVec_u8Z {
5487         fn drop(&mut self) {
5488                 if self.datalen == 0 { return; }
5489                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5490         }
5491 }
5492 impl Clone for CVec_u8Z {
5493         fn clone(&self) -> Self {
5494                 let mut res = Vec::new();
5495                 if self.datalen == 0 { return Self::from(res); }
5496                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5497                 Self::from(res)
5498         }
5499 }
5500 #[repr(C)]
5501 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5502 /// This corresponds to std::vector in C++
5503 pub struct CVec_CVec_u8ZZ {
5504         /// The elements in the array.
5505         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5506         pub data: *mut crate::c_types::derived::CVec_u8Z,
5507         /// The number of elements pointed to by `data`.
5508         pub datalen: usize
5509 }
5510 impl CVec_CVec_u8ZZ {
5511         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5512                 if self.datalen == 0 { return Vec::new(); }
5513                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5514                 self.data = core::ptr::null_mut();
5515                 self.datalen = 0;
5516                 ret
5517         }
5518         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5519                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5520         }
5521 }
5522 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5523         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5524                 let datalen = v.len();
5525                 let data = Box::into_raw(v.into_boxed_slice());
5526                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5527         }
5528 }
5529 #[no_mangle]
5530 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5531 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5532 impl Drop for CVec_CVec_u8ZZ {
5533         fn drop(&mut self) {
5534                 if self.datalen == 0 { return; }
5535                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5536         }
5537 }
5538 impl Clone for CVec_CVec_u8ZZ {
5539         fn clone(&self) -> Self {
5540                 let mut res = Vec::new();
5541                 if self.datalen == 0 { return Self::from(res); }
5542                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5543                 Self::from(res)
5544         }
5545 }
5546 #[repr(C)]
5547 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5548 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5549         /// A pointer to the contents in the success state.
5550         /// Reading from this pointer when `result_ok` is not set is undefined.
5551         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5552         /// Note that this value is always NULL, as there are no contents in the Err variant
5553         pub err: *mut core::ffi::c_void,
5554 }
5555 #[repr(C)]
5556 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5557 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5559 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5560         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5561         /// `err` or `result` depending on the state of `result_ok`.
5562         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5563         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5564         pub result_ok: bool,
5565 }
5566 #[no_mangle]
5567 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5568 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5569         CResult_CVec_CVec_u8ZZNoneZ {
5570                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5571                         result: Box::into_raw(Box::new(o)),
5572                 },
5573                 result_ok: true,
5574         }
5575 }
5576 #[no_mangle]
5577 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5578 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5579         CResult_CVec_CVec_u8ZZNoneZ {
5580                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5581                         err: core::ptr::null_mut(),
5582                 },
5583                 result_ok: false,
5584         }
5585 }
5586 /// Checks if the given object is currently in the success state
5587 #[no_mangle]
5588 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5589         o.result_ok
5590 }
5591 #[no_mangle]
5592 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5593 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5594 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5595         fn drop(&mut self) {
5596                 if self.result_ok {
5597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5599                         }
5600                 } else {
5601                 }
5602         }
5603 }
5604 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5605         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5606                 let contents = if o.result_ok {
5607                         let result = unsafe { o.contents.result };
5608                         unsafe { o.contents.result = core::ptr::null_mut() };
5609                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5610                 } else {
5611                         let _ = unsafe { Box::from_raw(o.contents.err) };
5612                         o.contents.err = core::ptr::null_mut();
5613                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5614                 };
5615                 Self {
5616                         contents,
5617                         result_ok: o.result_ok,
5618                 }
5619         }
5620 }
5621 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5622         fn clone(&self) -> Self {
5623                 if self.result_ok {
5624                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5625                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5626                         } }
5627                 } else {
5628                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5629                                 err: core::ptr::null_mut()
5630                         } }
5631                 }
5632         }
5633 }
5634 #[no_mangle]
5635 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5636 /// but with all dynamically-allocated buffers duplicated in new buffers.
5637 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5638 #[repr(C)]
5639 /// The contents of CResult_InMemorySignerDecodeErrorZ
5640 pub union CResult_InMemorySignerDecodeErrorZPtr {
5641         /// A pointer to the contents in the success state.
5642         /// Reading from this pointer when `result_ok` is not set is undefined.
5643         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5644         /// A pointer to the contents in the error state.
5645         /// Reading from this pointer when `result_ok` is set is undefined.
5646         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5647 }
5648 #[repr(C)]
5649 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5650 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5651 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5652 pub struct CResult_InMemorySignerDecodeErrorZ {
5653         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5654         /// `err` or `result` depending on the state of `result_ok`.
5655         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5656         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5657         pub result_ok: bool,
5658 }
5659 #[no_mangle]
5660 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5661 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5662         CResult_InMemorySignerDecodeErrorZ {
5663                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5664                         result: Box::into_raw(Box::new(o)),
5665                 },
5666                 result_ok: true,
5667         }
5668 }
5669 #[no_mangle]
5670 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5672         CResult_InMemorySignerDecodeErrorZ {
5673                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5674                         err: Box::into_raw(Box::new(e)),
5675                 },
5676                 result_ok: false,
5677         }
5678 }
5679 /// Checks if the given object is currently in the success state
5680 #[no_mangle]
5681 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5682         o.result_ok
5683 }
5684 #[no_mangle]
5685 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5686 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5687 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5688         fn drop(&mut self) {
5689                 if self.result_ok {
5690                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5691                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5692                         }
5693                 } else {
5694                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5695                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5696                         }
5697                 }
5698         }
5699 }
5700 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5701         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5702                 let contents = if o.result_ok {
5703                         let result = unsafe { o.contents.result };
5704                         unsafe { o.contents.result = core::ptr::null_mut() };
5705                         CResult_InMemorySignerDecodeErrorZPtr { result }
5706                 } else {
5707                         let err = unsafe { o.contents.err };
5708                         unsafe { o.contents.err = core::ptr::null_mut(); }
5709                         CResult_InMemorySignerDecodeErrorZPtr { err }
5710                 };
5711                 Self {
5712                         contents,
5713                         result_ok: o.result_ok,
5714                 }
5715         }
5716 }
5717 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5718         fn clone(&self) -> Self {
5719                 if self.result_ok {
5720                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5721                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5722                         } }
5723                 } else {
5724                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5725                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5726                         } }
5727                 }
5728         }
5729 }
5730 #[no_mangle]
5731 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5732 /// but with all dynamically-allocated buffers duplicated in new buffers.
5733 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5734 #[repr(C)]
5735 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5736 /// This corresponds to std::vector in C++
5737 pub struct CVec_TxOutZ {
5738         /// The elements in the array.
5739         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5740         pub data: *mut crate::c_types::TxOut,
5741         /// The number of elements pointed to by `data`.
5742         pub datalen: usize
5743 }
5744 impl CVec_TxOutZ {
5745         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5746                 if self.datalen == 0 { return Vec::new(); }
5747                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5748                 self.data = core::ptr::null_mut();
5749                 self.datalen = 0;
5750                 ret
5751         }
5752         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5753                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5754         }
5755 }
5756 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5757         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5758                 let datalen = v.len();
5759                 let data = Box::into_raw(v.into_boxed_slice());
5760                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5761         }
5762 }
5763 #[no_mangle]
5764 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5765 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5766 impl Drop for CVec_TxOutZ {
5767         fn drop(&mut self) {
5768                 if self.datalen == 0 { return; }
5769                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5770         }
5771 }
5772 impl Clone for CVec_TxOutZ {
5773         fn clone(&self) -> Self {
5774                 let mut res = Vec::new();
5775                 if self.datalen == 0 { return Self::from(res); }
5776                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5777                 Self::from(res)
5778         }
5779 }
5780 #[repr(C)]
5781 /// The contents of CResult_TransactionNoneZ
5782 pub union CResult_TransactionNoneZPtr {
5783         /// A pointer to the contents in the success state.
5784         /// Reading from this pointer when `result_ok` is not set is undefined.
5785         pub result: *mut crate::c_types::Transaction,
5786         /// Note that this value is always NULL, as there are no contents in the Err variant
5787         pub err: *mut core::ffi::c_void,
5788 }
5789 #[repr(C)]
5790 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5791 /// containing a crate::c_types::Transaction on success and a () on failure.
5792 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5793 pub struct CResult_TransactionNoneZ {
5794         /// The contents of this CResult_TransactionNoneZ, accessible via either
5795         /// `err` or `result` depending on the state of `result_ok`.
5796         pub contents: CResult_TransactionNoneZPtr,
5797         /// Whether this CResult_TransactionNoneZ represents a success state.
5798         pub result_ok: bool,
5799 }
5800 #[no_mangle]
5801 /// Creates a new CResult_TransactionNoneZ in the success state.
5802 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5803         CResult_TransactionNoneZ {
5804                 contents: CResult_TransactionNoneZPtr {
5805                         result: Box::into_raw(Box::new(o)),
5806                 },
5807                 result_ok: true,
5808         }
5809 }
5810 #[no_mangle]
5811 /// Creates a new CResult_TransactionNoneZ in the error state.
5812 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5813         CResult_TransactionNoneZ {
5814                 contents: CResult_TransactionNoneZPtr {
5815                         err: core::ptr::null_mut(),
5816                 },
5817                 result_ok: false,
5818         }
5819 }
5820 /// Checks if the given object is currently in the success state
5821 #[no_mangle]
5822 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5823         o.result_ok
5824 }
5825 #[no_mangle]
5826 /// Frees any resources used by the CResult_TransactionNoneZ.
5827 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5828 impl Drop for CResult_TransactionNoneZ {
5829         fn drop(&mut self) {
5830                 if self.result_ok {
5831                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5832                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5833                         }
5834                 } else {
5835                 }
5836         }
5837 }
5838 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5839         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5840                 let contents = if o.result_ok {
5841                         let result = unsafe { o.contents.result };
5842                         unsafe { o.contents.result = core::ptr::null_mut() };
5843                         CResult_TransactionNoneZPtr { result }
5844                 } else {
5845                         let _ = unsafe { Box::from_raw(o.contents.err) };
5846                         o.contents.err = core::ptr::null_mut();
5847                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5848                 };
5849                 Self {
5850                         contents,
5851                         result_ok: o.result_ok,
5852                 }
5853         }
5854 }
5855 impl Clone for CResult_TransactionNoneZ {
5856         fn clone(&self) -> Self {
5857                 if self.result_ok {
5858                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5859                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5860                         } }
5861                 } else {
5862                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5863                                 err: core::ptr::null_mut()
5864                         } }
5865                 }
5866         }
5867 }
5868 #[no_mangle]
5869 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5870 /// but with all dynamically-allocated buffers duplicated in new buffers.
5871 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5872 #[repr(C)]
5873 /// A tuple of 2 elements. See the individual fields for the types contained.
5874 pub struct C2Tuple_BlockHashChannelMonitorZ {
5875         /// The element at position 0
5876         pub a: crate::c_types::ThirtyTwoBytes,
5877         /// The element at position 1
5878         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5879 }
5880 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5881         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5882                 Self {
5883                         a: tup.0,
5884                         b: tup.1,
5885                 }
5886         }
5887 }
5888 impl C2Tuple_BlockHashChannelMonitorZ {
5889         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5890                 (self.a, self.b)
5891         }
5892 }
5893 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5894 #[no_mangle]
5895 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5896         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5897 }
5898
5899 #[no_mangle]
5900 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5901 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5902 #[repr(C)]
5903 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5904 /// This corresponds to std::vector in C++
5905 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5906         /// The elements in the array.
5907         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5908         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5909         /// The number of elements pointed to by `data`.
5910         pub datalen: usize
5911 }
5912 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5913         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5914                 if self.datalen == 0 { return Vec::new(); }
5915                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5916                 self.data = core::ptr::null_mut();
5917                 self.datalen = 0;
5918                 ret
5919         }
5920         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5921                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5922         }
5923 }
5924 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5925         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5926                 let datalen = v.len();
5927                 let data = Box::into_raw(v.into_boxed_slice());
5928                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5929         }
5930 }
5931 #[no_mangle]
5932 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5933 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5934 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5935         fn drop(&mut self) {
5936                 if self.datalen == 0 { return; }
5937                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5938         }
5939 }
5940 #[repr(C)]
5941 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5942 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5943         /// A pointer to the contents in the success state.
5944         /// Reading from this pointer when `result_ok` is not set is undefined.
5945         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5946         /// A pointer to the contents in the error state.
5947         /// Reading from this pointer when `result_ok` is set is undefined.
5948         pub err: *mut crate::c_types::IOError,
5949 }
5950 #[repr(C)]
5951 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5952 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5953 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5954 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5955         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5956         /// `err` or `result` depending on the state of `result_ok`.
5957         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5958         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5959         pub result_ok: bool,
5960 }
5961 #[no_mangle]
5962 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5963 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5964         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5965                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5966                         result: Box::into_raw(Box::new(o)),
5967                 },
5968                 result_ok: true,
5969         }
5970 }
5971 #[no_mangle]
5972 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5973 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5974         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5975                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5976                         err: Box::into_raw(Box::new(e)),
5977                 },
5978                 result_ok: false,
5979         }
5980 }
5981 /// Checks if the given object is currently in the success state
5982 #[no_mangle]
5983 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5984         o.result_ok
5985 }
5986 #[no_mangle]
5987 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5988 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5989 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5990         fn drop(&mut self) {
5991                 if self.result_ok {
5992                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5993                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5994                         }
5995                 } else {
5996                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5997                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5998                         }
5999                 }
6000         }
6001 }
6002 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6003         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6004                 let contents = if o.result_ok {
6005                         let result = unsafe { o.contents.result };
6006                         unsafe { o.contents.result = core::ptr::null_mut() };
6007                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6008                 } else {
6009                         let err = unsafe { o.contents.err };
6010                         unsafe { o.contents.err = core::ptr::null_mut(); }
6011                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6012                 };
6013                 Self {
6014                         contents,
6015                         result_ok: o.result_ok,
6016                 }
6017         }
6018 }
6019 #[repr(C)]
6020 #[derive(Clone)]
6021 /// An enum which can either contain a u16 or not
6022 pub enum COption_u16Z {
6023         /// When we're in this state, this COption_u16Z contains a u16
6024         Some(u16),
6025         /// When we're in this state, this COption_u16Z contains nothing
6026         None
6027 }
6028 impl COption_u16Z {
6029         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6030                 if let Self::None = self { false } else { true }
6031         }
6032         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6033                 !self.is_some()
6034         }
6035         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6036                 if let Self::Some(v) = self { v } else { unreachable!() }
6037         }
6038 }
6039 #[no_mangle]
6040 /// Constructs a new COption_u16Z containing a u16
6041 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6042         COption_u16Z::Some(o)
6043 }
6044 #[no_mangle]
6045 /// Constructs a new COption_u16Z containing nothing
6046 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6047         COption_u16Z::None
6048 }
6049 #[no_mangle]
6050 /// Frees any resources associated with the u16, if we are in the Some state
6051 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6052 #[no_mangle]
6053 /// Creates a new COption_u16Z which has the same data as `orig`
6054 /// but with all dynamically-allocated buffers duplicated in new buffers.
6055 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6056 #[repr(C)]
6057 /// The contents of CResult_NoneAPIErrorZ
6058 pub union CResult_NoneAPIErrorZPtr {
6059         /// Note that this value is always NULL, as there are no contents in the OK variant
6060         pub result: *mut core::ffi::c_void,
6061         /// A pointer to the contents in the error state.
6062         /// Reading from this pointer when `result_ok` is set is undefined.
6063         pub err: *mut crate::lightning::util::errors::APIError,
6064 }
6065 #[repr(C)]
6066 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6067 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6068 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6069 pub struct CResult_NoneAPIErrorZ {
6070         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6071         /// `err` or `result` depending on the state of `result_ok`.
6072         pub contents: CResult_NoneAPIErrorZPtr,
6073         /// Whether this CResult_NoneAPIErrorZ represents a success state.
6074         pub result_ok: bool,
6075 }
6076 #[no_mangle]
6077 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6078 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6079         CResult_NoneAPIErrorZ {
6080                 contents: CResult_NoneAPIErrorZPtr {
6081                         result: core::ptr::null_mut(),
6082                 },
6083                 result_ok: true,
6084         }
6085 }
6086 #[no_mangle]
6087 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6088 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6089         CResult_NoneAPIErrorZ {
6090                 contents: CResult_NoneAPIErrorZPtr {
6091                         err: Box::into_raw(Box::new(e)),
6092                 },
6093                 result_ok: false,
6094         }
6095 }
6096 /// Checks if the given object is currently in the success state
6097 #[no_mangle]
6098 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6099         o.result_ok
6100 }
6101 #[no_mangle]
6102 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6103 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6104 impl Drop for CResult_NoneAPIErrorZ {
6105         fn drop(&mut self) {
6106                 if self.result_ok {
6107                 } else {
6108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6110                         }
6111                 }
6112         }
6113 }
6114 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6115         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6116                 let contents = if o.result_ok {
6117                         let _ = unsafe { Box::from_raw(o.contents.result) };
6118                         o.contents.result = core::ptr::null_mut();
6119                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6120                 } else {
6121                         let err = unsafe { o.contents.err };
6122                         unsafe { o.contents.err = core::ptr::null_mut(); }
6123                         CResult_NoneAPIErrorZPtr { err }
6124                 };
6125                 Self {
6126                         contents,
6127                         result_ok: o.result_ok,
6128                 }
6129         }
6130 }
6131 impl Clone for CResult_NoneAPIErrorZ {
6132         fn clone(&self) -> Self {
6133                 if self.result_ok {
6134                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6135                                 result: core::ptr::null_mut()
6136                         } }
6137                 } else {
6138                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6139                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6140                         } }
6141                 }
6142         }
6143 }
6144 #[no_mangle]
6145 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6146 /// but with all dynamically-allocated buffers duplicated in new buffers.
6147 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6148 #[repr(C)]
6149 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6150 /// This corresponds to std::vector in C++
6151 pub struct CVec_CResult_NoneAPIErrorZZ {
6152         /// The elements in the array.
6153         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6154         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6155         /// The number of elements pointed to by `data`.
6156         pub datalen: usize
6157 }
6158 impl CVec_CResult_NoneAPIErrorZZ {
6159         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6160                 if self.datalen == 0 { return Vec::new(); }
6161                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6162                 self.data = core::ptr::null_mut();
6163                 self.datalen = 0;
6164                 ret
6165         }
6166         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6167                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6168         }
6169 }
6170 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6171         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6172                 let datalen = v.len();
6173                 let data = Box::into_raw(v.into_boxed_slice());
6174                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6175         }
6176 }
6177 #[no_mangle]
6178 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6179 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6180 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6181         fn drop(&mut self) {
6182                 if self.datalen == 0 { return; }
6183                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6184         }
6185 }
6186 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6187         fn clone(&self) -> Self {
6188                 let mut res = Vec::new();
6189                 if self.datalen == 0 { return Self::from(res); }
6190                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6191                 Self::from(res)
6192         }
6193 }
6194 #[repr(C)]
6195 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6196 /// This corresponds to std::vector in C++
6197 pub struct CVec_APIErrorZ {
6198         /// The elements in the array.
6199         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6200         pub data: *mut crate::lightning::util::errors::APIError,
6201         /// The number of elements pointed to by `data`.
6202         pub datalen: usize
6203 }
6204 impl CVec_APIErrorZ {
6205         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6206                 if self.datalen == 0 { return Vec::new(); }
6207                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6208                 self.data = core::ptr::null_mut();
6209                 self.datalen = 0;
6210                 ret
6211         }
6212         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6213                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6214         }
6215 }
6216 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6217         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6218                 let datalen = v.len();
6219                 let data = Box::into_raw(v.into_boxed_slice());
6220                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6221         }
6222 }
6223 #[no_mangle]
6224 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6225 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6226 impl Drop for CVec_APIErrorZ {
6227         fn drop(&mut self) {
6228                 if self.datalen == 0 { return; }
6229                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6230         }
6231 }
6232 impl Clone for CVec_APIErrorZ {
6233         fn clone(&self) -> Self {
6234                 let mut res = Vec::new();
6235                 if self.datalen == 0 { return Self::from(res); }
6236                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6237                 Self::from(res)
6238         }
6239 }
6240 #[repr(C)]
6241 /// The contents of CResult__u832APIErrorZ
6242 pub union CResult__u832APIErrorZPtr {
6243         /// A pointer to the contents in the success state.
6244         /// Reading from this pointer when `result_ok` is not set is undefined.
6245         pub result: *mut crate::c_types::ThirtyTwoBytes,
6246         /// A pointer to the contents in the error state.
6247         /// Reading from this pointer when `result_ok` is set is undefined.
6248         pub err: *mut crate::lightning::util::errors::APIError,
6249 }
6250 #[repr(C)]
6251 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6252 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6254 pub struct CResult__u832APIErrorZ {
6255         /// The contents of this CResult__u832APIErrorZ, accessible via either
6256         /// `err` or `result` depending on the state of `result_ok`.
6257         pub contents: CResult__u832APIErrorZPtr,
6258         /// Whether this CResult__u832APIErrorZ represents a success state.
6259         pub result_ok: bool,
6260 }
6261 #[no_mangle]
6262 /// Creates a new CResult__u832APIErrorZ in the success state.
6263 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6264         CResult__u832APIErrorZ {
6265                 contents: CResult__u832APIErrorZPtr {
6266                         result: Box::into_raw(Box::new(o)),
6267                 },
6268                 result_ok: true,
6269         }
6270 }
6271 #[no_mangle]
6272 /// Creates a new CResult__u832APIErrorZ in the error state.
6273 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6274         CResult__u832APIErrorZ {
6275                 contents: CResult__u832APIErrorZPtr {
6276                         err: Box::into_raw(Box::new(e)),
6277                 },
6278                 result_ok: false,
6279         }
6280 }
6281 /// Checks if the given object is currently in the success state
6282 #[no_mangle]
6283 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6284         o.result_ok
6285 }
6286 #[no_mangle]
6287 /// Frees any resources used by the CResult__u832APIErrorZ.
6288 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6289 impl Drop for CResult__u832APIErrorZ {
6290         fn drop(&mut self) {
6291                 if self.result_ok {
6292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6294                         }
6295                 } else {
6296                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6297                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6298                         }
6299                 }
6300         }
6301 }
6302 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6303         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6304                 let contents = if o.result_ok {
6305                         let result = unsafe { o.contents.result };
6306                         unsafe { o.contents.result = core::ptr::null_mut() };
6307                         CResult__u832APIErrorZPtr { result }
6308                 } else {
6309                         let err = unsafe { o.contents.err };
6310                         unsafe { o.contents.err = core::ptr::null_mut(); }
6311                         CResult__u832APIErrorZPtr { err }
6312                 };
6313                 Self {
6314                         contents,
6315                         result_ok: o.result_ok,
6316                 }
6317         }
6318 }
6319 impl Clone for CResult__u832APIErrorZ {
6320         fn clone(&self) -> Self {
6321                 if self.result_ok {
6322                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6323                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6324                         } }
6325                 } else {
6326                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6327                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6328                         } }
6329                 }
6330         }
6331 }
6332 #[no_mangle]
6333 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6334 /// but with all dynamically-allocated buffers duplicated in new buffers.
6335 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6336 #[repr(C)]
6337 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6338 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6339         /// A pointer to the contents in the success state.
6340         /// Reading from this pointer when `result_ok` is not set is undefined.
6341         pub result: *mut crate::c_types::ThirtyTwoBytes,
6342         /// A pointer to the contents in the error state.
6343         /// Reading from this pointer when `result_ok` is set is undefined.
6344         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6345 }
6346 #[repr(C)]
6347 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6348 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6349 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6350 pub struct CResult_PaymentIdPaymentSendFailureZ {
6351         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6352         /// `err` or `result` depending on the state of `result_ok`.
6353         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6354         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6355         pub result_ok: bool,
6356 }
6357 #[no_mangle]
6358 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6359 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6360         CResult_PaymentIdPaymentSendFailureZ {
6361                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6362                         result: Box::into_raw(Box::new(o)),
6363                 },
6364                 result_ok: true,
6365         }
6366 }
6367 #[no_mangle]
6368 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6370         CResult_PaymentIdPaymentSendFailureZ {
6371                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6372                         err: Box::into_raw(Box::new(e)),
6373                 },
6374                 result_ok: false,
6375         }
6376 }
6377 /// Checks if the given object is currently in the success state
6378 #[no_mangle]
6379 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6380         o.result_ok
6381 }
6382 #[no_mangle]
6383 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6384 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6385 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6386         fn drop(&mut self) {
6387                 if self.result_ok {
6388                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6389                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6390                         }
6391                 } else {
6392                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6393                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6394                         }
6395                 }
6396         }
6397 }
6398 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6399         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6400                 let contents = if o.result_ok {
6401                         let result = unsafe { o.contents.result };
6402                         unsafe { o.contents.result = core::ptr::null_mut() };
6403                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6404                 } else {
6405                         let err = unsafe { o.contents.err };
6406                         unsafe { o.contents.err = core::ptr::null_mut(); }
6407                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6408                 };
6409                 Self {
6410                         contents,
6411                         result_ok: o.result_ok,
6412                 }
6413         }
6414 }
6415 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6416         fn clone(&self) -> Self {
6417                 if self.result_ok {
6418                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6419                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6420                         } }
6421                 } else {
6422                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6423                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6424                         } }
6425                 }
6426         }
6427 }
6428 #[no_mangle]
6429 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6430 /// but with all dynamically-allocated buffers duplicated in new buffers.
6431 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6432 #[repr(C)]
6433 /// The contents of CResult_NonePaymentSendFailureZ
6434 pub union CResult_NonePaymentSendFailureZPtr {
6435         /// Note that this value is always NULL, as there are no contents in the OK variant
6436         pub result: *mut core::ffi::c_void,
6437         /// A pointer to the contents in the error state.
6438         /// Reading from this pointer when `result_ok` is set is undefined.
6439         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6440 }
6441 #[repr(C)]
6442 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6443 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6444 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6445 pub struct CResult_NonePaymentSendFailureZ {
6446         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6447         /// `err` or `result` depending on the state of `result_ok`.
6448         pub contents: CResult_NonePaymentSendFailureZPtr,
6449         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6450         pub result_ok: bool,
6451 }
6452 #[no_mangle]
6453 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6454 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6455         CResult_NonePaymentSendFailureZ {
6456                 contents: CResult_NonePaymentSendFailureZPtr {
6457                         result: core::ptr::null_mut(),
6458                 },
6459                 result_ok: true,
6460         }
6461 }
6462 #[no_mangle]
6463 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6464 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6465         CResult_NonePaymentSendFailureZ {
6466                 contents: CResult_NonePaymentSendFailureZPtr {
6467                         err: Box::into_raw(Box::new(e)),
6468                 },
6469                 result_ok: false,
6470         }
6471 }
6472 /// Checks if the given object is currently in the success state
6473 #[no_mangle]
6474 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6475         o.result_ok
6476 }
6477 #[no_mangle]
6478 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6479 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6480 impl Drop for CResult_NonePaymentSendFailureZ {
6481         fn drop(&mut self) {
6482                 if self.result_ok {
6483                 } else {
6484                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6485                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6486                         }
6487                 }
6488         }
6489 }
6490 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6491         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6492                 let contents = if o.result_ok {
6493                         let _ = unsafe { Box::from_raw(o.contents.result) };
6494                         o.contents.result = core::ptr::null_mut();
6495                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6496                 } else {
6497                         let err = unsafe { o.contents.err };
6498                         unsafe { o.contents.err = core::ptr::null_mut(); }
6499                         CResult_NonePaymentSendFailureZPtr { err }
6500                 };
6501                 Self {
6502                         contents,
6503                         result_ok: o.result_ok,
6504                 }
6505         }
6506 }
6507 impl Clone for CResult_NonePaymentSendFailureZ {
6508         fn clone(&self) -> Self {
6509                 if self.result_ok {
6510                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6511                                 result: core::ptr::null_mut()
6512                         } }
6513                 } else {
6514                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6515                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6516                         } }
6517                 }
6518         }
6519 }
6520 #[no_mangle]
6521 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6522 /// but with all dynamically-allocated buffers duplicated in new buffers.
6523 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6524 #[repr(C)]
6525 /// A tuple of 2 elements. See the individual fields for the types contained.
6526 pub struct C2Tuple_PaymentHashPaymentIdZ {
6527         /// The element at position 0
6528         pub a: crate::c_types::ThirtyTwoBytes,
6529         /// The element at position 1
6530         pub b: crate::c_types::ThirtyTwoBytes,
6531 }
6532 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6533         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6534                 Self {
6535                         a: tup.0,
6536                         b: tup.1,
6537                 }
6538         }
6539 }
6540 impl C2Tuple_PaymentHashPaymentIdZ {
6541         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6542                 (self.a, self.b)
6543         }
6544 }
6545 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6546         fn clone(&self) -> Self {
6547                 Self {
6548                         a: Clone::clone(&self.a),
6549                         b: Clone::clone(&self.b),
6550                 }
6551         }
6552 }
6553 #[no_mangle]
6554 /// Creates a new tuple which has the same data as `orig`
6555 /// but with all dynamically-allocated buffers duplicated in new buffers.
6556 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6557 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6558 #[no_mangle]
6559 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6560         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6561 }
6562
6563 #[no_mangle]
6564 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6565 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6566 #[repr(C)]
6567 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6568 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6569         /// A pointer to the contents in the success state.
6570         /// Reading from this pointer when `result_ok` is not set is undefined.
6571         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6572         /// A pointer to the contents in the error state.
6573         /// Reading from this pointer when `result_ok` is set is undefined.
6574         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6575 }
6576 #[repr(C)]
6577 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6578 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6580 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6581         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6582         /// `err` or `result` depending on the state of `result_ok`.
6583         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6584         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6585         pub result_ok: bool,
6586 }
6587 #[no_mangle]
6588 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6589 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6590         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6591                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6592                         result: Box::into_raw(Box::new(o)),
6593                 },
6594                 result_ok: true,
6595         }
6596 }
6597 #[no_mangle]
6598 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6600         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6601                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6602                         err: Box::into_raw(Box::new(e)),
6603                 },
6604                 result_ok: false,
6605         }
6606 }
6607 /// Checks if the given object is currently in the success state
6608 #[no_mangle]
6609 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6610         o.result_ok
6611 }
6612 #[no_mangle]
6613 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6614 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6615 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6616         fn drop(&mut self) {
6617                 if self.result_ok {
6618                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6619                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6620                         }
6621                 } else {
6622                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6623                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6624                         }
6625                 }
6626         }
6627 }
6628 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6629         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6630                 let contents = if o.result_ok {
6631                         let result = unsafe { o.contents.result };
6632                         unsafe { o.contents.result = core::ptr::null_mut() };
6633                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6634                 } else {
6635                         let err = unsafe { o.contents.err };
6636                         unsafe { o.contents.err = core::ptr::null_mut(); }
6637                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6638                 };
6639                 Self {
6640                         contents,
6641                         result_ok: o.result_ok,
6642                 }
6643         }
6644 }
6645 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6646         fn clone(&self) -> Self {
6647                 if self.result_ok {
6648                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6649                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6650                         } }
6651                 } else {
6652                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6653                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6654                         } }
6655                 }
6656         }
6657 }
6658 #[no_mangle]
6659 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6660 /// but with all dynamically-allocated buffers duplicated in new buffers.
6661 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6662 #[repr(C)]
6663 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6664 /// This corresponds to std::vector in C++
6665 pub struct CVec_NetAddressZ {
6666         /// The elements in the array.
6667         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6668         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6669         /// The number of elements pointed to by `data`.
6670         pub datalen: usize
6671 }
6672 impl CVec_NetAddressZ {
6673         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6674                 if self.datalen == 0 { return Vec::new(); }
6675                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6676                 self.data = core::ptr::null_mut();
6677                 self.datalen = 0;
6678                 ret
6679         }
6680         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6681                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6682         }
6683 }
6684 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6685         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6686                 let datalen = v.len();
6687                 let data = Box::into_raw(v.into_boxed_slice());
6688                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6689         }
6690 }
6691 #[no_mangle]
6692 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6693 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6694 impl Drop for CVec_NetAddressZ {
6695         fn drop(&mut self) {
6696                 if self.datalen == 0 { return; }
6697                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6698         }
6699 }
6700 impl Clone for CVec_NetAddressZ {
6701         fn clone(&self) -> Self {
6702                 let mut res = Vec::new();
6703                 if self.datalen == 0 { return Self::from(res); }
6704                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6705                 Self::from(res)
6706         }
6707 }
6708 #[repr(C)]
6709 /// A tuple of 2 elements. See the individual fields for the types contained.
6710 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6711         /// The element at position 0
6712         pub a: crate::c_types::ThirtyTwoBytes,
6713         /// The element at position 1
6714         pub b: crate::c_types::ThirtyTwoBytes,
6715 }
6716 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6717         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6718                 Self {
6719                         a: tup.0,
6720                         b: tup.1,
6721                 }
6722         }
6723 }
6724 impl C2Tuple_PaymentHashPaymentSecretZ {
6725         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6726                 (self.a, self.b)
6727         }
6728 }
6729 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6730         fn clone(&self) -> Self {
6731                 Self {
6732                         a: Clone::clone(&self.a),
6733                         b: Clone::clone(&self.b),
6734                 }
6735         }
6736 }
6737 #[no_mangle]
6738 /// Creates a new tuple which has the same data as `orig`
6739 /// but with all dynamically-allocated buffers duplicated in new buffers.
6740 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6741 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6742 #[no_mangle]
6743 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6744         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6745 }
6746
6747 #[no_mangle]
6748 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6749 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6750 #[repr(C)]
6751 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6752 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6753         /// A pointer to the contents in the success state.
6754         /// Reading from this pointer when `result_ok` is not set is undefined.
6755         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6756         /// Note that this value is always NULL, as there are no contents in the Err variant
6757         pub err: *mut core::ffi::c_void,
6758 }
6759 #[repr(C)]
6760 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6761 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6763 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6765         /// `err` or `result` depending on the state of `result_ok`.
6766         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6767         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6768         pub result_ok: bool,
6769 }
6770 #[no_mangle]
6771 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6772 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6773         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6774                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6775                         result: Box::into_raw(Box::new(o)),
6776                 },
6777                 result_ok: true,
6778         }
6779 }
6780 #[no_mangle]
6781 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6782 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6783         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6784                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6785                         err: core::ptr::null_mut(),
6786                 },
6787                 result_ok: false,
6788         }
6789 }
6790 /// Checks if the given object is currently in the success state
6791 #[no_mangle]
6792 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6793         o.result_ok
6794 }
6795 #[no_mangle]
6796 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6797 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6798 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6799         fn drop(&mut self) {
6800                 if self.result_ok {
6801                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6802                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6803                         }
6804                 } else {
6805                 }
6806         }
6807 }
6808 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6809         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6810                 let contents = if o.result_ok {
6811                         let result = unsafe { o.contents.result };
6812                         unsafe { o.contents.result = core::ptr::null_mut() };
6813                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6814                 } else {
6815                         let _ = unsafe { Box::from_raw(o.contents.err) };
6816                         o.contents.err = core::ptr::null_mut();
6817                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6818                 };
6819                 Self {
6820                         contents,
6821                         result_ok: o.result_ok,
6822                 }
6823         }
6824 }
6825 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6826         fn clone(&self) -> Self {
6827                 if self.result_ok {
6828                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6829                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6830                         } }
6831                 } else {
6832                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6833                                 err: core::ptr::null_mut()
6834                         } }
6835                 }
6836         }
6837 }
6838 #[no_mangle]
6839 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6840 /// but with all dynamically-allocated buffers duplicated in new buffers.
6841 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6842 #[repr(C)]
6843 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6844 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6845         /// A pointer to the contents in the success state.
6846         /// Reading from this pointer when `result_ok` is not set is undefined.
6847         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6848         /// A pointer to the contents in the error state.
6849         /// Reading from this pointer when `result_ok` is set is undefined.
6850         pub err: *mut crate::lightning::util::errors::APIError,
6851 }
6852 #[repr(C)]
6853 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6854 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6856 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6857         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6858         /// `err` or `result` depending on the state of `result_ok`.
6859         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6860         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6861         pub result_ok: bool,
6862 }
6863 #[no_mangle]
6864 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6865 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6866         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6867                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6868                         result: Box::into_raw(Box::new(o)),
6869                 },
6870                 result_ok: true,
6871         }
6872 }
6873 #[no_mangle]
6874 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6876         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6877                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6878                         err: Box::into_raw(Box::new(e)),
6879                 },
6880                 result_ok: false,
6881         }
6882 }
6883 /// Checks if the given object is currently in the success state
6884 #[no_mangle]
6885 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6886         o.result_ok
6887 }
6888 #[no_mangle]
6889 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6890 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6891 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6892         fn drop(&mut self) {
6893                 if self.result_ok {
6894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6896                         }
6897                 } else {
6898                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6899                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6900                         }
6901                 }
6902         }
6903 }
6904 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6905         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6906                 let contents = if o.result_ok {
6907                         let result = unsafe { o.contents.result };
6908                         unsafe { o.contents.result = core::ptr::null_mut() };
6909                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6910                 } else {
6911                         let err = unsafe { o.contents.err };
6912                         unsafe { o.contents.err = core::ptr::null_mut(); }
6913                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6914                 };
6915                 Self {
6916                         contents,
6917                         result_ok: o.result_ok,
6918                 }
6919         }
6920 }
6921 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6922         fn clone(&self) -> Self {
6923                 if self.result_ok {
6924                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6925                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6926                         } }
6927                 } else {
6928                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6929                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6930                         } }
6931                 }
6932         }
6933 }
6934 #[no_mangle]
6935 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6936 /// but with all dynamically-allocated buffers duplicated in new buffers.
6937 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6938 #[repr(C)]
6939 /// The contents of CResult_PaymentSecretNoneZ
6940 pub union CResult_PaymentSecretNoneZPtr {
6941         /// A pointer to the contents in the success state.
6942         /// Reading from this pointer when `result_ok` is not set is undefined.
6943         pub result: *mut crate::c_types::ThirtyTwoBytes,
6944         /// Note that this value is always NULL, as there are no contents in the Err variant
6945         pub err: *mut core::ffi::c_void,
6946 }
6947 #[repr(C)]
6948 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6949 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6951 pub struct CResult_PaymentSecretNoneZ {
6952         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6953         /// `err` or `result` depending on the state of `result_ok`.
6954         pub contents: CResult_PaymentSecretNoneZPtr,
6955         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6956         pub result_ok: bool,
6957 }
6958 #[no_mangle]
6959 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6960 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6961         CResult_PaymentSecretNoneZ {
6962                 contents: CResult_PaymentSecretNoneZPtr {
6963                         result: Box::into_raw(Box::new(o)),
6964                 },
6965                 result_ok: true,
6966         }
6967 }
6968 #[no_mangle]
6969 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6970 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6971         CResult_PaymentSecretNoneZ {
6972                 contents: CResult_PaymentSecretNoneZPtr {
6973                         err: core::ptr::null_mut(),
6974                 },
6975                 result_ok: false,
6976         }
6977 }
6978 /// Checks if the given object is currently in the success state
6979 #[no_mangle]
6980 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6981         o.result_ok
6982 }
6983 #[no_mangle]
6984 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6985 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6986 impl Drop for CResult_PaymentSecretNoneZ {
6987         fn drop(&mut self) {
6988                 if self.result_ok {
6989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6991                         }
6992                 } else {
6993                 }
6994         }
6995 }
6996 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6997         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6998                 let contents = if o.result_ok {
6999                         let result = unsafe { o.contents.result };
7000                         unsafe { o.contents.result = core::ptr::null_mut() };
7001                         CResult_PaymentSecretNoneZPtr { result }
7002                 } else {
7003                         let _ = unsafe { Box::from_raw(o.contents.err) };
7004                         o.contents.err = core::ptr::null_mut();
7005                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7006                 };
7007                 Self {
7008                         contents,
7009                         result_ok: o.result_ok,
7010                 }
7011         }
7012 }
7013 impl Clone for CResult_PaymentSecretNoneZ {
7014         fn clone(&self) -> Self {
7015                 if self.result_ok {
7016                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7017                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7018                         } }
7019                 } else {
7020                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7021                                 err: core::ptr::null_mut()
7022                         } }
7023                 }
7024         }
7025 }
7026 #[no_mangle]
7027 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7028 /// but with all dynamically-allocated buffers duplicated in new buffers.
7029 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7030 #[repr(C)]
7031 /// The contents of CResult_PaymentSecretAPIErrorZ
7032 pub union CResult_PaymentSecretAPIErrorZPtr {
7033         /// A pointer to the contents in the success state.
7034         /// Reading from this pointer when `result_ok` is not set is undefined.
7035         pub result: *mut crate::c_types::ThirtyTwoBytes,
7036         /// A pointer to the contents in the error state.
7037         /// Reading from this pointer when `result_ok` is set is undefined.
7038         pub err: *mut crate::lightning::util::errors::APIError,
7039 }
7040 #[repr(C)]
7041 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7042 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7044 pub struct CResult_PaymentSecretAPIErrorZ {
7045         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7046         /// `err` or `result` depending on the state of `result_ok`.
7047         pub contents: CResult_PaymentSecretAPIErrorZPtr,
7048         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7049         pub result_ok: bool,
7050 }
7051 #[no_mangle]
7052 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7053 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7054         CResult_PaymentSecretAPIErrorZ {
7055                 contents: CResult_PaymentSecretAPIErrorZPtr {
7056                         result: Box::into_raw(Box::new(o)),
7057                 },
7058                 result_ok: true,
7059         }
7060 }
7061 #[no_mangle]
7062 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7064         CResult_PaymentSecretAPIErrorZ {
7065                 contents: CResult_PaymentSecretAPIErrorZPtr {
7066                         err: Box::into_raw(Box::new(e)),
7067                 },
7068                 result_ok: false,
7069         }
7070 }
7071 /// Checks if the given object is currently in the success state
7072 #[no_mangle]
7073 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7074         o.result_ok
7075 }
7076 #[no_mangle]
7077 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7078 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7079 impl Drop for CResult_PaymentSecretAPIErrorZ {
7080         fn drop(&mut self) {
7081                 if self.result_ok {
7082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7084                         }
7085                 } else {
7086                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7087                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7088                         }
7089                 }
7090         }
7091 }
7092 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7093         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7094                 let contents = if o.result_ok {
7095                         let result = unsafe { o.contents.result };
7096                         unsafe { o.contents.result = core::ptr::null_mut() };
7097                         CResult_PaymentSecretAPIErrorZPtr { result }
7098                 } else {
7099                         let err = unsafe { o.contents.err };
7100                         unsafe { o.contents.err = core::ptr::null_mut(); }
7101                         CResult_PaymentSecretAPIErrorZPtr { err }
7102                 };
7103                 Self {
7104                         contents,
7105                         result_ok: o.result_ok,
7106                 }
7107         }
7108 }
7109 impl Clone for CResult_PaymentSecretAPIErrorZ {
7110         fn clone(&self) -> Self {
7111                 if self.result_ok {
7112                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7113                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7114                         } }
7115                 } else {
7116                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7117                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7118                         } }
7119                 }
7120         }
7121 }
7122 #[no_mangle]
7123 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7124 /// but with all dynamically-allocated buffers duplicated in new buffers.
7125 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7126 #[repr(C)]
7127 /// The contents of CResult_PaymentPreimageAPIErrorZ
7128 pub union CResult_PaymentPreimageAPIErrorZPtr {
7129         /// A pointer to the contents in the success state.
7130         /// Reading from this pointer when `result_ok` is not set is undefined.
7131         pub result: *mut crate::c_types::ThirtyTwoBytes,
7132         /// A pointer to the contents in the error state.
7133         /// Reading from this pointer when `result_ok` is set is undefined.
7134         pub err: *mut crate::lightning::util::errors::APIError,
7135 }
7136 #[repr(C)]
7137 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7138 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7140 pub struct CResult_PaymentPreimageAPIErrorZ {
7141         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7142         /// `err` or `result` depending on the state of `result_ok`.
7143         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7144         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7145         pub result_ok: bool,
7146 }
7147 #[no_mangle]
7148 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7149 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7150         CResult_PaymentPreimageAPIErrorZ {
7151                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7152                         result: Box::into_raw(Box::new(o)),
7153                 },
7154                 result_ok: true,
7155         }
7156 }
7157 #[no_mangle]
7158 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7160         CResult_PaymentPreimageAPIErrorZ {
7161                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7162                         err: Box::into_raw(Box::new(e)),
7163                 },
7164                 result_ok: false,
7165         }
7166 }
7167 /// Checks if the given object is currently in the success state
7168 #[no_mangle]
7169 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7170         o.result_ok
7171 }
7172 #[no_mangle]
7173 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7174 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7175 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7176         fn drop(&mut self) {
7177                 if self.result_ok {
7178                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7179                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7180                         }
7181                 } else {
7182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7184                         }
7185                 }
7186         }
7187 }
7188 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7189         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7190                 let contents = if o.result_ok {
7191                         let result = unsafe { o.contents.result };
7192                         unsafe { o.contents.result = core::ptr::null_mut() };
7193                         CResult_PaymentPreimageAPIErrorZPtr { result }
7194                 } else {
7195                         let err = unsafe { o.contents.err };
7196                         unsafe { o.contents.err = core::ptr::null_mut(); }
7197                         CResult_PaymentPreimageAPIErrorZPtr { err }
7198                 };
7199                 Self {
7200                         contents,
7201                         result_ok: o.result_ok,
7202                 }
7203         }
7204 }
7205 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7206         fn clone(&self) -> Self {
7207                 if self.result_ok {
7208                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7209                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7210                         } }
7211                 } else {
7212                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7213                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7214                         } }
7215                 }
7216         }
7217 }
7218 #[no_mangle]
7219 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7220 /// but with all dynamically-allocated buffers duplicated in new buffers.
7221 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7222 #[repr(C)]
7223 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7224 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7225         /// A pointer to the contents in the success state.
7226         /// Reading from this pointer when `result_ok` is not set is undefined.
7227         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7228         /// A pointer to the contents in the error state.
7229         /// Reading from this pointer when `result_ok` is set is undefined.
7230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7231 }
7232 #[repr(C)]
7233 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7234 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7236 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7237         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7238         /// `err` or `result` depending on the state of `result_ok`.
7239         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7240         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7241         pub result_ok: bool,
7242 }
7243 #[no_mangle]
7244 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7245 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7246         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7247                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7248                         result: Box::into_raw(Box::new(o)),
7249                 },
7250                 result_ok: true,
7251         }
7252 }
7253 #[no_mangle]
7254 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7256         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7257                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7258                         err: Box::into_raw(Box::new(e)),
7259                 },
7260                 result_ok: false,
7261         }
7262 }
7263 /// Checks if the given object is currently in the success state
7264 #[no_mangle]
7265 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7266         o.result_ok
7267 }
7268 #[no_mangle]
7269 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7270 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7271 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7272         fn drop(&mut self) {
7273                 if self.result_ok {
7274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7276                         }
7277                 } else {
7278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7280                         }
7281                 }
7282         }
7283 }
7284 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7286                 let contents = if o.result_ok {
7287                         let result = unsafe { o.contents.result };
7288                         unsafe { o.contents.result = core::ptr::null_mut() };
7289                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7290                 } else {
7291                         let err = unsafe { o.contents.err };
7292                         unsafe { o.contents.err = core::ptr::null_mut(); }
7293                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7294                 };
7295                 Self {
7296                         contents,
7297                         result_ok: o.result_ok,
7298                 }
7299         }
7300 }
7301 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7302         fn clone(&self) -> Self {
7303                 if self.result_ok {
7304                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7305                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7306                         } }
7307                 } else {
7308                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7310                         } }
7311                 }
7312         }
7313 }
7314 #[no_mangle]
7315 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7316 /// but with all dynamically-allocated buffers duplicated in new buffers.
7317 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7318 #[repr(C)]
7319 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7320 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7321         /// A pointer to the contents in the success state.
7322         /// Reading from this pointer when `result_ok` is not set is undefined.
7323         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7324         /// A pointer to the contents in the error state.
7325         /// Reading from this pointer when `result_ok` is set is undefined.
7326         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7327 }
7328 #[repr(C)]
7329 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7330 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7332 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7333         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7334         /// `err` or `result` depending on the state of `result_ok`.
7335         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7336         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7337         pub result_ok: bool,
7338 }
7339 #[no_mangle]
7340 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7341 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7342         CResult_ChannelCounterpartyDecodeErrorZ {
7343                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7344                         result: Box::into_raw(Box::new(o)),
7345                 },
7346                 result_ok: true,
7347         }
7348 }
7349 #[no_mangle]
7350 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7352         CResult_ChannelCounterpartyDecodeErrorZ {
7353                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7354                         err: Box::into_raw(Box::new(e)),
7355                 },
7356                 result_ok: false,
7357         }
7358 }
7359 /// Checks if the given object is currently in the success state
7360 #[no_mangle]
7361 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7362         o.result_ok
7363 }
7364 #[no_mangle]
7365 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7366 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7367 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7368         fn drop(&mut self) {
7369                 if self.result_ok {
7370                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7371                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7372                         }
7373                 } else {
7374                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7375                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7376                         }
7377                 }
7378         }
7379 }
7380 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7381         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7382                 let contents = if o.result_ok {
7383                         let result = unsafe { o.contents.result };
7384                         unsafe { o.contents.result = core::ptr::null_mut() };
7385                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7386                 } else {
7387                         let err = unsafe { o.contents.err };
7388                         unsafe { o.contents.err = core::ptr::null_mut(); }
7389                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7390                 };
7391                 Self {
7392                         contents,
7393                         result_ok: o.result_ok,
7394                 }
7395         }
7396 }
7397 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7398         fn clone(&self) -> Self {
7399                 if self.result_ok {
7400                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7401                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7402                         } }
7403                 } else {
7404                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7405                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7406                         } }
7407                 }
7408         }
7409 }
7410 #[no_mangle]
7411 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7412 /// but with all dynamically-allocated buffers duplicated in new buffers.
7413 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7414 #[repr(C)]
7415 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7416 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7417         /// A pointer to the contents in the success state.
7418         /// Reading from this pointer when `result_ok` is not set is undefined.
7419         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7420         /// A pointer to the contents in the error state.
7421         /// Reading from this pointer when `result_ok` is set is undefined.
7422         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7423 }
7424 #[repr(C)]
7425 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7426 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7427 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7428 pub struct CResult_ChannelDetailsDecodeErrorZ {
7429         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7430         /// `err` or `result` depending on the state of `result_ok`.
7431         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7432         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7433         pub result_ok: bool,
7434 }
7435 #[no_mangle]
7436 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7437 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7438         CResult_ChannelDetailsDecodeErrorZ {
7439                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7440                         result: Box::into_raw(Box::new(o)),
7441                 },
7442                 result_ok: true,
7443         }
7444 }
7445 #[no_mangle]
7446 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7448         CResult_ChannelDetailsDecodeErrorZ {
7449                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7450                         err: Box::into_raw(Box::new(e)),
7451                 },
7452                 result_ok: false,
7453         }
7454 }
7455 /// Checks if the given object is currently in the success state
7456 #[no_mangle]
7457 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7458         o.result_ok
7459 }
7460 #[no_mangle]
7461 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7462 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7463 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7464         fn drop(&mut self) {
7465                 if self.result_ok {
7466                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7467                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7468                         }
7469                 } else {
7470                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7471                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7472                         }
7473                 }
7474         }
7475 }
7476 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7477         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7478                 let contents = if o.result_ok {
7479                         let result = unsafe { o.contents.result };
7480                         unsafe { o.contents.result = core::ptr::null_mut() };
7481                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7482                 } else {
7483                         let err = unsafe { o.contents.err };
7484                         unsafe { o.contents.err = core::ptr::null_mut(); }
7485                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7486                 };
7487                 Self {
7488                         contents,
7489                         result_ok: o.result_ok,
7490                 }
7491         }
7492 }
7493 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7494         fn clone(&self) -> Self {
7495                 if self.result_ok {
7496                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7497                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7498                         } }
7499                 } else {
7500                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7501                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7502                         } }
7503                 }
7504         }
7505 }
7506 #[no_mangle]
7507 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7508 /// but with all dynamically-allocated buffers duplicated in new buffers.
7509 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7510 #[repr(C)]
7511 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7512 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7513         /// A pointer to the contents in the success state.
7514         /// Reading from this pointer when `result_ok` is not set is undefined.
7515         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7516         /// A pointer to the contents in the error state.
7517         /// Reading from this pointer when `result_ok` is set is undefined.
7518         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7519 }
7520 #[repr(C)]
7521 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7522 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7523 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7524 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7525         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7526         /// `err` or `result` depending on the state of `result_ok`.
7527         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7528         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7529         pub result_ok: bool,
7530 }
7531 #[no_mangle]
7532 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7533 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7534         CResult_PhantomRouteHintsDecodeErrorZ {
7535                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7536                         result: Box::into_raw(Box::new(o)),
7537                 },
7538                 result_ok: true,
7539         }
7540 }
7541 #[no_mangle]
7542 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7544         CResult_PhantomRouteHintsDecodeErrorZ {
7545                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7546                         err: Box::into_raw(Box::new(e)),
7547                 },
7548                 result_ok: false,
7549         }
7550 }
7551 /// Checks if the given object is currently in the success state
7552 #[no_mangle]
7553 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7554         o.result_ok
7555 }
7556 #[no_mangle]
7557 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7558 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7559 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7560         fn drop(&mut self) {
7561                 if self.result_ok {
7562                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7563                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7564                         }
7565                 } else {
7566                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7567                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7568                         }
7569                 }
7570         }
7571 }
7572 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7573         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7574                 let contents = if o.result_ok {
7575                         let result = unsafe { o.contents.result };
7576                         unsafe { o.contents.result = core::ptr::null_mut() };
7577                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7578                 } else {
7579                         let err = unsafe { o.contents.err };
7580                         unsafe { o.contents.err = core::ptr::null_mut(); }
7581                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7582                 };
7583                 Self {
7584                         contents,
7585                         result_ok: o.result_ok,
7586                 }
7587         }
7588 }
7589 #[repr(C)]
7590 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7591 /// This corresponds to std::vector in C++
7592 pub struct CVec_ChannelMonitorZ {
7593         /// The elements in the array.
7594         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7595         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7596         /// The number of elements pointed to by `data`.
7597         pub datalen: usize
7598 }
7599 impl CVec_ChannelMonitorZ {
7600         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7601                 if self.datalen == 0 { return Vec::new(); }
7602                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7603                 self.data = core::ptr::null_mut();
7604                 self.datalen = 0;
7605                 ret
7606         }
7607         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7608                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7609         }
7610 }
7611 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7612         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7613                 let datalen = v.len();
7614                 let data = Box::into_raw(v.into_boxed_slice());
7615                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7616         }
7617 }
7618 #[no_mangle]
7619 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7620 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7621 impl Drop for CVec_ChannelMonitorZ {
7622         fn drop(&mut self) {
7623                 if self.datalen == 0 { return; }
7624                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7625         }
7626 }
7627 #[repr(C)]
7628 /// A tuple of 2 elements. See the individual fields for the types contained.
7629 pub struct C2Tuple_BlockHashChannelManagerZ {
7630         /// The element at position 0
7631         pub a: crate::c_types::ThirtyTwoBytes,
7632         /// The element at position 1
7633         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7634 }
7635 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7636         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7637                 Self {
7638                         a: tup.0,
7639                         b: tup.1,
7640                 }
7641         }
7642 }
7643 impl C2Tuple_BlockHashChannelManagerZ {
7644         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7645                 (self.a, self.b)
7646         }
7647 }
7648 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7649 #[no_mangle]
7650 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7651         C2Tuple_BlockHashChannelManagerZ { a, b, }
7652 }
7653
7654 #[no_mangle]
7655 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7656 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7657 #[repr(C)]
7658 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7659 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7660         /// A pointer to the contents in the success state.
7661         /// Reading from this pointer when `result_ok` is not set is undefined.
7662         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7663         /// A pointer to the contents in the error state.
7664         /// Reading from this pointer when `result_ok` is set is undefined.
7665         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7666 }
7667 #[repr(C)]
7668 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7669 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7671 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7672         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7673         /// `err` or `result` depending on the state of `result_ok`.
7674         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7675         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7676         pub result_ok: bool,
7677 }
7678 #[no_mangle]
7679 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7680 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7681         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7682                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7683                         result: Box::into_raw(Box::new(o)),
7684                 },
7685                 result_ok: true,
7686         }
7687 }
7688 #[no_mangle]
7689 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7690 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7691         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7692                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7693                         err: Box::into_raw(Box::new(e)),
7694                 },
7695                 result_ok: false,
7696         }
7697 }
7698 /// Checks if the given object is currently in the success state
7699 #[no_mangle]
7700 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7701         o.result_ok
7702 }
7703 #[no_mangle]
7704 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7705 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7706 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7707         fn drop(&mut self) {
7708                 if self.result_ok {
7709                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7710                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7711                         }
7712                 } else {
7713                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7714                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7715                         }
7716                 }
7717         }
7718 }
7719 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7720         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7721                 let contents = if o.result_ok {
7722                         let result = unsafe { o.contents.result };
7723                         unsafe { o.contents.result = core::ptr::null_mut() };
7724                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7725                 } else {
7726                         let err = unsafe { o.contents.err };
7727                         unsafe { o.contents.err = core::ptr::null_mut(); }
7728                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7729                 };
7730                 Self {
7731                         contents,
7732                         result_ok: o.result_ok,
7733                 }
7734         }
7735 }
7736 #[repr(C)]
7737 /// The contents of CResult_ChannelConfigDecodeErrorZ
7738 pub union CResult_ChannelConfigDecodeErrorZPtr {
7739         /// A pointer to the contents in the success state.
7740         /// Reading from this pointer when `result_ok` is not set is undefined.
7741         pub result: *mut crate::lightning::util::config::ChannelConfig,
7742         /// A pointer to the contents in the error state.
7743         /// Reading from this pointer when `result_ok` is set is undefined.
7744         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7745 }
7746 #[repr(C)]
7747 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7748 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7749 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7750 pub struct CResult_ChannelConfigDecodeErrorZ {
7751         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7752         /// `err` or `result` depending on the state of `result_ok`.
7753         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7754         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7755         pub result_ok: bool,
7756 }
7757 #[no_mangle]
7758 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7759 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7760         CResult_ChannelConfigDecodeErrorZ {
7761                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7762                         result: Box::into_raw(Box::new(o)),
7763                 },
7764                 result_ok: true,
7765         }
7766 }
7767 #[no_mangle]
7768 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7769 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7770         CResult_ChannelConfigDecodeErrorZ {
7771                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7772                         err: Box::into_raw(Box::new(e)),
7773                 },
7774                 result_ok: false,
7775         }
7776 }
7777 /// Checks if the given object is currently in the success state
7778 #[no_mangle]
7779 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7780         o.result_ok
7781 }
7782 #[no_mangle]
7783 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7784 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7785 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7786         fn drop(&mut self) {
7787                 if self.result_ok {
7788                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7789                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7790                         }
7791                 } else {
7792                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7793                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7794                         }
7795                 }
7796         }
7797 }
7798 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7799         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7800                 let contents = if o.result_ok {
7801                         let result = unsafe { o.contents.result };
7802                         unsafe { o.contents.result = core::ptr::null_mut() };
7803                         CResult_ChannelConfigDecodeErrorZPtr { result }
7804                 } else {
7805                         let err = unsafe { o.contents.err };
7806                         unsafe { o.contents.err = core::ptr::null_mut(); }
7807                         CResult_ChannelConfigDecodeErrorZPtr { err }
7808                 };
7809                 Self {
7810                         contents,
7811                         result_ok: o.result_ok,
7812                 }
7813         }
7814 }
7815 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7816         fn clone(&self) -> Self {
7817                 if self.result_ok {
7818                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7819                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7820                         } }
7821                 } else {
7822                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7823                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7824                         } }
7825                 }
7826         }
7827 }
7828 #[no_mangle]
7829 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7830 /// but with all dynamically-allocated buffers duplicated in new buffers.
7831 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7832 #[repr(C)]
7833 /// The contents of CResult_OutPointDecodeErrorZ
7834 pub union CResult_OutPointDecodeErrorZPtr {
7835         /// A pointer to the contents in the success state.
7836         /// Reading from this pointer when `result_ok` is not set is undefined.
7837         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7838         /// A pointer to the contents in the error state.
7839         /// Reading from this pointer when `result_ok` is set is undefined.
7840         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7841 }
7842 #[repr(C)]
7843 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7844 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7845 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7846 pub struct CResult_OutPointDecodeErrorZ {
7847         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7848         /// `err` or `result` depending on the state of `result_ok`.
7849         pub contents: CResult_OutPointDecodeErrorZPtr,
7850         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7851         pub result_ok: bool,
7852 }
7853 #[no_mangle]
7854 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7855 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7856         CResult_OutPointDecodeErrorZ {
7857                 contents: CResult_OutPointDecodeErrorZPtr {
7858                         result: Box::into_raw(Box::new(o)),
7859                 },
7860                 result_ok: true,
7861         }
7862 }
7863 #[no_mangle]
7864 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7865 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7866         CResult_OutPointDecodeErrorZ {
7867                 contents: CResult_OutPointDecodeErrorZPtr {
7868                         err: Box::into_raw(Box::new(e)),
7869                 },
7870                 result_ok: false,
7871         }
7872 }
7873 /// Checks if the given object is currently in the success state
7874 #[no_mangle]
7875 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7876         o.result_ok
7877 }
7878 #[no_mangle]
7879 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7880 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7881 impl Drop for CResult_OutPointDecodeErrorZ {
7882         fn drop(&mut self) {
7883                 if self.result_ok {
7884                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7885                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7886                         }
7887                 } else {
7888                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7889                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7890                         }
7891                 }
7892         }
7893 }
7894 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7895         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7896                 let contents = if o.result_ok {
7897                         let result = unsafe { o.contents.result };
7898                         unsafe { o.contents.result = core::ptr::null_mut() };
7899                         CResult_OutPointDecodeErrorZPtr { result }
7900                 } else {
7901                         let err = unsafe { o.contents.err };
7902                         unsafe { o.contents.err = core::ptr::null_mut(); }
7903                         CResult_OutPointDecodeErrorZPtr { err }
7904                 };
7905                 Self {
7906                         contents,
7907                         result_ok: o.result_ok,
7908                 }
7909         }
7910 }
7911 impl Clone for CResult_OutPointDecodeErrorZ {
7912         fn clone(&self) -> Self {
7913                 if self.result_ok {
7914                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7915                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7916                         } }
7917                 } else {
7918                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7919                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7920                         } }
7921                 }
7922         }
7923 }
7924 #[no_mangle]
7925 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7926 /// but with all dynamically-allocated buffers duplicated in new buffers.
7927 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7928 #[repr(C)]
7929 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7930 pub enum COption_TypeZ {
7931         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7932         Some(crate::lightning::ln::wire::Type),
7933         /// When we're in this state, this COption_TypeZ contains nothing
7934         None
7935 }
7936 impl COption_TypeZ {
7937         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7938                 if let Self::None = self { false } else { true }
7939         }
7940         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7941                 !self.is_some()
7942         }
7943         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7944                 if let Self::Some(v) = self { v } else { unreachable!() }
7945         }
7946 }
7947 #[no_mangle]
7948 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7949 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7950         COption_TypeZ::Some(o)
7951 }
7952 #[no_mangle]
7953 /// Constructs a new COption_TypeZ containing nothing
7954 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7955         COption_TypeZ::None
7956 }
7957 #[no_mangle]
7958 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7959 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7960 #[repr(C)]
7961 /// The contents of CResult_COption_TypeZDecodeErrorZ
7962 pub union CResult_COption_TypeZDecodeErrorZPtr {
7963         /// A pointer to the contents in the success state.
7964         /// Reading from this pointer when `result_ok` is not set is undefined.
7965         pub result: *mut crate::c_types::derived::COption_TypeZ,
7966         /// A pointer to the contents in the error state.
7967         /// Reading from this pointer when `result_ok` is set is undefined.
7968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7969 }
7970 #[repr(C)]
7971 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7972 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7974 pub struct CResult_COption_TypeZDecodeErrorZ {
7975         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7976         /// `err` or `result` depending on the state of `result_ok`.
7977         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7978         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7979         pub result_ok: bool,
7980 }
7981 #[no_mangle]
7982 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7983 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7984         CResult_COption_TypeZDecodeErrorZ {
7985                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7986                         result: Box::into_raw(Box::new(o)),
7987                 },
7988                 result_ok: true,
7989         }
7990 }
7991 #[no_mangle]
7992 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7993 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7994         CResult_COption_TypeZDecodeErrorZ {
7995                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7996                         err: Box::into_raw(Box::new(e)),
7997                 },
7998                 result_ok: false,
7999         }
8000 }
8001 /// Checks if the given object is currently in the success state
8002 #[no_mangle]
8003 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8004         o.result_ok
8005 }
8006 #[no_mangle]
8007 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8008 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8009 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8010         fn drop(&mut self) {
8011                 if self.result_ok {
8012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8014                         }
8015                 } else {
8016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8018                         }
8019                 }
8020         }
8021 }
8022 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8023         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8024                 let contents = if o.result_ok {
8025                         let result = unsafe { o.contents.result };
8026                         unsafe { o.contents.result = core::ptr::null_mut() };
8027                         CResult_COption_TypeZDecodeErrorZPtr { result }
8028                 } else {
8029                         let err = unsafe { o.contents.err };
8030                         unsafe { o.contents.err = core::ptr::null_mut(); }
8031                         CResult_COption_TypeZDecodeErrorZPtr { err }
8032                 };
8033                 Self {
8034                         contents,
8035                         result_ok: o.result_ok,
8036                 }
8037         }
8038 }
8039 #[repr(C)]
8040 /// The contents of CResult_PaymentIdPaymentErrorZ
8041 pub union CResult_PaymentIdPaymentErrorZPtr {
8042         /// A pointer to the contents in the success state.
8043         /// Reading from this pointer when `result_ok` is not set is undefined.
8044         pub result: *mut crate::c_types::ThirtyTwoBytes,
8045         /// A pointer to the contents in the error state.
8046         /// Reading from this pointer when `result_ok` is set is undefined.
8047         pub err: *mut crate::lightning_invoice::payment::PaymentError,
8048 }
8049 #[repr(C)]
8050 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8051 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8053 pub struct CResult_PaymentIdPaymentErrorZ {
8054         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8055         /// `err` or `result` depending on the state of `result_ok`.
8056         pub contents: CResult_PaymentIdPaymentErrorZPtr,
8057         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8058         pub result_ok: bool,
8059 }
8060 #[no_mangle]
8061 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8062 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8063         CResult_PaymentIdPaymentErrorZ {
8064                 contents: CResult_PaymentIdPaymentErrorZPtr {
8065                         result: Box::into_raw(Box::new(o)),
8066                 },
8067                 result_ok: true,
8068         }
8069 }
8070 #[no_mangle]
8071 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8072 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8073         CResult_PaymentIdPaymentErrorZ {
8074                 contents: CResult_PaymentIdPaymentErrorZPtr {
8075                         err: Box::into_raw(Box::new(e)),
8076                 },
8077                 result_ok: false,
8078         }
8079 }
8080 /// Checks if the given object is currently in the success state
8081 #[no_mangle]
8082 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8083         o.result_ok
8084 }
8085 #[no_mangle]
8086 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8087 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8088 impl Drop for CResult_PaymentIdPaymentErrorZ {
8089         fn drop(&mut self) {
8090                 if self.result_ok {
8091                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8092                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8093                         }
8094                 } else {
8095                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8096                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8097                         }
8098                 }
8099         }
8100 }
8101 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8102         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8103                 let contents = if o.result_ok {
8104                         let result = unsafe { o.contents.result };
8105                         unsafe { o.contents.result = core::ptr::null_mut() };
8106                         CResult_PaymentIdPaymentErrorZPtr { result }
8107                 } else {
8108                         let err = unsafe { o.contents.err };
8109                         unsafe { o.contents.err = core::ptr::null_mut(); }
8110                         CResult_PaymentIdPaymentErrorZPtr { err }
8111                 };
8112                 Self {
8113                         contents,
8114                         result_ok: o.result_ok,
8115                 }
8116         }
8117 }
8118 impl Clone for CResult_PaymentIdPaymentErrorZ {
8119         fn clone(&self) -> Self {
8120                 if self.result_ok {
8121                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8122                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8123                         } }
8124                 } else {
8125                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8126                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8127                         } }
8128                 }
8129         }
8130 }
8131 #[no_mangle]
8132 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8133 /// but with all dynamically-allocated buffers duplicated in new buffers.
8134 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8135 #[repr(C)]
8136 /// The contents of CResult_SiPrefixNoneZ
8137 pub union CResult_SiPrefixNoneZPtr {
8138         /// A pointer to the contents in the success state.
8139         /// Reading from this pointer when `result_ok` is not set is undefined.
8140         pub result: *mut crate::lightning_invoice::SiPrefix,
8141         /// Note that this value is always NULL, as there are no contents in the Err variant
8142         pub err: *mut core::ffi::c_void,
8143 }
8144 #[repr(C)]
8145 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8146 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8148 pub struct CResult_SiPrefixNoneZ {
8149         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8150         /// `err` or `result` depending on the state of `result_ok`.
8151         pub contents: CResult_SiPrefixNoneZPtr,
8152         /// Whether this CResult_SiPrefixNoneZ represents a success state.
8153         pub result_ok: bool,
8154 }
8155 #[no_mangle]
8156 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8157 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8158         CResult_SiPrefixNoneZ {
8159                 contents: CResult_SiPrefixNoneZPtr {
8160                         result: Box::into_raw(Box::new(o)),
8161                 },
8162                 result_ok: true,
8163         }
8164 }
8165 #[no_mangle]
8166 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8167 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8168         CResult_SiPrefixNoneZ {
8169                 contents: CResult_SiPrefixNoneZPtr {
8170                         err: core::ptr::null_mut(),
8171                 },
8172                 result_ok: false,
8173         }
8174 }
8175 /// Checks if the given object is currently in the success state
8176 #[no_mangle]
8177 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8178         o.result_ok
8179 }
8180 #[no_mangle]
8181 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8182 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8183 impl Drop for CResult_SiPrefixNoneZ {
8184         fn drop(&mut self) {
8185                 if self.result_ok {
8186                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8187                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8188                         }
8189                 } else {
8190                 }
8191         }
8192 }
8193 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8194         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8195                 let contents = if o.result_ok {
8196                         let result = unsafe { o.contents.result };
8197                         unsafe { o.contents.result = core::ptr::null_mut() };
8198                         CResult_SiPrefixNoneZPtr { result }
8199                 } else {
8200                         let _ = unsafe { Box::from_raw(o.contents.err) };
8201                         o.contents.err = core::ptr::null_mut();
8202                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8203                 };
8204                 Self {
8205                         contents,
8206                         result_ok: o.result_ok,
8207                 }
8208         }
8209 }
8210 impl Clone for CResult_SiPrefixNoneZ {
8211         fn clone(&self) -> Self {
8212                 if self.result_ok {
8213                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8214                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8215                         } }
8216                 } else {
8217                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8218                                 err: core::ptr::null_mut()
8219                         } }
8220                 }
8221         }
8222 }
8223 #[no_mangle]
8224 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8225 /// but with all dynamically-allocated buffers duplicated in new buffers.
8226 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8227 #[repr(C)]
8228 /// The contents of CResult_InvoiceNoneZ
8229 pub union CResult_InvoiceNoneZPtr {
8230         /// A pointer to the contents in the success state.
8231         /// Reading from this pointer when `result_ok` is not set is undefined.
8232         pub result: *mut crate::lightning_invoice::Invoice,
8233         /// Note that this value is always NULL, as there are no contents in the Err variant
8234         pub err: *mut core::ffi::c_void,
8235 }
8236 #[repr(C)]
8237 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8238 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8240 pub struct CResult_InvoiceNoneZ {
8241         /// The contents of this CResult_InvoiceNoneZ, accessible via either
8242         /// `err` or `result` depending on the state of `result_ok`.
8243         pub contents: CResult_InvoiceNoneZPtr,
8244         /// Whether this CResult_InvoiceNoneZ represents a success state.
8245         pub result_ok: bool,
8246 }
8247 #[no_mangle]
8248 /// Creates a new CResult_InvoiceNoneZ in the success state.
8249 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8250         CResult_InvoiceNoneZ {
8251                 contents: CResult_InvoiceNoneZPtr {
8252                         result: Box::into_raw(Box::new(o)),
8253                 },
8254                 result_ok: true,
8255         }
8256 }
8257 #[no_mangle]
8258 /// Creates a new CResult_InvoiceNoneZ in the error state.
8259 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8260         CResult_InvoiceNoneZ {
8261                 contents: CResult_InvoiceNoneZPtr {
8262                         err: core::ptr::null_mut(),
8263                 },
8264                 result_ok: false,
8265         }
8266 }
8267 /// Checks if the given object is currently in the success state
8268 #[no_mangle]
8269 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8270         o.result_ok
8271 }
8272 #[no_mangle]
8273 /// Frees any resources used by the CResult_InvoiceNoneZ.
8274 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8275 impl Drop for CResult_InvoiceNoneZ {
8276         fn drop(&mut self) {
8277                 if self.result_ok {
8278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8280                         }
8281                 } else {
8282                 }
8283         }
8284 }
8285 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8286         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8287                 let contents = if o.result_ok {
8288                         let result = unsafe { o.contents.result };
8289                         unsafe { o.contents.result = core::ptr::null_mut() };
8290                         CResult_InvoiceNoneZPtr { result }
8291                 } else {
8292                         let _ = unsafe { Box::from_raw(o.contents.err) };
8293                         o.contents.err = core::ptr::null_mut();
8294                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8295                 };
8296                 Self {
8297                         contents,
8298                         result_ok: o.result_ok,
8299                 }
8300         }
8301 }
8302 impl Clone for CResult_InvoiceNoneZ {
8303         fn clone(&self) -> Self {
8304                 if self.result_ok {
8305                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8306                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8307                         } }
8308                 } else {
8309                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8310                                 err: core::ptr::null_mut()
8311                         } }
8312                 }
8313         }
8314 }
8315 #[no_mangle]
8316 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8317 /// but with all dynamically-allocated buffers duplicated in new buffers.
8318 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8319 #[repr(C)]
8320 /// The contents of CResult_SignedRawInvoiceNoneZ
8321 pub union CResult_SignedRawInvoiceNoneZPtr {
8322         /// A pointer to the contents in the success state.
8323         /// Reading from this pointer when `result_ok` is not set is undefined.
8324         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8325         /// Note that this value is always NULL, as there are no contents in the Err variant
8326         pub err: *mut core::ffi::c_void,
8327 }
8328 #[repr(C)]
8329 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8330 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8332 pub struct CResult_SignedRawInvoiceNoneZ {
8333         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8334         /// `err` or `result` depending on the state of `result_ok`.
8335         pub contents: CResult_SignedRawInvoiceNoneZPtr,
8336         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8337         pub result_ok: bool,
8338 }
8339 #[no_mangle]
8340 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8341 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8342         CResult_SignedRawInvoiceNoneZ {
8343                 contents: CResult_SignedRawInvoiceNoneZPtr {
8344                         result: Box::into_raw(Box::new(o)),
8345                 },
8346                 result_ok: true,
8347         }
8348 }
8349 #[no_mangle]
8350 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8351 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8352         CResult_SignedRawInvoiceNoneZ {
8353                 contents: CResult_SignedRawInvoiceNoneZPtr {
8354                         err: core::ptr::null_mut(),
8355                 },
8356                 result_ok: false,
8357         }
8358 }
8359 /// Checks if the given object is currently in the success state
8360 #[no_mangle]
8361 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8362         o.result_ok
8363 }
8364 #[no_mangle]
8365 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8366 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8367 impl Drop for CResult_SignedRawInvoiceNoneZ {
8368         fn drop(&mut self) {
8369                 if self.result_ok {
8370                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8371                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8372                         }
8373                 } else {
8374                 }
8375         }
8376 }
8377 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8378         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8379                 let contents = if o.result_ok {
8380                         let result = unsafe { o.contents.result };
8381                         unsafe { o.contents.result = core::ptr::null_mut() };
8382                         CResult_SignedRawInvoiceNoneZPtr { result }
8383                 } else {
8384                         let _ = unsafe { Box::from_raw(o.contents.err) };
8385                         o.contents.err = core::ptr::null_mut();
8386                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8387                 };
8388                 Self {
8389                         contents,
8390                         result_ok: o.result_ok,
8391                 }
8392         }
8393 }
8394 impl Clone for CResult_SignedRawInvoiceNoneZ {
8395         fn clone(&self) -> Self {
8396                 if self.result_ok {
8397                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8398                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8399                         } }
8400                 } else {
8401                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8402                                 err: core::ptr::null_mut()
8403                         } }
8404                 }
8405         }
8406 }
8407 #[no_mangle]
8408 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8409 /// but with all dynamically-allocated buffers duplicated in new buffers.
8410 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8411 #[repr(C)]
8412 /// A tuple of 3 elements. See the individual fields for the types contained.
8413 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8414         /// The element at position 0
8415         pub a: crate::lightning_invoice::RawInvoice,
8416         /// The element at position 1
8417         pub b: crate::c_types::ThirtyTwoBytes,
8418         /// The element at position 2
8419         pub c: crate::lightning_invoice::InvoiceSignature,
8420 }
8421 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8422         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8423                 Self {
8424                         a: tup.0,
8425                         b: tup.1,
8426                         c: tup.2,
8427                 }
8428         }
8429 }
8430 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8431         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8432                 (self.a, self.b, self.c)
8433         }
8434 }
8435 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8436         fn clone(&self) -> Self {
8437                 Self {
8438                         a: Clone::clone(&self.a),
8439                         b: Clone::clone(&self.b),
8440                         c: Clone::clone(&self.c),
8441                 }
8442         }
8443 }
8444 #[no_mangle]
8445 /// Creates a new tuple which has the same data as `orig`
8446 /// but with all dynamically-allocated buffers duplicated in new buffers.
8447 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8448 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8449 #[no_mangle]
8450 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 {
8451         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8452 }
8453
8454 #[no_mangle]
8455 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8456 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8457 #[repr(C)]
8458 /// The contents of CResult_PayeePubKeyErrorZ
8459 pub union CResult_PayeePubKeyErrorZPtr {
8460         /// A pointer to the contents in the success state.
8461         /// Reading from this pointer when `result_ok` is not set is undefined.
8462         pub result: *mut crate::lightning_invoice::PayeePubKey,
8463         /// A pointer to the contents in the error state.
8464         /// Reading from this pointer when `result_ok` is set is undefined.
8465         pub err: *mut crate::c_types::Secp256k1Error,
8466 }
8467 #[repr(C)]
8468 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8469 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8471 pub struct CResult_PayeePubKeyErrorZ {
8472         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8473         /// `err` or `result` depending on the state of `result_ok`.
8474         pub contents: CResult_PayeePubKeyErrorZPtr,
8475         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8476         pub result_ok: bool,
8477 }
8478 #[no_mangle]
8479 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8480 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8481         CResult_PayeePubKeyErrorZ {
8482                 contents: CResult_PayeePubKeyErrorZPtr {
8483                         result: Box::into_raw(Box::new(o)),
8484                 },
8485                 result_ok: true,
8486         }
8487 }
8488 #[no_mangle]
8489 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8490 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8491         CResult_PayeePubKeyErrorZ {
8492                 contents: CResult_PayeePubKeyErrorZPtr {
8493                         err: Box::into_raw(Box::new(e)),
8494                 },
8495                 result_ok: false,
8496         }
8497 }
8498 /// Checks if the given object is currently in the success state
8499 #[no_mangle]
8500 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8501         o.result_ok
8502 }
8503 #[no_mangle]
8504 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8505 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8506 impl Drop for CResult_PayeePubKeyErrorZ {
8507         fn drop(&mut self) {
8508                 if self.result_ok {
8509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8511                         }
8512                 } else {
8513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8515                         }
8516                 }
8517         }
8518 }
8519 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8521                 let contents = if o.result_ok {
8522                         let result = unsafe { o.contents.result };
8523                         unsafe { o.contents.result = core::ptr::null_mut() };
8524                         CResult_PayeePubKeyErrorZPtr { result }
8525                 } else {
8526                         let err = unsafe { o.contents.err };
8527                         unsafe { o.contents.err = core::ptr::null_mut(); }
8528                         CResult_PayeePubKeyErrorZPtr { err }
8529                 };
8530                 Self {
8531                         contents,
8532                         result_ok: o.result_ok,
8533                 }
8534         }
8535 }
8536 impl Clone for CResult_PayeePubKeyErrorZ {
8537         fn clone(&self) -> Self {
8538                 if self.result_ok {
8539                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8540                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8541                         } }
8542                 } else {
8543                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8544                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8545                         } }
8546                 }
8547         }
8548 }
8549 #[no_mangle]
8550 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8551 /// but with all dynamically-allocated buffers duplicated in new buffers.
8552 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8553 #[repr(C)]
8554 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8555 /// This corresponds to std::vector in C++
8556 pub struct CVec_PrivateRouteZ {
8557         /// The elements in the array.
8558         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8559         pub data: *mut crate::lightning_invoice::PrivateRoute,
8560         /// The number of elements pointed to by `data`.
8561         pub datalen: usize
8562 }
8563 impl CVec_PrivateRouteZ {
8564         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8565                 if self.datalen == 0 { return Vec::new(); }
8566                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8567                 self.data = core::ptr::null_mut();
8568                 self.datalen = 0;
8569                 ret
8570         }
8571         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8572                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8573         }
8574 }
8575 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8576         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8577                 let datalen = v.len();
8578                 let data = Box::into_raw(v.into_boxed_slice());
8579                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8580         }
8581 }
8582 #[no_mangle]
8583 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8584 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8585 impl Drop for CVec_PrivateRouteZ {
8586         fn drop(&mut self) {
8587                 if self.datalen == 0 { return; }
8588                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8589         }
8590 }
8591 impl Clone for CVec_PrivateRouteZ {
8592         fn clone(&self) -> Self {
8593                 let mut res = Vec::new();
8594                 if self.datalen == 0 { return Self::from(res); }
8595                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8596                 Self::from(res)
8597         }
8598 }
8599 #[repr(C)]
8600 /// The contents of CResult_PositiveTimestampCreationErrorZ
8601 pub union CResult_PositiveTimestampCreationErrorZPtr {
8602         /// A pointer to the contents in the success state.
8603         /// Reading from this pointer when `result_ok` is not set is undefined.
8604         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8605         /// A pointer to the contents in the error state.
8606         /// Reading from this pointer when `result_ok` is set is undefined.
8607         pub err: *mut crate::lightning_invoice::CreationError,
8608 }
8609 #[repr(C)]
8610 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8611 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8612 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8613 pub struct CResult_PositiveTimestampCreationErrorZ {
8614         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8615         /// `err` or `result` depending on the state of `result_ok`.
8616         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8617         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8618         pub result_ok: bool,
8619 }
8620 #[no_mangle]
8621 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8622 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8623         CResult_PositiveTimestampCreationErrorZ {
8624                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8625                         result: Box::into_raw(Box::new(o)),
8626                 },
8627                 result_ok: true,
8628         }
8629 }
8630 #[no_mangle]
8631 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8632 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8633         CResult_PositiveTimestampCreationErrorZ {
8634                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8635                         err: Box::into_raw(Box::new(e)),
8636                 },
8637                 result_ok: false,
8638         }
8639 }
8640 /// Checks if the given object is currently in the success state
8641 #[no_mangle]
8642 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8643         o.result_ok
8644 }
8645 #[no_mangle]
8646 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8647 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8648 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8649         fn drop(&mut self) {
8650                 if self.result_ok {
8651                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8652                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8653                         }
8654                 } else {
8655                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8656                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8657                         }
8658                 }
8659         }
8660 }
8661 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8662         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8663                 let contents = if o.result_ok {
8664                         let result = unsafe { o.contents.result };
8665                         unsafe { o.contents.result = core::ptr::null_mut() };
8666                         CResult_PositiveTimestampCreationErrorZPtr { result }
8667                 } else {
8668                         let err = unsafe { o.contents.err };
8669                         unsafe { o.contents.err = core::ptr::null_mut(); }
8670                         CResult_PositiveTimestampCreationErrorZPtr { err }
8671                 };
8672                 Self {
8673                         contents,
8674                         result_ok: o.result_ok,
8675                 }
8676         }
8677 }
8678 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8679         fn clone(&self) -> Self {
8680                 if self.result_ok {
8681                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8682                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8683                         } }
8684                 } else {
8685                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8686                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8687                         } }
8688                 }
8689         }
8690 }
8691 #[no_mangle]
8692 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8693 /// but with all dynamically-allocated buffers duplicated in new buffers.
8694 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8695 #[repr(C)]
8696 /// The contents of CResult_NoneSemanticErrorZ
8697 pub union CResult_NoneSemanticErrorZPtr {
8698         /// Note that this value is always NULL, as there are no contents in the OK variant
8699         pub result: *mut core::ffi::c_void,
8700         /// A pointer to the contents in the error state.
8701         /// Reading from this pointer when `result_ok` is set is undefined.
8702         pub err: *mut crate::lightning_invoice::SemanticError,
8703 }
8704 #[repr(C)]
8705 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8706 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8708 pub struct CResult_NoneSemanticErrorZ {
8709         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8710         /// `err` or `result` depending on the state of `result_ok`.
8711         pub contents: CResult_NoneSemanticErrorZPtr,
8712         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8713         pub result_ok: bool,
8714 }
8715 #[no_mangle]
8716 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8717 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8718         CResult_NoneSemanticErrorZ {
8719                 contents: CResult_NoneSemanticErrorZPtr {
8720                         result: core::ptr::null_mut(),
8721                 },
8722                 result_ok: true,
8723         }
8724 }
8725 #[no_mangle]
8726 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8727 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8728         CResult_NoneSemanticErrorZ {
8729                 contents: CResult_NoneSemanticErrorZPtr {
8730                         err: Box::into_raw(Box::new(e)),
8731                 },
8732                 result_ok: false,
8733         }
8734 }
8735 /// Checks if the given object is currently in the success state
8736 #[no_mangle]
8737 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8738         o.result_ok
8739 }
8740 #[no_mangle]
8741 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8742 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8743 impl Drop for CResult_NoneSemanticErrorZ {
8744         fn drop(&mut self) {
8745                 if self.result_ok {
8746                 } else {
8747                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8748                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8749                         }
8750                 }
8751         }
8752 }
8753 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8754         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8755                 let contents = if o.result_ok {
8756                         let _ = unsafe { Box::from_raw(o.contents.result) };
8757                         o.contents.result = core::ptr::null_mut();
8758                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8759                 } else {
8760                         let err = unsafe { o.contents.err };
8761                         unsafe { o.contents.err = core::ptr::null_mut(); }
8762                         CResult_NoneSemanticErrorZPtr { err }
8763                 };
8764                 Self {
8765                         contents,
8766                         result_ok: o.result_ok,
8767                 }
8768         }
8769 }
8770 impl Clone for CResult_NoneSemanticErrorZ {
8771         fn clone(&self) -> Self {
8772                 if self.result_ok {
8773                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8774                                 result: core::ptr::null_mut()
8775                         } }
8776                 } else {
8777                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8778                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8779                         } }
8780                 }
8781         }
8782 }
8783 #[no_mangle]
8784 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8785 /// but with all dynamically-allocated buffers duplicated in new buffers.
8786 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8787 #[repr(C)]
8788 /// The contents of CResult_InvoiceSemanticErrorZ
8789 pub union CResult_InvoiceSemanticErrorZPtr {
8790         /// A pointer to the contents in the success state.
8791         /// Reading from this pointer when `result_ok` is not set is undefined.
8792         pub result: *mut crate::lightning_invoice::Invoice,
8793         /// A pointer to the contents in the error state.
8794         /// Reading from this pointer when `result_ok` is set is undefined.
8795         pub err: *mut crate::lightning_invoice::SemanticError,
8796 }
8797 #[repr(C)]
8798 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8799 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8801 pub struct CResult_InvoiceSemanticErrorZ {
8802         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8803         /// `err` or `result` depending on the state of `result_ok`.
8804         pub contents: CResult_InvoiceSemanticErrorZPtr,
8805         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8806         pub result_ok: bool,
8807 }
8808 #[no_mangle]
8809 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8810 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8811         CResult_InvoiceSemanticErrorZ {
8812                 contents: CResult_InvoiceSemanticErrorZPtr {
8813                         result: Box::into_raw(Box::new(o)),
8814                 },
8815                 result_ok: true,
8816         }
8817 }
8818 #[no_mangle]
8819 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8820 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8821         CResult_InvoiceSemanticErrorZ {
8822                 contents: CResult_InvoiceSemanticErrorZPtr {
8823                         err: Box::into_raw(Box::new(e)),
8824                 },
8825                 result_ok: false,
8826         }
8827 }
8828 /// Checks if the given object is currently in the success state
8829 #[no_mangle]
8830 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8831         o.result_ok
8832 }
8833 #[no_mangle]
8834 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8835 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8836 impl Drop for CResult_InvoiceSemanticErrorZ {
8837         fn drop(&mut self) {
8838                 if self.result_ok {
8839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8841                         }
8842                 } else {
8843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8845                         }
8846                 }
8847         }
8848 }
8849 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8851                 let contents = if o.result_ok {
8852                         let result = unsafe { o.contents.result };
8853                         unsafe { o.contents.result = core::ptr::null_mut() };
8854                         CResult_InvoiceSemanticErrorZPtr { result }
8855                 } else {
8856                         let err = unsafe { o.contents.err };
8857                         unsafe { o.contents.err = core::ptr::null_mut(); }
8858                         CResult_InvoiceSemanticErrorZPtr { err }
8859                 };
8860                 Self {
8861                         contents,
8862                         result_ok: o.result_ok,
8863                 }
8864         }
8865 }
8866 impl Clone for CResult_InvoiceSemanticErrorZ {
8867         fn clone(&self) -> Self {
8868                 if self.result_ok {
8869                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8870                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8871                         } }
8872                 } else {
8873                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8874                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8875                         } }
8876                 }
8877         }
8878 }
8879 #[no_mangle]
8880 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8881 /// but with all dynamically-allocated buffers duplicated in new buffers.
8882 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8883 #[repr(C)]
8884 /// The contents of CResult_DescriptionCreationErrorZ
8885 pub union CResult_DescriptionCreationErrorZPtr {
8886         /// A pointer to the contents in the success state.
8887         /// Reading from this pointer when `result_ok` is not set is undefined.
8888         pub result: *mut crate::lightning_invoice::Description,
8889         /// A pointer to the contents in the error state.
8890         /// Reading from this pointer when `result_ok` is set is undefined.
8891         pub err: *mut crate::lightning_invoice::CreationError,
8892 }
8893 #[repr(C)]
8894 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8895 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8897 pub struct CResult_DescriptionCreationErrorZ {
8898         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8899         /// `err` or `result` depending on the state of `result_ok`.
8900         pub contents: CResult_DescriptionCreationErrorZPtr,
8901         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8902         pub result_ok: bool,
8903 }
8904 #[no_mangle]
8905 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8906 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8907         CResult_DescriptionCreationErrorZ {
8908                 contents: CResult_DescriptionCreationErrorZPtr {
8909                         result: Box::into_raw(Box::new(o)),
8910                 },
8911                 result_ok: true,
8912         }
8913 }
8914 #[no_mangle]
8915 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8916 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8917         CResult_DescriptionCreationErrorZ {
8918                 contents: CResult_DescriptionCreationErrorZPtr {
8919                         err: Box::into_raw(Box::new(e)),
8920                 },
8921                 result_ok: false,
8922         }
8923 }
8924 /// Checks if the given object is currently in the success state
8925 #[no_mangle]
8926 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8927         o.result_ok
8928 }
8929 #[no_mangle]
8930 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8931 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8932 impl Drop for CResult_DescriptionCreationErrorZ {
8933         fn drop(&mut self) {
8934                 if self.result_ok {
8935                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8936                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8937                         }
8938                 } else {
8939                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8940                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8941                         }
8942                 }
8943         }
8944 }
8945 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8946         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8947                 let contents = if o.result_ok {
8948                         let result = unsafe { o.contents.result };
8949                         unsafe { o.contents.result = core::ptr::null_mut() };
8950                         CResult_DescriptionCreationErrorZPtr { result }
8951                 } else {
8952                         let err = unsafe { o.contents.err };
8953                         unsafe { o.contents.err = core::ptr::null_mut(); }
8954                         CResult_DescriptionCreationErrorZPtr { err }
8955                 };
8956                 Self {
8957                         contents,
8958                         result_ok: o.result_ok,
8959                 }
8960         }
8961 }
8962 impl Clone for CResult_DescriptionCreationErrorZ {
8963         fn clone(&self) -> Self {
8964                 if self.result_ok {
8965                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8966                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8967                         } }
8968                 } else {
8969                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8970                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8971                         } }
8972                 }
8973         }
8974 }
8975 #[no_mangle]
8976 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8977 /// but with all dynamically-allocated buffers duplicated in new buffers.
8978 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8979 #[repr(C)]
8980 /// The contents of CResult_PrivateRouteCreationErrorZ
8981 pub union CResult_PrivateRouteCreationErrorZPtr {
8982         /// A pointer to the contents in the success state.
8983         /// Reading from this pointer when `result_ok` is not set is undefined.
8984         pub result: *mut crate::lightning_invoice::PrivateRoute,
8985         /// A pointer to the contents in the error state.
8986         /// Reading from this pointer when `result_ok` is set is undefined.
8987         pub err: *mut crate::lightning_invoice::CreationError,
8988 }
8989 #[repr(C)]
8990 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8991 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8992 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8993 pub struct CResult_PrivateRouteCreationErrorZ {
8994         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8995         /// `err` or `result` depending on the state of `result_ok`.
8996         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8997         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8998         pub result_ok: bool,
8999 }
9000 #[no_mangle]
9001 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9002 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9003         CResult_PrivateRouteCreationErrorZ {
9004                 contents: CResult_PrivateRouteCreationErrorZPtr {
9005                         result: Box::into_raw(Box::new(o)),
9006                 },
9007                 result_ok: true,
9008         }
9009 }
9010 #[no_mangle]
9011 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9012 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9013         CResult_PrivateRouteCreationErrorZ {
9014                 contents: CResult_PrivateRouteCreationErrorZPtr {
9015                         err: Box::into_raw(Box::new(e)),
9016                 },
9017                 result_ok: false,
9018         }
9019 }
9020 /// Checks if the given object is currently in the success state
9021 #[no_mangle]
9022 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9023         o.result_ok
9024 }
9025 #[no_mangle]
9026 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9027 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9028 impl Drop for CResult_PrivateRouteCreationErrorZ {
9029         fn drop(&mut self) {
9030                 if self.result_ok {
9031                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9032                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9033                         }
9034                 } else {
9035                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9036                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9037                         }
9038                 }
9039         }
9040 }
9041 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9042         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9043                 let contents = if o.result_ok {
9044                         let result = unsafe { o.contents.result };
9045                         unsafe { o.contents.result = core::ptr::null_mut() };
9046                         CResult_PrivateRouteCreationErrorZPtr { result }
9047                 } else {
9048                         let err = unsafe { o.contents.err };
9049                         unsafe { o.contents.err = core::ptr::null_mut(); }
9050                         CResult_PrivateRouteCreationErrorZPtr { err }
9051                 };
9052                 Self {
9053                         contents,
9054                         result_ok: o.result_ok,
9055                 }
9056         }
9057 }
9058 impl Clone for CResult_PrivateRouteCreationErrorZ {
9059         fn clone(&self) -> Self {
9060                 if self.result_ok {
9061                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9062                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9063                         } }
9064                 } else {
9065                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9066                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9067                         } }
9068                 }
9069         }
9070 }
9071 #[no_mangle]
9072 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9073 /// but with all dynamically-allocated buffers duplicated in new buffers.
9074 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9075 #[repr(C)]
9076 /// The contents of CResult_StringErrorZ
9077 pub union CResult_StringErrorZPtr {
9078         /// A pointer to the contents in the success state.
9079         /// Reading from this pointer when `result_ok` is not set is undefined.
9080         pub result: *mut crate::c_types::Str,
9081         /// A pointer to the contents in the error state.
9082         /// Reading from this pointer when `result_ok` is set is undefined.
9083         pub err: *mut crate::c_types::Secp256k1Error,
9084 }
9085 #[repr(C)]
9086 /// A CResult_StringErrorZ represents the result of a fallible operation,
9087 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9088 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9089 pub struct CResult_StringErrorZ {
9090         /// The contents of this CResult_StringErrorZ, accessible via either
9091         /// `err` or `result` depending on the state of `result_ok`.
9092         pub contents: CResult_StringErrorZPtr,
9093         /// Whether this CResult_StringErrorZ represents a success state.
9094         pub result_ok: bool,
9095 }
9096 #[no_mangle]
9097 /// Creates a new CResult_StringErrorZ in the success state.
9098 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9099         CResult_StringErrorZ {
9100                 contents: CResult_StringErrorZPtr {
9101                         result: Box::into_raw(Box::new(o)),
9102                 },
9103                 result_ok: true,
9104         }
9105 }
9106 #[no_mangle]
9107 /// Creates a new CResult_StringErrorZ in the error state.
9108 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9109         CResult_StringErrorZ {
9110                 contents: CResult_StringErrorZPtr {
9111                         err: Box::into_raw(Box::new(e)),
9112                 },
9113                 result_ok: false,
9114         }
9115 }
9116 /// Checks if the given object is currently in the success state
9117 #[no_mangle]
9118 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9119         o.result_ok
9120 }
9121 #[no_mangle]
9122 /// Frees any resources used by the CResult_StringErrorZ.
9123 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9124 impl Drop for CResult_StringErrorZ {
9125         fn drop(&mut self) {
9126                 if self.result_ok {
9127                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9128                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9129                         }
9130                 } else {
9131                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9132                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9133                         }
9134                 }
9135         }
9136 }
9137 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9138         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9139                 let contents = if o.result_ok {
9140                         let result = unsafe { o.contents.result };
9141                         unsafe { o.contents.result = core::ptr::null_mut() };
9142                         CResult_StringErrorZPtr { result }
9143                 } else {
9144                         let err = unsafe { o.contents.err };
9145                         unsafe { o.contents.err = core::ptr::null_mut(); }
9146                         CResult_StringErrorZPtr { err }
9147                 };
9148                 Self {
9149                         contents,
9150                         result_ok: o.result_ok,
9151                 }
9152         }
9153 }
9154 #[repr(C)]
9155 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9156 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9157         /// A pointer to the contents in the success state.
9158         /// Reading from this pointer when `result_ok` is not set is undefined.
9159         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9160         /// A pointer to the contents in the error state.
9161         /// Reading from this pointer when `result_ok` is set is undefined.
9162         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9163 }
9164 #[repr(C)]
9165 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9166 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9167 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9168 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9169         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9170         /// `err` or `result` depending on the state of `result_ok`.
9171         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9172         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9173         pub result_ok: bool,
9174 }
9175 #[no_mangle]
9176 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9177 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9178         CResult_ChannelMonitorUpdateDecodeErrorZ {
9179                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9180                         result: Box::into_raw(Box::new(o)),
9181                 },
9182                 result_ok: true,
9183         }
9184 }
9185 #[no_mangle]
9186 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9187 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9188         CResult_ChannelMonitorUpdateDecodeErrorZ {
9189                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9190                         err: Box::into_raw(Box::new(e)),
9191                 },
9192                 result_ok: false,
9193         }
9194 }
9195 /// Checks if the given object is currently in the success state
9196 #[no_mangle]
9197 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9198         o.result_ok
9199 }
9200 #[no_mangle]
9201 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9202 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9203 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9204         fn drop(&mut self) {
9205                 if self.result_ok {
9206                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9207                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9208                         }
9209                 } else {
9210                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9211                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9212                         }
9213                 }
9214         }
9215 }
9216 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9217         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9218                 let contents = if o.result_ok {
9219                         let result = unsafe { o.contents.result };
9220                         unsafe { o.contents.result = core::ptr::null_mut() };
9221                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9222                 } else {
9223                         let err = unsafe { o.contents.err };
9224                         unsafe { o.contents.err = core::ptr::null_mut(); }
9225                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9226                 };
9227                 Self {
9228                         contents,
9229                         result_ok: o.result_ok,
9230                 }
9231         }
9232 }
9233 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9234         fn clone(&self) -> Self {
9235                 if self.result_ok {
9236                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9237                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9238                         } }
9239                 } else {
9240                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9241                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9242                         } }
9243                 }
9244         }
9245 }
9246 #[no_mangle]
9247 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9248 /// but with all dynamically-allocated buffers duplicated in new buffers.
9249 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9250 #[repr(C)]
9251 #[derive(Clone)]
9252 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9253 pub enum COption_MonitorEventZ {
9254         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9255         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9256         /// When we're in this state, this COption_MonitorEventZ contains nothing
9257         None
9258 }
9259 impl COption_MonitorEventZ {
9260         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9261                 if let Self::None = self { false } else { true }
9262         }
9263         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9264                 !self.is_some()
9265         }
9266         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9267                 if let Self::Some(v) = self { v } else { unreachable!() }
9268         }
9269 }
9270 #[no_mangle]
9271 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9272 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9273         COption_MonitorEventZ::Some(o)
9274 }
9275 #[no_mangle]
9276 /// Constructs a new COption_MonitorEventZ containing nothing
9277 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9278         COption_MonitorEventZ::None
9279 }
9280 #[no_mangle]
9281 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9282 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9283 #[no_mangle]
9284 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9285 /// but with all dynamically-allocated buffers duplicated in new buffers.
9286 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9287 #[repr(C)]
9288 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9289 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9290         /// A pointer to the contents in the success state.
9291         /// Reading from this pointer when `result_ok` is not set is undefined.
9292         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9293         /// A pointer to the contents in the error state.
9294         /// Reading from this pointer when `result_ok` is set is undefined.
9295         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9296 }
9297 #[repr(C)]
9298 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9299 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9300 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9301 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9302         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9303         /// `err` or `result` depending on the state of `result_ok`.
9304         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9305         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9306         pub result_ok: bool,
9307 }
9308 #[no_mangle]
9309 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9310 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9311         CResult_COption_MonitorEventZDecodeErrorZ {
9312                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9313                         result: Box::into_raw(Box::new(o)),
9314                 },
9315                 result_ok: true,
9316         }
9317 }
9318 #[no_mangle]
9319 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9320 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9321         CResult_COption_MonitorEventZDecodeErrorZ {
9322                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9323                         err: Box::into_raw(Box::new(e)),
9324                 },
9325                 result_ok: false,
9326         }
9327 }
9328 /// Checks if the given object is currently in the success state
9329 #[no_mangle]
9330 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9331         o.result_ok
9332 }
9333 #[no_mangle]
9334 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9335 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9336 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9337         fn drop(&mut self) {
9338                 if self.result_ok {
9339                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9340                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9341                         }
9342                 } else {
9343                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9344                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9345                         }
9346                 }
9347         }
9348 }
9349 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9350         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9351                 let contents = if o.result_ok {
9352                         let result = unsafe { o.contents.result };
9353                         unsafe { o.contents.result = core::ptr::null_mut() };
9354                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9355                 } else {
9356                         let err = unsafe { o.contents.err };
9357                         unsafe { o.contents.err = core::ptr::null_mut(); }
9358                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9359                 };
9360                 Self {
9361                         contents,
9362                         result_ok: o.result_ok,
9363                 }
9364         }
9365 }
9366 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9367         fn clone(&self) -> Self {
9368                 if self.result_ok {
9369                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9370                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9371                         } }
9372                 } else {
9373                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9374                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9375                         } }
9376                 }
9377         }
9378 }
9379 #[no_mangle]
9380 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9381 /// but with all dynamically-allocated buffers duplicated in new buffers.
9382 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9383 #[repr(C)]
9384 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9385 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9386         /// A pointer to the contents in the success state.
9387         /// Reading from this pointer when `result_ok` is not set is undefined.
9388         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9389         /// A pointer to the contents in the error state.
9390         /// Reading from this pointer when `result_ok` is set is undefined.
9391         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9392 }
9393 #[repr(C)]
9394 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9395 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9396 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9397 pub struct CResult_HTLCUpdateDecodeErrorZ {
9398         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9399         /// `err` or `result` depending on the state of `result_ok`.
9400         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9401         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9402         pub result_ok: bool,
9403 }
9404 #[no_mangle]
9405 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9406 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9407         CResult_HTLCUpdateDecodeErrorZ {
9408                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9409                         result: Box::into_raw(Box::new(o)),
9410                 },
9411                 result_ok: true,
9412         }
9413 }
9414 #[no_mangle]
9415 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9416 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9417         CResult_HTLCUpdateDecodeErrorZ {
9418                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9419                         err: Box::into_raw(Box::new(e)),
9420                 },
9421                 result_ok: false,
9422         }
9423 }
9424 /// Checks if the given object is currently in the success state
9425 #[no_mangle]
9426 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9427         o.result_ok
9428 }
9429 #[no_mangle]
9430 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9431 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9432 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9433         fn drop(&mut self) {
9434                 if self.result_ok {
9435                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9436                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9437                         }
9438                 } else {
9439                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9440                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9441                         }
9442                 }
9443         }
9444 }
9445 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9446         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9447                 let contents = if o.result_ok {
9448                         let result = unsafe { o.contents.result };
9449                         unsafe { o.contents.result = core::ptr::null_mut() };
9450                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9451                 } else {
9452                         let err = unsafe { o.contents.err };
9453                         unsafe { o.contents.err = core::ptr::null_mut(); }
9454                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9455                 };
9456                 Self {
9457                         contents,
9458                         result_ok: o.result_ok,
9459                 }
9460         }
9461 }
9462 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9463         fn clone(&self) -> Self {
9464                 if self.result_ok {
9465                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9466                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9467                         } }
9468                 } else {
9469                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9470                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9471                         } }
9472                 }
9473         }
9474 }
9475 #[no_mangle]
9476 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9477 /// but with all dynamically-allocated buffers duplicated in new buffers.
9478 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9479 #[repr(C)]
9480 /// A tuple of 2 elements. See the individual fields for the types contained.
9481 pub struct C2Tuple_OutPointScriptZ {
9482         /// The element at position 0
9483         pub a: crate::lightning::chain::transaction::OutPoint,
9484         /// The element at position 1
9485         pub b: crate::c_types::derived::CVec_u8Z,
9486 }
9487 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9488         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9489                 Self {
9490                         a: tup.0,
9491                         b: tup.1,
9492                 }
9493         }
9494 }
9495 impl C2Tuple_OutPointScriptZ {
9496         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9497                 (self.a, self.b)
9498         }
9499 }
9500 impl Clone for C2Tuple_OutPointScriptZ {
9501         fn clone(&self) -> Self {
9502                 Self {
9503                         a: Clone::clone(&self.a),
9504                         b: Clone::clone(&self.b),
9505                 }
9506         }
9507 }
9508 #[no_mangle]
9509 /// Creates a new tuple which has the same data as `orig`
9510 /// but with all dynamically-allocated buffers duplicated in new buffers.
9511 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9512 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9513 #[no_mangle]
9514 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9515         C2Tuple_OutPointScriptZ { a, b, }
9516 }
9517
9518 #[no_mangle]
9519 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9520 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9521 #[repr(C)]
9522 /// A tuple of 2 elements. See the individual fields for the types contained.
9523 pub struct C2Tuple_u32ScriptZ {
9524         /// The element at position 0
9525         pub a: u32,
9526         /// The element at position 1
9527         pub b: crate::c_types::derived::CVec_u8Z,
9528 }
9529 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9530         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9531                 Self {
9532                         a: tup.0,
9533                         b: tup.1,
9534                 }
9535         }
9536 }
9537 impl C2Tuple_u32ScriptZ {
9538         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9539                 (self.a, self.b)
9540         }
9541 }
9542 impl Clone for C2Tuple_u32ScriptZ {
9543         fn clone(&self) -> Self {
9544                 Self {
9545                         a: Clone::clone(&self.a),
9546                         b: Clone::clone(&self.b),
9547                 }
9548         }
9549 }
9550 #[no_mangle]
9551 /// Creates a new tuple which has the same data as `orig`
9552 /// but with all dynamically-allocated buffers duplicated in new buffers.
9553 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9554 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9555 #[no_mangle]
9556 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9557         C2Tuple_u32ScriptZ { a, b, }
9558 }
9559
9560 #[no_mangle]
9561 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9562 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9563 #[repr(C)]
9564 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9565 /// This corresponds to std::vector in C++
9566 pub struct CVec_C2Tuple_u32ScriptZZ {
9567         /// The elements in the array.
9568         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9569         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9570         /// The number of elements pointed to by `data`.
9571         pub datalen: usize
9572 }
9573 impl CVec_C2Tuple_u32ScriptZZ {
9574         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9575                 if self.datalen == 0 { return Vec::new(); }
9576                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9577                 self.data = core::ptr::null_mut();
9578                 self.datalen = 0;
9579                 ret
9580         }
9581         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9582                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9583         }
9584 }
9585 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9586         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9587                 let datalen = v.len();
9588                 let data = Box::into_raw(v.into_boxed_slice());
9589                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9590         }
9591 }
9592 #[no_mangle]
9593 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9594 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9595 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9596         fn drop(&mut self) {
9597                 if self.datalen == 0 { return; }
9598                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9599         }
9600 }
9601 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9602         fn clone(&self) -> Self {
9603                 let mut res = Vec::new();
9604                 if self.datalen == 0 { return Self::from(res); }
9605                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9606                 Self::from(res)
9607         }
9608 }
9609 #[repr(C)]
9610 /// A tuple of 2 elements. See the individual fields for the types contained.
9611 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9612         /// The element at position 0
9613         pub a: crate::c_types::ThirtyTwoBytes,
9614         /// The element at position 1
9615         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9616 }
9617 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9618         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9619                 Self {
9620                         a: tup.0,
9621                         b: tup.1,
9622                 }
9623         }
9624 }
9625 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9626         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9627                 (self.a, self.b)
9628         }
9629 }
9630 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9631         fn clone(&self) -> Self {
9632                 Self {
9633                         a: Clone::clone(&self.a),
9634                         b: Clone::clone(&self.b),
9635                 }
9636         }
9637 }
9638 #[no_mangle]
9639 /// Creates a new tuple which has the same data as `orig`
9640 /// but with all dynamically-allocated buffers duplicated in new buffers.
9641 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9642 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9643 #[no_mangle]
9644 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 {
9645         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9646 }
9647
9648 #[no_mangle]
9649 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9650 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9651 #[repr(C)]
9652 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9653 /// This corresponds to std::vector in C++
9654 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9655         /// The elements in the array.
9656         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9657         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9658         /// The number of elements pointed to by `data`.
9659         pub datalen: usize
9660 }
9661 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9662         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9663                 if self.datalen == 0 { return Vec::new(); }
9664                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9665                 self.data = core::ptr::null_mut();
9666                 self.datalen = 0;
9667                 ret
9668         }
9669         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9670                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9671         }
9672 }
9673 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9674         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9675                 let datalen = v.len();
9676                 let data = Box::into_raw(v.into_boxed_slice());
9677                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9678         }
9679 }
9680 #[no_mangle]
9681 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9682 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9683 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9684         fn drop(&mut self) {
9685                 if self.datalen == 0 { return; }
9686                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9687         }
9688 }
9689 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9690         fn clone(&self) -> Self {
9691                 let mut res = Vec::new();
9692                 if self.datalen == 0 { return Self::from(res); }
9693                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9694                 Self::from(res)
9695         }
9696 }
9697 #[repr(C)]
9698 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9699 /// This corresponds to std::vector in C++
9700 pub struct CVec_EventZ {
9701         /// The elements in the array.
9702         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9703         pub data: *mut crate::lightning::util::events::Event,
9704         /// The number of elements pointed to by `data`.
9705         pub datalen: usize
9706 }
9707 impl CVec_EventZ {
9708         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9709                 if self.datalen == 0 { return Vec::new(); }
9710                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9711                 self.data = core::ptr::null_mut();
9712                 self.datalen = 0;
9713                 ret
9714         }
9715         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9716                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9717         }
9718 }
9719 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9720         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9721                 let datalen = v.len();
9722                 let data = Box::into_raw(v.into_boxed_slice());
9723                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9724         }
9725 }
9726 #[no_mangle]
9727 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9728 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9729 impl Drop for CVec_EventZ {
9730         fn drop(&mut self) {
9731                 if self.datalen == 0 { return; }
9732                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9733         }
9734 }
9735 impl Clone for CVec_EventZ {
9736         fn clone(&self) -> Self {
9737                 let mut res = Vec::new();
9738                 if self.datalen == 0 { return Self::from(res); }
9739                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9740                 Self::from(res)
9741         }
9742 }
9743 #[repr(C)]
9744 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9745 /// This corresponds to std::vector in C++
9746 pub struct CVec_TransactionZ {
9747         /// The elements in the array.
9748         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9749         pub data: *mut crate::c_types::Transaction,
9750         /// The number of elements pointed to by `data`.
9751         pub datalen: usize
9752 }
9753 impl CVec_TransactionZ {
9754         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9755                 if self.datalen == 0 { return Vec::new(); }
9756                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9757                 self.data = core::ptr::null_mut();
9758                 self.datalen = 0;
9759                 ret
9760         }
9761         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9762                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9763         }
9764 }
9765 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9766         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9767                 let datalen = v.len();
9768                 let data = Box::into_raw(v.into_boxed_slice());
9769                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9770         }
9771 }
9772 #[no_mangle]
9773 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9774 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9775 impl Drop for CVec_TransactionZ {
9776         fn drop(&mut self) {
9777                 if self.datalen == 0 { return; }
9778                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9779         }
9780 }
9781 impl Clone for CVec_TransactionZ {
9782         fn clone(&self) -> Self {
9783                 let mut res = Vec::new();
9784                 if self.datalen == 0 { return Self::from(res); }
9785                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9786                 Self::from(res)
9787         }
9788 }
9789 #[repr(C)]
9790 /// A tuple of 2 elements. See the individual fields for the types contained.
9791 pub struct C2Tuple_u32TxOutZ {
9792         /// The element at position 0
9793         pub a: u32,
9794         /// The element at position 1
9795         pub b: crate::c_types::TxOut,
9796 }
9797 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9798         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9799                 Self {
9800                         a: tup.0,
9801                         b: tup.1,
9802                 }
9803         }
9804 }
9805 impl C2Tuple_u32TxOutZ {
9806         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9807                 (self.a, self.b)
9808         }
9809 }
9810 impl Clone for C2Tuple_u32TxOutZ {
9811         fn clone(&self) -> Self {
9812                 Self {
9813                         a: Clone::clone(&self.a),
9814                         b: Clone::clone(&self.b),
9815                 }
9816         }
9817 }
9818 #[no_mangle]
9819 /// Creates a new tuple which has the same data as `orig`
9820 /// but with all dynamically-allocated buffers duplicated in new buffers.
9821 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9822 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9823 #[no_mangle]
9824 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9825         C2Tuple_u32TxOutZ { a, b, }
9826 }
9827
9828 #[no_mangle]
9829 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9830 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9831 #[repr(C)]
9832 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9833 /// This corresponds to std::vector in C++
9834 pub struct CVec_C2Tuple_u32TxOutZZ {
9835         /// The elements in the array.
9836         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9837         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9838         /// The number of elements pointed to by `data`.
9839         pub datalen: usize
9840 }
9841 impl CVec_C2Tuple_u32TxOutZZ {
9842         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9843                 if self.datalen == 0 { return Vec::new(); }
9844                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9845                 self.data = core::ptr::null_mut();
9846                 self.datalen = 0;
9847                 ret
9848         }
9849         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9850                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9851         }
9852 }
9853 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9854         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9855                 let datalen = v.len();
9856                 let data = Box::into_raw(v.into_boxed_slice());
9857                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9858         }
9859 }
9860 #[no_mangle]
9861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9862 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9863 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9864         fn drop(&mut self) {
9865                 if self.datalen == 0 { return; }
9866                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9867         }
9868 }
9869 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9870         fn clone(&self) -> Self {
9871                 let mut res = Vec::new();
9872                 if self.datalen == 0 { return Self::from(res); }
9873                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9874                 Self::from(res)
9875         }
9876 }
9877 #[repr(C)]
9878 /// A tuple of 2 elements. See the individual fields for the types contained.
9879 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9880         /// The element at position 0
9881         pub a: crate::c_types::ThirtyTwoBytes,
9882         /// The element at position 1
9883         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9884 }
9885 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9886         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9887                 Self {
9888                         a: tup.0,
9889                         b: tup.1,
9890                 }
9891         }
9892 }
9893 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9894         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9895                 (self.a, self.b)
9896         }
9897 }
9898 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9899         fn clone(&self) -> Self {
9900                 Self {
9901                         a: Clone::clone(&self.a),
9902                         b: Clone::clone(&self.b),
9903                 }
9904         }
9905 }
9906 #[no_mangle]
9907 /// Creates a new tuple which has the same data as `orig`
9908 /// but with all dynamically-allocated buffers duplicated in new buffers.
9909 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9910 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9911 #[no_mangle]
9912 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 {
9913         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9914 }
9915
9916 #[no_mangle]
9917 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9918 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9919 #[repr(C)]
9920 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9921 /// This corresponds to std::vector in C++
9922 pub struct CVec_TransactionOutputsZ {
9923         /// The elements in the array.
9924         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9925         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9926         /// The number of elements pointed to by `data`.
9927         pub datalen: usize
9928 }
9929 impl CVec_TransactionOutputsZ {
9930         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9931                 if self.datalen == 0 { return Vec::new(); }
9932                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9933                 self.data = core::ptr::null_mut();
9934                 self.datalen = 0;
9935                 ret
9936         }
9937         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9938                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9939         }
9940 }
9941 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9942         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9943                 let datalen = v.len();
9944                 let data = Box::into_raw(v.into_boxed_slice());
9945                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9946         }
9947 }
9948 #[no_mangle]
9949 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9950 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9951 impl Drop for CVec_TransactionOutputsZ {
9952         fn drop(&mut self) {
9953                 if self.datalen == 0 { return; }
9954                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9955         }
9956 }
9957 impl Clone for CVec_TransactionOutputsZ {
9958         fn clone(&self) -> Self {
9959                 let mut res = Vec::new();
9960                 if self.datalen == 0 { return Self::from(res); }
9961                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9962                 Self::from(res)
9963         }
9964 }
9965 #[repr(C)]
9966 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9967 /// This corresponds to std::vector in C++
9968 pub struct CVec_BalanceZ {
9969         /// The elements in the array.
9970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9971         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9972         /// The number of elements pointed to by `data`.
9973         pub datalen: usize
9974 }
9975 impl CVec_BalanceZ {
9976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9977                 if self.datalen == 0 { return Vec::new(); }
9978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9979                 self.data = core::ptr::null_mut();
9980                 self.datalen = 0;
9981                 ret
9982         }
9983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9985         }
9986 }
9987 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9988         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9989                 let datalen = v.len();
9990                 let data = Box::into_raw(v.into_boxed_slice());
9991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9992         }
9993 }
9994 #[no_mangle]
9995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9996 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9997 impl Drop for CVec_BalanceZ {
9998         fn drop(&mut self) {
9999                 if self.datalen == 0 { return; }
10000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10001         }
10002 }
10003 impl Clone for CVec_BalanceZ {
10004         fn clone(&self) -> Self {
10005                 let mut res = Vec::new();
10006                 if self.datalen == 0 { return Self::from(res); }
10007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10008                 Self::from(res)
10009         }
10010 }
10011 #[repr(C)]
10012 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10013 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10014         /// A pointer to the contents in the success state.
10015         /// Reading from this pointer when `result_ok` is not set is undefined.
10016         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10017         /// A pointer to the contents in the error state.
10018         /// Reading from this pointer when `result_ok` is set is undefined.
10019         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10020 }
10021 #[repr(C)]
10022 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10023 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10024 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10025 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10026         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10027         /// `err` or `result` depending on the state of `result_ok`.
10028         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10029         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10030         pub result_ok: bool,
10031 }
10032 #[no_mangle]
10033 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10034 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10035         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10036                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10037                         result: Box::into_raw(Box::new(o)),
10038                 },
10039                 result_ok: true,
10040         }
10041 }
10042 #[no_mangle]
10043 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10044 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10045         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10046                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10047                         err: Box::into_raw(Box::new(e)),
10048                 },
10049                 result_ok: false,
10050         }
10051 }
10052 /// Checks if the given object is currently in the success state
10053 #[no_mangle]
10054 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10055         o.result_ok
10056 }
10057 #[no_mangle]
10058 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10059 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10060 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10061         fn drop(&mut self) {
10062                 if self.result_ok {
10063                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10064                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10065                         }
10066                 } else {
10067                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10068                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10069                         }
10070                 }
10071         }
10072 }
10073 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10074         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10075                 let contents = if o.result_ok {
10076                         let result = unsafe { o.contents.result };
10077                         unsafe { o.contents.result = core::ptr::null_mut() };
10078                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10079                 } else {
10080                         let err = unsafe { o.contents.err };
10081                         unsafe { o.contents.err = core::ptr::null_mut(); }
10082                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10083                 };
10084                 Self {
10085                         contents,
10086                         result_ok: o.result_ok,
10087                 }
10088         }
10089 }
10090 #[repr(C)]
10091 /// The contents of CResult_NoneLightningErrorZ
10092 pub union CResult_NoneLightningErrorZPtr {
10093         /// Note that this value is always NULL, as there are no contents in the OK variant
10094         pub result: *mut core::ffi::c_void,
10095         /// A pointer to the contents in the error state.
10096         /// Reading from this pointer when `result_ok` is set is undefined.
10097         pub err: *mut crate::lightning::ln::msgs::LightningError,
10098 }
10099 #[repr(C)]
10100 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10101 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10103 pub struct CResult_NoneLightningErrorZ {
10104         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10105         /// `err` or `result` depending on the state of `result_ok`.
10106         pub contents: CResult_NoneLightningErrorZPtr,
10107         /// Whether this CResult_NoneLightningErrorZ represents a success state.
10108         pub result_ok: bool,
10109 }
10110 #[no_mangle]
10111 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10112 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10113         CResult_NoneLightningErrorZ {
10114                 contents: CResult_NoneLightningErrorZPtr {
10115                         result: core::ptr::null_mut(),
10116                 },
10117                 result_ok: true,
10118         }
10119 }
10120 #[no_mangle]
10121 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10122 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10123         CResult_NoneLightningErrorZ {
10124                 contents: CResult_NoneLightningErrorZPtr {
10125                         err: Box::into_raw(Box::new(e)),
10126                 },
10127                 result_ok: false,
10128         }
10129 }
10130 /// Checks if the given object is currently in the success state
10131 #[no_mangle]
10132 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10133         o.result_ok
10134 }
10135 #[no_mangle]
10136 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10137 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10138 impl Drop for CResult_NoneLightningErrorZ {
10139         fn drop(&mut self) {
10140                 if self.result_ok {
10141                 } else {
10142                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10143                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10144                         }
10145                 }
10146         }
10147 }
10148 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10149         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10150                 let contents = if o.result_ok {
10151                         let _ = unsafe { Box::from_raw(o.contents.result) };
10152                         o.contents.result = core::ptr::null_mut();
10153                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10154                 } else {
10155                         let err = unsafe { o.contents.err };
10156                         unsafe { o.contents.err = core::ptr::null_mut(); }
10157                         CResult_NoneLightningErrorZPtr { err }
10158                 };
10159                 Self {
10160                         contents,
10161                         result_ok: o.result_ok,
10162                 }
10163         }
10164 }
10165 impl Clone for CResult_NoneLightningErrorZ {
10166         fn clone(&self) -> Self {
10167                 if self.result_ok {
10168                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10169                                 result: core::ptr::null_mut()
10170                         } }
10171                 } else {
10172                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10173                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10174                         } }
10175                 }
10176         }
10177 }
10178 #[no_mangle]
10179 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10180 /// but with all dynamically-allocated buffers duplicated in new buffers.
10181 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10182 #[repr(C)]
10183 /// A tuple of 2 elements. See the individual fields for the types contained.
10184 pub struct C2Tuple_PublicKeyTypeZ {
10185         /// The element at position 0
10186         pub a: crate::c_types::PublicKey,
10187         /// The element at position 1
10188         pub b: crate::lightning::ln::wire::Type,
10189 }
10190 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10191         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10192                 Self {
10193                         a: tup.0,
10194                         b: tup.1,
10195                 }
10196         }
10197 }
10198 impl C2Tuple_PublicKeyTypeZ {
10199         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10200                 (self.a, self.b)
10201         }
10202 }
10203 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10204 #[no_mangle]
10205 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10206         C2Tuple_PublicKeyTypeZ { a, b, }
10207 }
10208
10209 #[no_mangle]
10210 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10211 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10212 #[repr(C)]
10213 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10214 /// This corresponds to std::vector in C++
10215 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10216         /// The elements in the array.
10217         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10218         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10219         /// The number of elements pointed to by `data`.
10220         pub datalen: usize
10221 }
10222 impl CVec_C2Tuple_PublicKeyTypeZZ {
10223         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10224                 if self.datalen == 0 { return Vec::new(); }
10225                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10226                 self.data = core::ptr::null_mut();
10227                 self.datalen = 0;
10228                 ret
10229         }
10230         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10231                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10232         }
10233 }
10234 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10235         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10236                 let datalen = v.len();
10237                 let data = Box::into_raw(v.into_boxed_slice());
10238                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10239         }
10240 }
10241 #[no_mangle]
10242 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10243 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10244 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10245         fn drop(&mut self) {
10246                 if self.datalen == 0 { return; }
10247                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10248         }
10249 }
10250 #[repr(C)]
10251 /// The contents of CResult_boolLightningErrorZ
10252 pub union CResult_boolLightningErrorZPtr {
10253         /// A pointer to the contents in the success state.
10254         /// Reading from this pointer when `result_ok` is not set is undefined.
10255         pub result: *mut bool,
10256         /// A pointer to the contents in the error state.
10257         /// Reading from this pointer when `result_ok` is set is undefined.
10258         pub err: *mut crate::lightning::ln::msgs::LightningError,
10259 }
10260 #[repr(C)]
10261 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10262 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10263 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10264 pub struct CResult_boolLightningErrorZ {
10265         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10266         /// `err` or `result` depending on the state of `result_ok`.
10267         pub contents: CResult_boolLightningErrorZPtr,
10268         /// Whether this CResult_boolLightningErrorZ represents a success state.
10269         pub result_ok: bool,
10270 }
10271 #[no_mangle]
10272 /// Creates a new CResult_boolLightningErrorZ in the success state.
10273 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10274         CResult_boolLightningErrorZ {
10275                 contents: CResult_boolLightningErrorZPtr {
10276                         result: Box::into_raw(Box::new(o)),
10277                 },
10278                 result_ok: true,
10279         }
10280 }
10281 #[no_mangle]
10282 /// Creates a new CResult_boolLightningErrorZ in the error state.
10283 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10284         CResult_boolLightningErrorZ {
10285                 contents: CResult_boolLightningErrorZPtr {
10286                         err: Box::into_raw(Box::new(e)),
10287                 },
10288                 result_ok: false,
10289         }
10290 }
10291 /// Checks if the given object is currently in the success state
10292 #[no_mangle]
10293 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10294         o.result_ok
10295 }
10296 #[no_mangle]
10297 /// Frees any resources used by the CResult_boolLightningErrorZ.
10298 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10299 impl Drop for CResult_boolLightningErrorZ {
10300         fn drop(&mut self) {
10301                 if self.result_ok {
10302                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10303                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10304                         }
10305                 } else {
10306                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10307                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10308                         }
10309                 }
10310         }
10311 }
10312 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10313         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10314                 let contents = if o.result_ok {
10315                         let result = unsafe { o.contents.result };
10316                         unsafe { o.contents.result = core::ptr::null_mut() };
10317                         CResult_boolLightningErrorZPtr { result }
10318                 } else {
10319                         let err = unsafe { o.contents.err };
10320                         unsafe { o.contents.err = core::ptr::null_mut(); }
10321                         CResult_boolLightningErrorZPtr { err }
10322                 };
10323                 Self {
10324                         contents,
10325                         result_ok: o.result_ok,
10326                 }
10327         }
10328 }
10329 impl Clone for CResult_boolLightningErrorZ {
10330         fn clone(&self) -> Self {
10331                 if self.result_ok {
10332                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10333                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10334                         } }
10335                 } else {
10336                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10337                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10338                         } }
10339                 }
10340         }
10341 }
10342 #[no_mangle]
10343 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10344 /// but with all dynamically-allocated buffers duplicated in new buffers.
10345 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10346 #[repr(C)]
10347 /// A tuple of 3 elements. See the individual fields for the types contained.
10348 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10349         /// The element at position 0
10350         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10351         /// The element at position 1
10352         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10353         /// The element at position 2
10354         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10355 }
10356 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10357         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10358                 Self {
10359                         a: tup.0,
10360                         b: tup.1,
10361                         c: tup.2,
10362                 }
10363         }
10364 }
10365 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10366         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10367                 (self.a, self.b, self.c)
10368         }
10369 }
10370 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10371         fn clone(&self) -> Self {
10372                 Self {
10373                         a: Clone::clone(&self.a),
10374                         b: Clone::clone(&self.b),
10375                         c: Clone::clone(&self.c),
10376                 }
10377         }
10378 }
10379 #[no_mangle]
10380 /// Creates a new tuple which has the same data as `orig`
10381 /// but with all dynamically-allocated buffers duplicated in new buffers.
10382 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10383 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10384 #[no_mangle]
10385 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 {
10386         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10387 }
10388
10389 #[no_mangle]
10390 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10391 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10392 #[repr(C)]
10393 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10394 /// This corresponds to std::vector in C++
10395 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10396         /// The elements in the array.
10397         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10398         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10399         /// The number of elements pointed to by `data`.
10400         pub datalen: usize
10401 }
10402 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10403         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10404                 if self.datalen == 0 { return Vec::new(); }
10405                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10406                 self.data = core::ptr::null_mut();
10407                 self.datalen = 0;
10408                 ret
10409         }
10410         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10411                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10412         }
10413 }
10414 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10415         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10416                 let datalen = v.len();
10417                 let data = Box::into_raw(v.into_boxed_slice());
10418                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10419         }
10420 }
10421 #[no_mangle]
10422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10423 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10424 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10425         fn drop(&mut self) {
10426                 if self.datalen == 0 { return; }
10427                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10428         }
10429 }
10430 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10431         fn clone(&self) -> Self {
10432                 let mut res = Vec::new();
10433                 if self.datalen == 0 { return Self::from(res); }
10434                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10435                 Self::from(res)
10436         }
10437 }
10438 #[repr(C)]
10439 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10440 /// This corresponds to std::vector in C++
10441 pub struct CVec_NodeAnnouncementZ {
10442         /// The elements in the array.
10443         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10444         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10445         /// The number of elements pointed to by `data`.
10446         pub datalen: usize
10447 }
10448 impl CVec_NodeAnnouncementZ {
10449         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10450                 if self.datalen == 0 { return Vec::new(); }
10451                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10452                 self.data = core::ptr::null_mut();
10453                 self.datalen = 0;
10454                 ret
10455         }
10456         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10457                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10458         }
10459 }
10460 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10461         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10462                 let datalen = v.len();
10463                 let data = Box::into_raw(v.into_boxed_slice());
10464                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10465         }
10466 }
10467 #[no_mangle]
10468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10469 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10470 impl Drop for CVec_NodeAnnouncementZ {
10471         fn drop(&mut self) {
10472                 if self.datalen == 0 { return; }
10473                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10474         }
10475 }
10476 impl Clone for CVec_NodeAnnouncementZ {
10477         fn clone(&self) -> Self {
10478                 let mut res = Vec::new();
10479                 if self.datalen == 0 { return Self::from(res); }
10480                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10481                 Self::from(res)
10482         }
10483 }
10484 #[repr(C)]
10485 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10486 /// This corresponds to std::vector in C++
10487 pub struct CVec_PublicKeyZ {
10488         /// The elements in the array.
10489         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10490         pub data: *mut crate::c_types::PublicKey,
10491         /// The number of elements pointed to by `data`.
10492         pub datalen: usize
10493 }
10494 impl CVec_PublicKeyZ {
10495         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10496                 if self.datalen == 0 { return Vec::new(); }
10497                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10498                 self.data = core::ptr::null_mut();
10499                 self.datalen = 0;
10500                 ret
10501         }
10502         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10503                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10504         }
10505 }
10506 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10507         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10508                 let datalen = v.len();
10509                 let data = Box::into_raw(v.into_boxed_slice());
10510                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10511         }
10512 }
10513 #[no_mangle]
10514 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10515 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10516 impl Drop for CVec_PublicKeyZ {
10517         fn drop(&mut self) {
10518                 if self.datalen == 0 { return; }
10519                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10520         }
10521 }
10522 impl Clone for CVec_PublicKeyZ {
10523         fn clone(&self) -> Self {
10524                 let mut res = Vec::new();
10525                 if self.datalen == 0 { return Self::from(res); }
10526                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10527                 Self::from(res)
10528         }
10529 }
10530 #[repr(C)]
10531 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10532 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10533         /// A pointer to the contents in the success state.
10534         /// Reading from this pointer when `result_ok` is not set is undefined.
10535         pub result: *mut crate::c_types::derived::CVec_u8Z,
10536         /// A pointer to the contents in the error state.
10537         /// Reading from this pointer when `result_ok` is set is undefined.
10538         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10539 }
10540 #[repr(C)]
10541 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10542 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10544 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10545         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10546         /// `err` or `result` depending on the state of `result_ok`.
10547         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10548         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10549         pub result_ok: bool,
10550 }
10551 #[no_mangle]
10552 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10553 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10554         CResult_CVec_u8ZPeerHandleErrorZ {
10555                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10556                         result: Box::into_raw(Box::new(o)),
10557                 },
10558                 result_ok: true,
10559         }
10560 }
10561 #[no_mangle]
10562 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10563 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10564         CResult_CVec_u8ZPeerHandleErrorZ {
10565                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10566                         err: Box::into_raw(Box::new(e)),
10567                 },
10568                 result_ok: false,
10569         }
10570 }
10571 /// Checks if the given object is currently in the success state
10572 #[no_mangle]
10573 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10574         o.result_ok
10575 }
10576 #[no_mangle]
10577 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10578 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10579 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10580         fn drop(&mut self) {
10581                 if self.result_ok {
10582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10584                         }
10585                 } else {
10586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10588                         }
10589                 }
10590         }
10591 }
10592 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10593         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10594                 let contents = if o.result_ok {
10595                         let result = unsafe { o.contents.result };
10596                         unsafe { o.contents.result = core::ptr::null_mut() };
10597                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10598                 } else {
10599                         let err = unsafe { o.contents.err };
10600                         unsafe { o.contents.err = core::ptr::null_mut(); }
10601                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10602                 };
10603                 Self {
10604                         contents,
10605                         result_ok: o.result_ok,
10606                 }
10607         }
10608 }
10609 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10610         fn clone(&self) -> Self {
10611                 if self.result_ok {
10612                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10613                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10614                         } }
10615                 } else {
10616                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10618                         } }
10619                 }
10620         }
10621 }
10622 #[no_mangle]
10623 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10624 /// but with all dynamically-allocated buffers duplicated in new buffers.
10625 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10626 #[repr(C)]
10627 /// The contents of CResult_NonePeerHandleErrorZ
10628 pub union CResult_NonePeerHandleErrorZPtr {
10629         /// Note that this value is always NULL, as there are no contents in the OK variant
10630         pub result: *mut core::ffi::c_void,
10631         /// A pointer to the contents in the error state.
10632         /// Reading from this pointer when `result_ok` is set is undefined.
10633         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10634 }
10635 #[repr(C)]
10636 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10637 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10638 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10639 pub struct CResult_NonePeerHandleErrorZ {
10640         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10641         /// `err` or `result` depending on the state of `result_ok`.
10642         pub contents: CResult_NonePeerHandleErrorZPtr,
10643         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10644         pub result_ok: bool,
10645 }
10646 #[no_mangle]
10647 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10648 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10649         CResult_NonePeerHandleErrorZ {
10650                 contents: CResult_NonePeerHandleErrorZPtr {
10651                         result: core::ptr::null_mut(),
10652                 },
10653                 result_ok: true,
10654         }
10655 }
10656 #[no_mangle]
10657 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10658 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10659         CResult_NonePeerHandleErrorZ {
10660                 contents: CResult_NonePeerHandleErrorZPtr {
10661                         err: Box::into_raw(Box::new(e)),
10662                 },
10663                 result_ok: false,
10664         }
10665 }
10666 /// Checks if the given object is currently in the success state
10667 #[no_mangle]
10668 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10669         o.result_ok
10670 }
10671 #[no_mangle]
10672 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10673 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10674 impl Drop for CResult_NonePeerHandleErrorZ {
10675         fn drop(&mut self) {
10676                 if self.result_ok {
10677                 } else {
10678                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10679                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10680                         }
10681                 }
10682         }
10683 }
10684 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10685         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10686                 let contents = if o.result_ok {
10687                         let _ = unsafe { Box::from_raw(o.contents.result) };
10688                         o.contents.result = core::ptr::null_mut();
10689                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10690                 } else {
10691                         let err = unsafe { o.contents.err };
10692                         unsafe { o.contents.err = core::ptr::null_mut(); }
10693                         CResult_NonePeerHandleErrorZPtr { err }
10694                 };
10695                 Self {
10696                         contents,
10697                         result_ok: o.result_ok,
10698                 }
10699         }
10700 }
10701 impl Clone for CResult_NonePeerHandleErrorZ {
10702         fn clone(&self) -> Self {
10703                 if self.result_ok {
10704                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10705                                 result: core::ptr::null_mut()
10706                         } }
10707                 } else {
10708                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10709                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10710                         } }
10711                 }
10712         }
10713 }
10714 #[no_mangle]
10715 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10716 /// but with all dynamically-allocated buffers duplicated in new buffers.
10717 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10718 #[repr(C)]
10719 /// The contents of CResult_boolPeerHandleErrorZ
10720 pub union CResult_boolPeerHandleErrorZPtr {
10721         /// A pointer to the contents in the success state.
10722         /// Reading from this pointer when `result_ok` is not set is undefined.
10723         pub result: *mut bool,
10724         /// A pointer to the contents in the error state.
10725         /// Reading from this pointer when `result_ok` is set is undefined.
10726         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10727 }
10728 #[repr(C)]
10729 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10730 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10731 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10732 pub struct CResult_boolPeerHandleErrorZ {
10733         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10734         /// `err` or `result` depending on the state of `result_ok`.
10735         pub contents: CResult_boolPeerHandleErrorZPtr,
10736         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10737         pub result_ok: bool,
10738 }
10739 #[no_mangle]
10740 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10741 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10742         CResult_boolPeerHandleErrorZ {
10743                 contents: CResult_boolPeerHandleErrorZPtr {
10744                         result: Box::into_raw(Box::new(o)),
10745                 },
10746                 result_ok: true,
10747         }
10748 }
10749 #[no_mangle]
10750 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10751 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10752         CResult_boolPeerHandleErrorZ {
10753                 contents: CResult_boolPeerHandleErrorZPtr {
10754                         err: Box::into_raw(Box::new(e)),
10755                 },
10756                 result_ok: false,
10757         }
10758 }
10759 /// Checks if the given object is currently in the success state
10760 #[no_mangle]
10761 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10762         o.result_ok
10763 }
10764 #[no_mangle]
10765 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10766 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10767 impl Drop for CResult_boolPeerHandleErrorZ {
10768         fn drop(&mut self) {
10769                 if self.result_ok {
10770                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10771                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10772                         }
10773                 } else {
10774                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10775                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10776                         }
10777                 }
10778         }
10779 }
10780 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10781         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10782                 let contents = if o.result_ok {
10783                         let result = unsafe { o.contents.result };
10784                         unsafe { o.contents.result = core::ptr::null_mut() };
10785                         CResult_boolPeerHandleErrorZPtr { result }
10786                 } else {
10787                         let err = unsafe { o.contents.err };
10788                         unsafe { o.contents.err = core::ptr::null_mut(); }
10789                         CResult_boolPeerHandleErrorZPtr { err }
10790                 };
10791                 Self {
10792                         contents,
10793                         result_ok: o.result_ok,
10794                 }
10795         }
10796 }
10797 impl Clone for CResult_boolPeerHandleErrorZ {
10798         fn clone(&self) -> Self {
10799                 if self.result_ok {
10800                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10801                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10802                         } }
10803                 } else {
10804                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10805                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10806                         } }
10807                 }
10808         }
10809 }
10810 #[no_mangle]
10811 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10812 /// but with all dynamically-allocated buffers duplicated in new buffers.
10813 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10814 #[repr(C)]
10815 /// The contents of CResult_NodeIdDecodeErrorZ
10816 pub union CResult_NodeIdDecodeErrorZPtr {
10817         /// A pointer to the contents in the success state.
10818         /// Reading from this pointer when `result_ok` is not set is undefined.
10819         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10820         /// A pointer to the contents in the error state.
10821         /// Reading from this pointer when `result_ok` is set is undefined.
10822         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10823 }
10824 #[repr(C)]
10825 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10826 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10827 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10828 pub struct CResult_NodeIdDecodeErrorZ {
10829         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10830         /// `err` or `result` depending on the state of `result_ok`.
10831         pub contents: CResult_NodeIdDecodeErrorZPtr,
10832         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10833         pub result_ok: bool,
10834 }
10835 #[no_mangle]
10836 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10837 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10838         CResult_NodeIdDecodeErrorZ {
10839                 contents: CResult_NodeIdDecodeErrorZPtr {
10840                         result: Box::into_raw(Box::new(o)),
10841                 },
10842                 result_ok: true,
10843         }
10844 }
10845 #[no_mangle]
10846 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10847 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10848         CResult_NodeIdDecodeErrorZ {
10849                 contents: CResult_NodeIdDecodeErrorZPtr {
10850                         err: Box::into_raw(Box::new(e)),
10851                 },
10852                 result_ok: false,
10853         }
10854 }
10855 /// Checks if the given object is currently in the success state
10856 #[no_mangle]
10857 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10858         o.result_ok
10859 }
10860 #[no_mangle]
10861 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10862 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10863 impl Drop for CResult_NodeIdDecodeErrorZ {
10864         fn drop(&mut self) {
10865                 if self.result_ok {
10866                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10867                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10868                         }
10869                 } else {
10870                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10871                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10872                         }
10873                 }
10874         }
10875 }
10876 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10877         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10878                 let contents = if o.result_ok {
10879                         let result = unsafe { o.contents.result };
10880                         unsafe { o.contents.result = core::ptr::null_mut() };
10881                         CResult_NodeIdDecodeErrorZPtr { result }
10882                 } else {
10883                         let err = unsafe { o.contents.err };
10884                         unsafe { o.contents.err = core::ptr::null_mut(); }
10885                         CResult_NodeIdDecodeErrorZPtr { err }
10886                 };
10887                 Self {
10888                         contents,
10889                         result_ok: o.result_ok,
10890                 }
10891         }
10892 }
10893 impl Clone for CResult_NodeIdDecodeErrorZ {
10894         fn clone(&self) -> Self {
10895                 if self.result_ok {
10896                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10897                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10898                         } }
10899                 } else {
10900                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10901                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10902                         } }
10903                 }
10904         }
10905 }
10906 #[no_mangle]
10907 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10908 /// but with all dynamically-allocated buffers duplicated in new buffers.
10909 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10910 #[repr(C)]
10911 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10912 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10913         /// A pointer to the contents in the success state.
10914         /// Reading from this pointer when `result_ok` is not set is undefined.
10915         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10916         /// A pointer to the contents in the error state.
10917         /// Reading from this pointer when `result_ok` is set is undefined.
10918         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10919 }
10920 #[repr(C)]
10921 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10922 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10923 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10924 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10925         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10926         /// `err` or `result` depending on the state of `result_ok`.
10927         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10928         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10929         pub result_ok: bool,
10930 }
10931 #[no_mangle]
10932 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10933 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10934         CResult_COption_NetworkUpdateZDecodeErrorZ {
10935                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10936                         result: Box::into_raw(Box::new(o)),
10937                 },
10938                 result_ok: true,
10939         }
10940 }
10941 #[no_mangle]
10942 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10943 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10944         CResult_COption_NetworkUpdateZDecodeErrorZ {
10945                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10946                         err: Box::into_raw(Box::new(e)),
10947                 },
10948                 result_ok: false,
10949         }
10950 }
10951 /// Checks if the given object is currently in the success state
10952 #[no_mangle]
10953 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10954         o.result_ok
10955 }
10956 #[no_mangle]
10957 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10958 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10959 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10960         fn drop(&mut self) {
10961                 if self.result_ok {
10962                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10963                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10964                         }
10965                 } else {
10966                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10967                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10968                         }
10969                 }
10970         }
10971 }
10972 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10973         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10974                 let contents = if o.result_ok {
10975                         let result = unsafe { o.contents.result };
10976                         unsafe { o.contents.result = core::ptr::null_mut() };
10977                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10978                 } else {
10979                         let err = unsafe { o.contents.err };
10980                         unsafe { o.contents.err = core::ptr::null_mut(); }
10981                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10982                 };
10983                 Self {
10984                         contents,
10985                         result_ok: o.result_ok,
10986                 }
10987         }
10988 }
10989 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10990         fn clone(&self) -> Self {
10991                 if self.result_ok {
10992                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10993                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10994                         } }
10995                 } else {
10996                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10997                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10998                         } }
10999                 }
11000         }
11001 }
11002 #[no_mangle]
11003 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11004 /// but with all dynamically-allocated buffers duplicated in new buffers.
11005 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11006 #[repr(C)]
11007 /// An enum which can either contain a crate::lightning::chain::Access or not
11008 pub enum COption_AccessZ {
11009         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11010         Some(crate::lightning::chain::Access),
11011         /// When we're in this state, this COption_AccessZ contains nothing
11012         None
11013 }
11014 impl COption_AccessZ {
11015         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11016                 if let Self::None = self { false } else { true }
11017         }
11018         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11019                 !self.is_some()
11020         }
11021         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11022                 if let Self::Some(v) = self { v } else { unreachable!() }
11023         }
11024 }
11025 #[no_mangle]
11026 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11027 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11028         COption_AccessZ::Some(o)
11029 }
11030 #[no_mangle]
11031 /// Constructs a new COption_AccessZ containing nothing
11032 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11033         COption_AccessZ::None
11034 }
11035 #[no_mangle]
11036 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11037 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11038 #[repr(C)]
11039 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11040 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11041         /// A pointer to the contents in the success state.
11042         /// Reading from this pointer when `result_ok` is not set is undefined.
11043         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11044         /// A pointer to the contents in the error state.
11045         /// Reading from this pointer when `result_ok` is set is undefined.
11046         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11047 }
11048 #[repr(C)]
11049 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11050 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11052 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11053         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11054         /// `err` or `result` depending on the state of `result_ok`.
11055         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11056         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11057         pub result_ok: bool,
11058 }
11059 #[no_mangle]
11060 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11061 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11062         CResult_ChannelUpdateInfoDecodeErrorZ {
11063                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11064                         result: Box::into_raw(Box::new(o)),
11065                 },
11066                 result_ok: true,
11067         }
11068 }
11069 #[no_mangle]
11070 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11071 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11072         CResult_ChannelUpdateInfoDecodeErrorZ {
11073                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11074                         err: Box::into_raw(Box::new(e)),
11075                 },
11076                 result_ok: false,
11077         }
11078 }
11079 /// Checks if the given object is currently in the success state
11080 #[no_mangle]
11081 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11082         o.result_ok
11083 }
11084 #[no_mangle]
11085 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11086 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11087 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11088         fn drop(&mut self) {
11089                 if self.result_ok {
11090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11092                         }
11093                 } else {
11094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11096                         }
11097                 }
11098         }
11099 }
11100 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11102                 let contents = if o.result_ok {
11103                         let result = unsafe { o.contents.result };
11104                         unsafe { o.contents.result = core::ptr::null_mut() };
11105                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11106                 } else {
11107                         let err = unsafe { o.contents.err };
11108                         unsafe { o.contents.err = core::ptr::null_mut(); }
11109                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11110                 };
11111                 Self {
11112                         contents,
11113                         result_ok: o.result_ok,
11114                 }
11115         }
11116 }
11117 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11118         fn clone(&self) -> Self {
11119                 if self.result_ok {
11120                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11121                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11122                         } }
11123                 } else {
11124                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11126                         } }
11127                 }
11128         }
11129 }
11130 #[no_mangle]
11131 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11132 /// but with all dynamically-allocated buffers duplicated in new buffers.
11133 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11134 #[repr(C)]
11135 /// The contents of CResult_ChannelInfoDecodeErrorZ
11136 pub union CResult_ChannelInfoDecodeErrorZPtr {
11137         /// A pointer to the contents in the success state.
11138         /// Reading from this pointer when `result_ok` is not set is undefined.
11139         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11140         /// A pointer to the contents in the error state.
11141         /// Reading from this pointer when `result_ok` is set is undefined.
11142         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11143 }
11144 #[repr(C)]
11145 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11146 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11148 pub struct CResult_ChannelInfoDecodeErrorZ {
11149         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11150         /// `err` or `result` depending on the state of `result_ok`.
11151         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11152         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11153         pub result_ok: bool,
11154 }
11155 #[no_mangle]
11156 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11157 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11158         CResult_ChannelInfoDecodeErrorZ {
11159                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11160                         result: Box::into_raw(Box::new(o)),
11161                 },
11162                 result_ok: true,
11163         }
11164 }
11165 #[no_mangle]
11166 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11167 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11168         CResult_ChannelInfoDecodeErrorZ {
11169                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11170                         err: Box::into_raw(Box::new(e)),
11171                 },
11172                 result_ok: false,
11173         }
11174 }
11175 /// Checks if the given object is currently in the success state
11176 #[no_mangle]
11177 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11178         o.result_ok
11179 }
11180 #[no_mangle]
11181 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11182 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11183 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11184         fn drop(&mut self) {
11185                 if self.result_ok {
11186                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11187                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11188                         }
11189                 } else {
11190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11192                         }
11193                 }
11194         }
11195 }
11196 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11197         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11198                 let contents = if o.result_ok {
11199                         let result = unsafe { o.contents.result };
11200                         unsafe { o.contents.result = core::ptr::null_mut() };
11201                         CResult_ChannelInfoDecodeErrorZPtr { result }
11202                 } else {
11203                         let err = unsafe { o.contents.err };
11204                         unsafe { o.contents.err = core::ptr::null_mut(); }
11205                         CResult_ChannelInfoDecodeErrorZPtr { err }
11206                 };
11207                 Self {
11208                         contents,
11209                         result_ok: o.result_ok,
11210                 }
11211         }
11212 }
11213 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11214         fn clone(&self) -> Self {
11215                 if self.result_ok {
11216                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11217                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11218                         } }
11219                 } else {
11220                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11221                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11222                         } }
11223                 }
11224         }
11225 }
11226 #[no_mangle]
11227 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11228 /// but with all dynamically-allocated buffers duplicated in new buffers.
11229 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11230 #[repr(C)]
11231 /// The contents of CResult_RoutingFeesDecodeErrorZ
11232 pub union CResult_RoutingFeesDecodeErrorZPtr {
11233         /// A pointer to the contents in the success state.
11234         /// Reading from this pointer when `result_ok` is not set is undefined.
11235         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11236         /// A pointer to the contents in the error state.
11237         /// Reading from this pointer when `result_ok` is set is undefined.
11238         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11239 }
11240 #[repr(C)]
11241 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11242 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11244 pub struct CResult_RoutingFeesDecodeErrorZ {
11245         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11246         /// `err` or `result` depending on the state of `result_ok`.
11247         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11248         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11249         pub result_ok: bool,
11250 }
11251 #[no_mangle]
11252 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11253 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11254         CResult_RoutingFeesDecodeErrorZ {
11255                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11256                         result: Box::into_raw(Box::new(o)),
11257                 },
11258                 result_ok: true,
11259         }
11260 }
11261 #[no_mangle]
11262 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11263 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11264         CResult_RoutingFeesDecodeErrorZ {
11265                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11266                         err: Box::into_raw(Box::new(e)),
11267                 },
11268                 result_ok: false,
11269         }
11270 }
11271 /// Checks if the given object is currently in the success state
11272 #[no_mangle]
11273 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11274         o.result_ok
11275 }
11276 #[no_mangle]
11277 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11278 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11279 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11280         fn drop(&mut self) {
11281                 if self.result_ok {
11282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11284                         }
11285                 } else {
11286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11288                         }
11289                 }
11290         }
11291 }
11292 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11294                 let contents = if o.result_ok {
11295                         let result = unsafe { o.contents.result };
11296                         unsafe { o.contents.result = core::ptr::null_mut() };
11297                         CResult_RoutingFeesDecodeErrorZPtr { result }
11298                 } else {
11299                         let err = unsafe { o.contents.err };
11300                         unsafe { o.contents.err = core::ptr::null_mut(); }
11301                         CResult_RoutingFeesDecodeErrorZPtr { err }
11302                 };
11303                 Self {
11304                         contents,
11305                         result_ok: o.result_ok,
11306                 }
11307         }
11308 }
11309 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11310         fn clone(&self) -> Self {
11311                 if self.result_ok {
11312                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11313                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11314                         } }
11315                 } else {
11316                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11317                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11318                         } }
11319                 }
11320         }
11321 }
11322 #[no_mangle]
11323 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11324 /// but with all dynamically-allocated buffers duplicated in new buffers.
11325 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11326 #[repr(C)]
11327 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11328 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11329         /// A pointer to the contents in the success state.
11330         /// Reading from this pointer when `result_ok` is not set is undefined.
11331         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11332         /// A pointer to the contents in the error state.
11333         /// Reading from this pointer when `result_ok` is set is undefined.
11334         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11335 }
11336 #[repr(C)]
11337 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11338 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11340 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11341         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11342         /// `err` or `result` depending on the state of `result_ok`.
11343         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11344         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11345         pub result_ok: bool,
11346 }
11347 #[no_mangle]
11348 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11349 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11350         CResult_NodeAnnouncementInfoDecodeErrorZ {
11351                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11352                         result: Box::into_raw(Box::new(o)),
11353                 },
11354                 result_ok: true,
11355         }
11356 }
11357 #[no_mangle]
11358 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11359 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11360         CResult_NodeAnnouncementInfoDecodeErrorZ {
11361                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11362                         err: Box::into_raw(Box::new(e)),
11363                 },
11364                 result_ok: false,
11365         }
11366 }
11367 /// Checks if the given object is currently in the success state
11368 #[no_mangle]
11369 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11370         o.result_ok
11371 }
11372 #[no_mangle]
11373 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11374 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11375 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11376         fn drop(&mut self) {
11377                 if self.result_ok {
11378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11380                         }
11381                 } else {
11382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11384                         }
11385                 }
11386         }
11387 }
11388 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11390                 let contents = if o.result_ok {
11391                         let result = unsafe { o.contents.result };
11392                         unsafe { o.contents.result = core::ptr::null_mut() };
11393                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11394                 } else {
11395                         let err = unsafe { o.contents.err };
11396                         unsafe { o.contents.err = core::ptr::null_mut(); }
11397                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11398                 };
11399                 Self {
11400                         contents,
11401                         result_ok: o.result_ok,
11402                 }
11403         }
11404 }
11405 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11406         fn clone(&self) -> Self {
11407                 if self.result_ok {
11408                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11409                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11410                         } }
11411                 } else {
11412                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11414                         } }
11415                 }
11416         }
11417 }
11418 #[no_mangle]
11419 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11420 /// but with all dynamically-allocated buffers duplicated in new buffers.
11421 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11422 #[repr(C)]
11423 /// A dynamically-allocated array of u64s of arbitrary size.
11424 /// This corresponds to std::vector in C++
11425 pub struct CVec_u64Z {
11426         /// The elements in the array.
11427         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11428         pub data: *mut u64,
11429         /// The number of elements pointed to by `data`.
11430         pub datalen: usize
11431 }
11432 impl CVec_u64Z {
11433         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11434                 if self.datalen == 0 { return Vec::new(); }
11435                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11436                 self.data = core::ptr::null_mut();
11437                 self.datalen = 0;
11438                 ret
11439         }
11440         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11441                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11442         }
11443 }
11444 impl From<Vec<u64>> for CVec_u64Z {
11445         fn from(v: Vec<u64>) -> Self {
11446                 let datalen = v.len();
11447                 let data = Box::into_raw(v.into_boxed_slice());
11448                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11449         }
11450 }
11451 #[no_mangle]
11452 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11453 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11454 impl Drop for CVec_u64Z {
11455         fn drop(&mut self) {
11456                 if self.datalen == 0 { return; }
11457                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11458         }
11459 }
11460 impl Clone for CVec_u64Z {
11461         fn clone(&self) -> Self {
11462                 let mut res = Vec::new();
11463                 if self.datalen == 0 { return Self::from(res); }
11464                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11465                 Self::from(res)
11466         }
11467 }
11468 #[repr(C)]
11469 /// The contents of CResult_NodeInfoDecodeErrorZ
11470 pub union CResult_NodeInfoDecodeErrorZPtr {
11471         /// A pointer to the contents in the success state.
11472         /// Reading from this pointer when `result_ok` is not set is undefined.
11473         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11474         /// A pointer to the contents in the error state.
11475         /// Reading from this pointer when `result_ok` is set is undefined.
11476         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11477 }
11478 #[repr(C)]
11479 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11480 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11482 pub struct CResult_NodeInfoDecodeErrorZ {
11483         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11484         /// `err` or `result` depending on the state of `result_ok`.
11485         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11486         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11487         pub result_ok: bool,
11488 }
11489 #[no_mangle]
11490 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11491 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11492         CResult_NodeInfoDecodeErrorZ {
11493                 contents: CResult_NodeInfoDecodeErrorZPtr {
11494                         result: Box::into_raw(Box::new(o)),
11495                 },
11496                 result_ok: true,
11497         }
11498 }
11499 #[no_mangle]
11500 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11501 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11502         CResult_NodeInfoDecodeErrorZ {
11503                 contents: CResult_NodeInfoDecodeErrorZPtr {
11504                         err: Box::into_raw(Box::new(e)),
11505                 },
11506                 result_ok: false,
11507         }
11508 }
11509 /// Checks if the given object is currently in the success state
11510 #[no_mangle]
11511 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11512         o.result_ok
11513 }
11514 #[no_mangle]
11515 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11516 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11517 impl Drop for CResult_NodeInfoDecodeErrorZ {
11518         fn drop(&mut self) {
11519                 if self.result_ok {
11520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11522                         }
11523                 } else {
11524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11526                         }
11527                 }
11528         }
11529 }
11530 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11532                 let contents = if o.result_ok {
11533                         let result = unsafe { o.contents.result };
11534                         unsafe { o.contents.result = core::ptr::null_mut() };
11535                         CResult_NodeInfoDecodeErrorZPtr { result }
11536                 } else {
11537                         let err = unsafe { o.contents.err };
11538                         unsafe { o.contents.err = core::ptr::null_mut(); }
11539                         CResult_NodeInfoDecodeErrorZPtr { err }
11540                 };
11541                 Self {
11542                         contents,
11543                         result_ok: o.result_ok,
11544                 }
11545         }
11546 }
11547 impl Clone for CResult_NodeInfoDecodeErrorZ {
11548         fn clone(&self) -> Self {
11549                 if self.result_ok {
11550                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11551                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11552                         } }
11553                 } else {
11554                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11556                         } }
11557                 }
11558         }
11559 }
11560 #[no_mangle]
11561 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11562 /// but with all dynamically-allocated buffers duplicated in new buffers.
11563 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11564 #[repr(C)]
11565 /// The contents of CResult_NetworkGraphDecodeErrorZ
11566 pub union CResult_NetworkGraphDecodeErrorZPtr {
11567         /// A pointer to the contents in the success state.
11568         /// Reading from this pointer when `result_ok` is not set is undefined.
11569         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11570         /// A pointer to the contents in the error state.
11571         /// Reading from this pointer when `result_ok` is set is undefined.
11572         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11573 }
11574 #[repr(C)]
11575 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11576 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11578 pub struct CResult_NetworkGraphDecodeErrorZ {
11579         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11580         /// `err` or `result` depending on the state of `result_ok`.
11581         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11582         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11583         pub result_ok: bool,
11584 }
11585 #[no_mangle]
11586 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11587 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11588         CResult_NetworkGraphDecodeErrorZ {
11589                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11590                         result: Box::into_raw(Box::new(o)),
11591                 },
11592                 result_ok: true,
11593         }
11594 }
11595 #[no_mangle]
11596 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11597 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11598         CResult_NetworkGraphDecodeErrorZ {
11599                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11600                         err: Box::into_raw(Box::new(e)),
11601                 },
11602                 result_ok: false,
11603         }
11604 }
11605 /// Checks if the given object is currently in the success state
11606 #[no_mangle]
11607 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11608         o.result_ok
11609 }
11610 #[no_mangle]
11611 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11612 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11613 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11614         fn drop(&mut self) {
11615                 if self.result_ok {
11616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11618                         }
11619                 } else {
11620                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11621                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11622                         }
11623                 }
11624         }
11625 }
11626 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11627         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11628                 let contents = if o.result_ok {
11629                         let result = unsafe { o.contents.result };
11630                         unsafe { o.contents.result = core::ptr::null_mut() };
11631                         CResult_NetworkGraphDecodeErrorZPtr { result }
11632                 } else {
11633                         let err = unsafe { o.contents.err };
11634                         unsafe { o.contents.err = core::ptr::null_mut(); }
11635                         CResult_NetworkGraphDecodeErrorZPtr { err }
11636                 };
11637                 Self {
11638                         contents,
11639                         result_ok: o.result_ok,
11640                 }
11641         }
11642 }
11643 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11644         fn clone(&self) -> Self {
11645                 if self.result_ok {
11646                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11647                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11648                         } }
11649                 } else {
11650                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11651                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11652                         } }
11653                 }
11654         }
11655 }
11656 #[no_mangle]
11657 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11658 /// but with all dynamically-allocated buffers duplicated in new buffers.
11659 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11660 #[repr(C)]
11661 #[derive(Clone)]
11662 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11663 pub enum COption_CVec_NetAddressZZ {
11664         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11665         Some(crate::c_types::derived::CVec_NetAddressZ),
11666         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11667         None
11668 }
11669 impl COption_CVec_NetAddressZZ {
11670         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11671                 if let Self::None = self { false } else { true }
11672         }
11673         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11674                 !self.is_some()
11675         }
11676         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11677                 if let Self::Some(v) = self { v } else { unreachable!() }
11678         }
11679 }
11680 #[no_mangle]
11681 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11682 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11683         COption_CVec_NetAddressZZ::Some(o)
11684 }
11685 #[no_mangle]
11686 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11687 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11688         COption_CVec_NetAddressZZ::None
11689 }
11690 #[no_mangle]
11691 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11692 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11693 #[no_mangle]
11694 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11695 /// but with all dynamically-allocated buffers duplicated in new buffers.
11696 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11697 #[repr(C)]
11698 /// The contents of CResult_NetAddressDecodeErrorZ
11699 pub union CResult_NetAddressDecodeErrorZPtr {
11700         /// A pointer to the contents in the success state.
11701         /// Reading from this pointer when `result_ok` is not set is undefined.
11702         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11703         /// A pointer to the contents in the error state.
11704         /// Reading from this pointer when `result_ok` is set is undefined.
11705         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11706 }
11707 #[repr(C)]
11708 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11709 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11711 pub struct CResult_NetAddressDecodeErrorZ {
11712         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11713         /// `err` or `result` depending on the state of `result_ok`.
11714         pub contents: CResult_NetAddressDecodeErrorZPtr,
11715         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11716         pub result_ok: bool,
11717 }
11718 #[no_mangle]
11719 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11720 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11721         CResult_NetAddressDecodeErrorZ {
11722                 contents: CResult_NetAddressDecodeErrorZPtr {
11723                         result: Box::into_raw(Box::new(o)),
11724                 },
11725                 result_ok: true,
11726         }
11727 }
11728 #[no_mangle]
11729 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11730 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11731         CResult_NetAddressDecodeErrorZ {
11732                 contents: CResult_NetAddressDecodeErrorZPtr {
11733                         err: Box::into_raw(Box::new(e)),
11734                 },
11735                 result_ok: false,
11736         }
11737 }
11738 /// Checks if the given object is currently in the success state
11739 #[no_mangle]
11740 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11741         o.result_ok
11742 }
11743 #[no_mangle]
11744 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11745 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11746 impl Drop for CResult_NetAddressDecodeErrorZ {
11747         fn drop(&mut self) {
11748                 if self.result_ok {
11749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11751                         }
11752                 } else {
11753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11755                         }
11756                 }
11757         }
11758 }
11759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11760         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11761                 let contents = if o.result_ok {
11762                         let result = unsafe { o.contents.result };
11763                         unsafe { o.contents.result = core::ptr::null_mut() };
11764                         CResult_NetAddressDecodeErrorZPtr { result }
11765                 } else {
11766                         let err = unsafe { o.contents.err };
11767                         unsafe { o.contents.err = core::ptr::null_mut(); }
11768                         CResult_NetAddressDecodeErrorZPtr { err }
11769                 };
11770                 Self {
11771                         contents,
11772                         result_ok: o.result_ok,
11773                 }
11774         }
11775 }
11776 impl Clone for CResult_NetAddressDecodeErrorZ {
11777         fn clone(&self) -> Self {
11778                 if self.result_ok {
11779                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11780                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11781                         } }
11782                 } else {
11783                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11785                         } }
11786                 }
11787         }
11788 }
11789 #[no_mangle]
11790 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11791 /// but with all dynamically-allocated buffers duplicated in new buffers.
11792 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11793 #[repr(C)]
11794 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11795 /// This corresponds to std::vector in C++
11796 pub struct CVec_UpdateAddHTLCZ {
11797         /// The elements in the array.
11798         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11799         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11800         /// The number of elements pointed to by `data`.
11801         pub datalen: usize
11802 }
11803 impl CVec_UpdateAddHTLCZ {
11804         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11805                 if self.datalen == 0 { return Vec::new(); }
11806                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11807                 self.data = core::ptr::null_mut();
11808                 self.datalen = 0;
11809                 ret
11810         }
11811         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11812                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11813         }
11814 }
11815 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11816         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11817                 let datalen = v.len();
11818                 let data = Box::into_raw(v.into_boxed_slice());
11819                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11820         }
11821 }
11822 #[no_mangle]
11823 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11824 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11825 impl Drop for CVec_UpdateAddHTLCZ {
11826         fn drop(&mut self) {
11827                 if self.datalen == 0 { return; }
11828                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11829         }
11830 }
11831 impl Clone for CVec_UpdateAddHTLCZ {
11832         fn clone(&self) -> Self {
11833                 let mut res = Vec::new();
11834                 if self.datalen == 0 { return Self::from(res); }
11835                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11836                 Self::from(res)
11837         }
11838 }
11839 #[repr(C)]
11840 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11841 /// This corresponds to std::vector in C++
11842 pub struct CVec_UpdateFulfillHTLCZ {
11843         /// The elements in the array.
11844         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11845         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11846         /// The number of elements pointed to by `data`.
11847         pub datalen: usize
11848 }
11849 impl CVec_UpdateFulfillHTLCZ {
11850         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11851                 if self.datalen == 0 { return Vec::new(); }
11852                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11853                 self.data = core::ptr::null_mut();
11854                 self.datalen = 0;
11855                 ret
11856         }
11857         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11858                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11859         }
11860 }
11861 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11862         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11863                 let datalen = v.len();
11864                 let data = Box::into_raw(v.into_boxed_slice());
11865                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11866         }
11867 }
11868 #[no_mangle]
11869 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11870 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11871 impl Drop for CVec_UpdateFulfillHTLCZ {
11872         fn drop(&mut self) {
11873                 if self.datalen == 0 { return; }
11874                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11875         }
11876 }
11877 impl Clone for CVec_UpdateFulfillHTLCZ {
11878         fn clone(&self) -> Self {
11879                 let mut res = Vec::new();
11880                 if self.datalen == 0 { return Self::from(res); }
11881                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11882                 Self::from(res)
11883         }
11884 }
11885 #[repr(C)]
11886 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11887 /// This corresponds to std::vector in C++
11888 pub struct CVec_UpdateFailHTLCZ {
11889         /// The elements in the array.
11890         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11891         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11892         /// The number of elements pointed to by `data`.
11893         pub datalen: usize
11894 }
11895 impl CVec_UpdateFailHTLCZ {
11896         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11897                 if self.datalen == 0 { return Vec::new(); }
11898                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11899                 self.data = core::ptr::null_mut();
11900                 self.datalen = 0;
11901                 ret
11902         }
11903         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11904                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11905         }
11906 }
11907 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11908         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11909                 let datalen = v.len();
11910                 let data = Box::into_raw(v.into_boxed_slice());
11911                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11912         }
11913 }
11914 #[no_mangle]
11915 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11916 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11917 impl Drop for CVec_UpdateFailHTLCZ {
11918         fn drop(&mut self) {
11919                 if self.datalen == 0 { return; }
11920                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11921         }
11922 }
11923 impl Clone for CVec_UpdateFailHTLCZ {
11924         fn clone(&self) -> Self {
11925                 let mut res = Vec::new();
11926                 if self.datalen == 0 { return Self::from(res); }
11927                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11928                 Self::from(res)
11929         }
11930 }
11931 #[repr(C)]
11932 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11933 /// This corresponds to std::vector in C++
11934 pub struct CVec_UpdateFailMalformedHTLCZ {
11935         /// The elements in the array.
11936         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11937         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11938         /// The number of elements pointed to by `data`.
11939         pub datalen: usize
11940 }
11941 impl CVec_UpdateFailMalformedHTLCZ {
11942         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11943                 if self.datalen == 0 { return Vec::new(); }
11944                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11945                 self.data = core::ptr::null_mut();
11946                 self.datalen = 0;
11947                 ret
11948         }
11949         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11950                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11951         }
11952 }
11953 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11954         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11955                 let datalen = v.len();
11956                 let data = Box::into_raw(v.into_boxed_slice());
11957                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11958         }
11959 }
11960 #[no_mangle]
11961 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11962 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11963 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11964         fn drop(&mut self) {
11965                 if self.datalen == 0 { return; }
11966                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11967         }
11968 }
11969 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11970         fn clone(&self) -> Self {
11971                 let mut res = Vec::new();
11972                 if self.datalen == 0 { return Self::from(res); }
11973                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11974                 Self::from(res)
11975         }
11976 }
11977 #[repr(C)]
11978 /// The contents of CResult_AcceptChannelDecodeErrorZ
11979 pub union CResult_AcceptChannelDecodeErrorZPtr {
11980         /// A pointer to the contents in the success state.
11981         /// Reading from this pointer when `result_ok` is not set is undefined.
11982         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11983         /// A pointer to the contents in the error state.
11984         /// Reading from this pointer when `result_ok` is set is undefined.
11985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11986 }
11987 #[repr(C)]
11988 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11989 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11991 pub struct CResult_AcceptChannelDecodeErrorZ {
11992         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11993         /// `err` or `result` depending on the state of `result_ok`.
11994         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11995         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11996         pub result_ok: bool,
11997 }
11998 #[no_mangle]
11999 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12000 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12001         CResult_AcceptChannelDecodeErrorZ {
12002                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12003                         result: Box::into_raw(Box::new(o)),
12004                 },
12005                 result_ok: true,
12006         }
12007 }
12008 #[no_mangle]
12009 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12010 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12011         CResult_AcceptChannelDecodeErrorZ {
12012                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12013                         err: Box::into_raw(Box::new(e)),
12014                 },
12015                 result_ok: false,
12016         }
12017 }
12018 /// Checks if the given object is currently in the success state
12019 #[no_mangle]
12020 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12021         o.result_ok
12022 }
12023 #[no_mangle]
12024 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12025 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12026 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12027         fn drop(&mut self) {
12028                 if self.result_ok {
12029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12031                         }
12032                 } else {
12033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12035                         }
12036                 }
12037         }
12038 }
12039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12041                 let contents = if o.result_ok {
12042                         let result = unsafe { o.contents.result };
12043                         unsafe { o.contents.result = core::ptr::null_mut() };
12044                         CResult_AcceptChannelDecodeErrorZPtr { result }
12045                 } else {
12046                         let err = unsafe { o.contents.err };
12047                         unsafe { o.contents.err = core::ptr::null_mut(); }
12048                         CResult_AcceptChannelDecodeErrorZPtr { err }
12049                 };
12050                 Self {
12051                         contents,
12052                         result_ok: o.result_ok,
12053                 }
12054         }
12055 }
12056 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12057         fn clone(&self) -> Self {
12058                 if self.result_ok {
12059                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12060                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12061                         } }
12062                 } else {
12063                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12064                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12065                         } }
12066                 }
12067         }
12068 }
12069 #[no_mangle]
12070 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12071 /// but with all dynamically-allocated buffers duplicated in new buffers.
12072 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12073 #[repr(C)]
12074 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12075 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12076         /// A pointer to the contents in the success state.
12077         /// Reading from this pointer when `result_ok` is not set is undefined.
12078         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12079         /// A pointer to the contents in the error state.
12080         /// Reading from this pointer when `result_ok` is set is undefined.
12081         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12082 }
12083 #[repr(C)]
12084 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12085 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12086 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12087 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12088         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12089         /// `err` or `result` depending on the state of `result_ok`.
12090         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12091         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12092         pub result_ok: bool,
12093 }
12094 #[no_mangle]
12095 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12096 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12097         CResult_AnnouncementSignaturesDecodeErrorZ {
12098                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12099                         result: Box::into_raw(Box::new(o)),
12100                 },
12101                 result_ok: true,
12102         }
12103 }
12104 #[no_mangle]
12105 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12106 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12107         CResult_AnnouncementSignaturesDecodeErrorZ {
12108                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12109                         err: Box::into_raw(Box::new(e)),
12110                 },
12111                 result_ok: false,
12112         }
12113 }
12114 /// Checks if the given object is currently in the success state
12115 #[no_mangle]
12116 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12117         o.result_ok
12118 }
12119 #[no_mangle]
12120 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12121 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12122 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12123         fn drop(&mut self) {
12124                 if self.result_ok {
12125                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12126                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12127                         }
12128                 } else {
12129                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12130                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12131                         }
12132                 }
12133         }
12134 }
12135 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12136         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12137                 let contents = if o.result_ok {
12138                         let result = unsafe { o.contents.result };
12139                         unsafe { o.contents.result = core::ptr::null_mut() };
12140                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12141                 } else {
12142                         let err = unsafe { o.contents.err };
12143                         unsafe { o.contents.err = core::ptr::null_mut(); }
12144                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12145                 };
12146                 Self {
12147                         contents,
12148                         result_ok: o.result_ok,
12149                 }
12150         }
12151 }
12152 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12153         fn clone(&self) -> Self {
12154                 if self.result_ok {
12155                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12156                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12157                         } }
12158                 } else {
12159                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12160                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12161                         } }
12162                 }
12163         }
12164 }
12165 #[no_mangle]
12166 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12167 /// but with all dynamically-allocated buffers duplicated in new buffers.
12168 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12169 #[repr(C)]
12170 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12171 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12172         /// A pointer to the contents in the success state.
12173         /// Reading from this pointer when `result_ok` is not set is undefined.
12174         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12175         /// A pointer to the contents in the error state.
12176         /// Reading from this pointer when `result_ok` is set is undefined.
12177         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12178 }
12179 #[repr(C)]
12180 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12181 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12182 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12183 pub struct CResult_ChannelReestablishDecodeErrorZ {
12184         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12185         /// `err` or `result` depending on the state of `result_ok`.
12186         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12187         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12188         pub result_ok: bool,
12189 }
12190 #[no_mangle]
12191 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12192 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12193         CResult_ChannelReestablishDecodeErrorZ {
12194                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12195                         result: Box::into_raw(Box::new(o)),
12196                 },
12197                 result_ok: true,
12198         }
12199 }
12200 #[no_mangle]
12201 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12202 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12203         CResult_ChannelReestablishDecodeErrorZ {
12204                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12205                         err: Box::into_raw(Box::new(e)),
12206                 },
12207                 result_ok: false,
12208         }
12209 }
12210 /// Checks if the given object is currently in the success state
12211 #[no_mangle]
12212 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12213         o.result_ok
12214 }
12215 #[no_mangle]
12216 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12217 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12218 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12219         fn drop(&mut self) {
12220                 if self.result_ok {
12221                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12222                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12223                         }
12224                 } else {
12225                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12226                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12227                         }
12228                 }
12229         }
12230 }
12231 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12232         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12233                 let contents = if o.result_ok {
12234                         let result = unsafe { o.contents.result };
12235                         unsafe { o.contents.result = core::ptr::null_mut() };
12236                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12237                 } else {
12238                         let err = unsafe { o.contents.err };
12239                         unsafe { o.contents.err = core::ptr::null_mut(); }
12240                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12241                 };
12242                 Self {
12243                         contents,
12244                         result_ok: o.result_ok,
12245                 }
12246         }
12247 }
12248 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12249         fn clone(&self) -> Self {
12250                 if self.result_ok {
12251                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12252                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12253                         } }
12254                 } else {
12255                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12256                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12257                         } }
12258                 }
12259         }
12260 }
12261 #[no_mangle]
12262 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12263 /// but with all dynamically-allocated buffers duplicated in new buffers.
12264 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12265 #[repr(C)]
12266 /// The contents of CResult_ClosingSignedDecodeErrorZ
12267 pub union CResult_ClosingSignedDecodeErrorZPtr {
12268         /// A pointer to the contents in the success state.
12269         /// Reading from this pointer when `result_ok` is not set is undefined.
12270         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12271         /// A pointer to the contents in the error state.
12272         /// Reading from this pointer when `result_ok` is set is undefined.
12273         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12274 }
12275 #[repr(C)]
12276 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12277 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12279 pub struct CResult_ClosingSignedDecodeErrorZ {
12280         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12281         /// `err` or `result` depending on the state of `result_ok`.
12282         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12283         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12284         pub result_ok: bool,
12285 }
12286 #[no_mangle]
12287 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12288 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12289         CResult_ClosingSignedDecodeErrorZ {
12290                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12291                         result: Box::into_raw(Box::new(o)),
12292                 },
12293                 result_ok: true,
12294         }
12295 }
12296 #[no_mangle]
12297 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12298 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12299         CResult_ClosingSignedDecodeErrorZ {
12300                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12301                         err: Box::into_raw(Box::new(e)),
12302                 },
12303                 result_ok: false,
12304         }
12305 }
12306 /// Checks if the given object is currently in the success state
12307 #[no_mangle]
12308 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12309         o.result_ok
12310 }
12311 #[no_mangle]
12312 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12313 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12314 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12315         fn drop(&mut self) {
12316                 if self.result_ok {
12317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12319                         }
12320                 } else {
12321                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12322                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12323                         }
12324                 }
12325         }
12326 }
12327 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12328         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12329                 let contents = if o.result_ok {
12330                         let result = unsafe { o.contents.result };
12331                         unsafe { o.contents.result = core::ptr::null_mut() };
12332                         CResult_ClosingSignedDecodeErrorZPtr { result }
12333                 } else {
12334                         let err = unsafe { o.contents.err };
12335                         unsafe { o.contents.err = core::ptr::null_mut(); }
12336                         CResult_ClosingSignedDecodeErrorZPtr { err }
12337                 };
12338                 Self {
12339                         contents,
12340                         result_ok: o.result_ok,
12341                 }
12342         }
12343 }
12344 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12345         fn clone(&self) -> Self {
12346                 if self.result_ok {
12347                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12348                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12349                         } }
12350                 } else {
12351                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12352                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12353                         } }
12354                 }
12355         }
12356 }
12357 #[no_mangle]
12358 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12359 /// but with all dynamically-allocated buffers duplicated in new buffers.
12360 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12361 #[repr(C)]
12362 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12363 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12364         /// A pointer to the contents in the success state.
12365         /// Reading from this pointer when `result_ok` is not set is undefined.
12366         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12367         /// A pointer to the contents in the error state.
12368         /// Reading from this pointer when `result_ok` is set is undefined.
12369         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12370 }
12371 #[repr(C)]
12372 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12373 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12374 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12375 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12376         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12377         /// `err` or `result` depending on the state of `result_ok`.
12378         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12379         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12380         pub result_ok: bool,
12381 }
12382 #[no_mangle]
12383 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12384 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12385         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12386                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12387                         result: Box::into_raw(Box::new(o)),
12388                 },
12389                 result_ok: true,
12390         }
12391 }
12392 #[no_mangle]
12393 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12394 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12395         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12396                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12397                         err: Box::into_raw(Box::new(e)),
12398                 },
12399                 result_ok: false,
12400         }
12401 }
12402 /// Checks if the given object is currently in the success state
12403 #[no_mangle]
12404 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12405         o.result_ok
12406 }
12407 #[no_mangle]
12408 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12409 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12410 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12411         fn drop(&mut self) {
12412                 if self.result_ok {
12413                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12414                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12415                         }
12416                 } else {
12417                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12418                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12419                         }
12420                 }
12421         }
12422 }
12423 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12424         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12425                 let contents = if o.result_ok {
12426                         let result = unsafe { o.contents.result };
12427                         unsafe { o.contents.result = core::ptr::null_mut() };
12428                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12429                 } else {
12430                         let err = unsafe { o.contents.err };
12431                         unsafe { o.contents.err = core::ptr::null_mut(); }
12432                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12433                 };
12434                 Self {
12435                         contents,
12436                         result_ok: o.result_ok,
12437                 }
12438         }
12439 }
12440 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12441         fn clone(&self) -> Self {
12442                 if self.result_ok {
12443                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12444                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12445                         } }
12446                 } else {
12447                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12448                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12449                         } }
12450                 }
12451         }
12452 }
12453 #[no_mangle]
12454 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12455 /// but with all dynamically-allocated buffers duplicated in new buffers.
12456 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12457 #[repr(C)]
12458 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12459 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12460         /// A pointer to the contents in the success state.
12461         /// Reading from this pointer when `result_ok` is not set is undefined.
12462         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12463         /// A pointer to the contents in the error state.
12464         /// Reading from this pointer when `result_ok` is set is undefined.
12465         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12466 }
12467 #[repr(C)]
12468 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12469 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12470 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12471 pub struct CResult_CommitmentSignedDecodeErrorZ {
12472         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12473         /// `err` or `result` depending on the state of `result_ok`.
12474         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12475         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12476         pub result_ok: bool,
12477 }
12478 #[no_mangle]
12479 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12480 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12481         CResult_CommitmentSignedDecodeErrorZ {
12482                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12483                         result: Box::into_raw(Box::new(o)),
12484                 },
12485                 result_ok: true,
12486         }
12487 }
12488 #[no_mangle]
12489 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12490 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12491         CResult_CommitmentSignedDecodeErrorZ {
12492                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12493                         err: Box::into_raw(Box::new(e)),
12494                 },
12495                 result_ok: false,
12496         }
12497 }
12498 /// Checks if the given object is currently in the success state
12499 #[no_mangle]
12500 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12501         o.result_ok
12502 }
12503 #[no_mangle]
12504 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12505 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12506 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12507         fn drop(&mut self) {
12508                 if self.result_ok {
12509                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12510                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12511                         }
12512                 } else {
12513                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12514                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12515                         }
12516                 }
12517         }
12518 }
12519 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12520         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12521                 let contents = if o.result_ok {
12522                         let result = unsafe { o.contents.result };
12523                         unsafe { o.contents.result = core::ptr::null_mut() };
12524                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12525                 } else {
12526                         let err = unsafe { o.contents.err };
12527                         unsafe { o.contents.err = core::ptr::null_mut(); }
12528                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12529                 };
12530                 Self {
12531                         contents,
12532                         result_ok: o.result_ok,
12533                 }
12534         }
12535 }
12536 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12537         fn clone(&self) -> Self {
12538                 if self.result_ok {
12539                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12540                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12541                         } }
12542                 } else {
12543                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12544                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12545                         } }
12546                 }
12547         }
12548 }
12549 #[no_mangle]
12550 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12551 /// but with all dynamically-allocated buffers duplicated in new buffers.
12552 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12553 #[repr(C)]
12554 /// The contents of CResult_FundingCreatedDecodeErrorZ
12555 pub union CResult_FundingCreatedDecodeErrorZPtr {
12556         /// A pointer to the contents in the success state.
12557         /// Reading from this pointer when `result_ok` is not set is undefined.
12558         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12559         /// A pointer to the contents in the error state.
12560         /// Reading from this pointer when `result_ok` is set is undefined.
12561         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12562 }
12563 #[repr(C)]
12564 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12565 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12566 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12567 pub struct CResult_FundingCreatedDecodeErrorZ {
12568         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12569         /// `err` or `result` depending on the state of `result_ok`.
12570         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12571         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12572         pub result_ok: bool,
12573 }
12574 #[no_mangle]
12575 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12576 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12577         CResult_FundingCreatedDecodeErrorZ {
12578                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12579                         result: Box::into_raw(Box::new(o)),
12580                 },
12581                 result_ok: true,
12582         }
12583 }
12584 #[no_mangle]
12585 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12586 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12587         CResult_FundingCreatedDecodeErrorZ {
12588                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12589                         err: Box::into_raw(Box::new(e)),
12590                 },
12591                 result_ok: false,
12592         }
12593 }
12594 /// Checks if the given object is currently in the success state
12595 #[no_mangle]
12596 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12597         o.result_ok
12598 }
12599 #[no_mangle]
12600 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12601 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12602 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12603         fn drop(&mut self) {
12604                 if self.result_ok {
12605                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12606                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12607                         }
12608                 } else {
12609                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12610                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12611                         }
12612                 }
12613         }
12614 }
12615 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12616         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12617                 let contents = if o.result_ok {
12618                         let result = unsafe { o.contents.result };
12619                         unsafe { o.contents.result = core::ptr::null_mut() };
12620                         CResult_FundingCreatedDecodeErrorZPtr { result }
12621                 } else {
12622                         let err = unsafe { o.contents.err };
12623                         unsafe { o.contents.err = core::ptr::null_mut(); }
12624                         CResult_FundingCreatedDecodeErrorZPtr { err }
12625                 };
12626                 Self {
12627                         contents,
12628                         result_ok: o.result_ok,
12629                 }
12630         }
12631 }
12632 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12633         fn clone(&self) -> Self {
12634                 if self.result_ok {
12635                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12636                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12637                         } }
12638                 } else {
12639                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12640                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12641                         } }
12642                 }
12643         }
12644 }
12645 #[no_mangle]
12646 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12647 /// but with all dynamically-allocated buffers duplicated in new buffers.
12648 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12649 #[repr(C)]
12650 /// The contents of CResult_FundingSignedDecodeErrorZ
12651 pub union CResult_FundingSignedDecodeErrorZPtr {
12652         /// A pointer to the contents in the success state.
12653         /// Reading from this pointer when `result_ok` is not set is undefined.
12654         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12655         /// A pointer to the contents in the error state.
12656         /// Reading from this pointer when `result_ok` is set is undefined.
12657         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12658 }
12659 #[repr(C)]
12660 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12661 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12663 pub struct CResult_FundingSignedDecodeErrorZ {
12664         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12665         /// `err` or `result` depending on the state of `result_ok`.
12666         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12667         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12668         pub result_ok: bool,
12669 }
12670 #[no_mangle]
12671 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12672 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12673         CResult_FundingSignedDecodeErrorZ {
12674                 contents: CResult_FundingSignedDecodeErrorZPtr {
12675                         result: Box::into_raw(Box::new(o)),
12676                 },
12677                 result_ok: true,
12678         }
12679 }
12680 #[no_mangle]
12681 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12682 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12683         CResult_FundingSignedDecodeErrorZ {
12684                 contents: CResult_FundingSignedDecodeErrorZPtr {
12685                         err: Box::into_raw(Box::new(e)),
12686                 },
12687                 result_ok: false,
12688         }
12689 }
12690 /// Checks if the given object is currently in the success state
12691 #[no_mangle]
12692 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12693         o.result_ok
12694 }
12695 #[no_mangle]
12696 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12697 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12698 impl Drop for CResult_FundingSignedDecodeErrorZ {
12699         fn drop(&mut self) {
12700                 if self.result_ok {
12701                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12702                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12703                         }
12704                 } else {
12705                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12706                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12707                         }
12708                 }
12709         }
12710 }
12711 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12712         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12713                 let contents = if o.result_ok {
12714                         let result = unsafe { o.contents.result };
12715                         unsafe { o.contents.result = core::ptr::null_mut() };
12716                         CResult_FundingSignedDecodeErrorZPtr { result }
12717                 } else {
12718                         let err = unsafe { o.contents.err };
12719                         unsafe { o.contents.err = core::ptr::null_mut(); }
12720                         CResult_FundingSignedDecodeErrorZPtr { err }
12721                 };
12722                 Self {
12723                         contents,
12724                         result_ok: o.result_ok,
12725                 }
12726         }
12727 }
12728 impl Clone for CResult_FundingSignedDecodeErrorZ {
12729         fn clone(&self) -> Self {
12730                 if self.result_ok {
12731                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12732                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12733                         } }
12734                 } else {
12735                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12736                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12737                         } }
12738                 }
12739         }
12740 }
12741 #[no_mangle]
12742 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12743 /// but with all dynamically-allocated buffers duplicated in new buffers.
12744 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12745 #[repr(C)]
12746 /// The contents of CResult_FundingLockedDecodeErrorZ
12747 pub union CResult_FundingLockedDecodeErrorZPtr {
12748         /// A pointer to the contents in the success state.
12749         /// Reading from this pointer when `result_ok` is not set is undefined.
12750         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12751         /// A pointer to the contents in the error state.
12752         /// Reading from this pointer when `result_ok` is set is undefined.
12753         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12754 }
12755 #[repr(C)]
12756 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12757 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12758 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12759 pub struct CResult_FundingLockedDecodeErrorZ {
12760         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12761         /// `err` or `result` depending on the state of `result_ok`.
12762         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12763         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12764         pub result_ok: bool,
12765 }
12766 #[no_mangle]
12767 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12768 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12769         CResult_FundingLockedDecodeErrorZ {
12770                 contents: CResult_FundingLockedDecodeErrorZPtr {
12771                         result: Box::into_raw(Box::new(o)),
12772                 },
12773                 result_ok: true,
12774         }
12775 }
12776 #[no_mangle]
12777 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12778 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12779         CResult_FundingLockedDecodeErrorZ {
12780                 contents: CResult_FundingLockedDecodeErrorZPtr {
12781                         err: Box::into_raw(Box::new(e)),
12782                 },
12783                 result_ok: false,
12784         }
12785 }
12786 /// Checks if the given object is currently in the success state
12787 #[no_mangle]
12788 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12789         o.result_ok
12790 }
12791 #[no_mangle]
12792 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12793 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12794 impl Drop for CResult_FundingLockedDecodeErrorZ {
12795         fn drop(&mut self) {
12796                 if self.result_ok {
12797                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12798                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12799                         }
12800                 } else {
12801                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12802                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12803                         }
12804                 }
12805         }
12806 }
12807 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12808         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12809                 let contents = if o.result_ok {
12810                         let result = unsafe { o.contents.result };
12811                         unsafe { o.contents.result = core::ptr::null_mut() };
12812                         CResult_FundingLockedDecodeErrorZPtr { result }
12813                 } else {
12814                         let err = unsafe { o.contents.err };
12815                         unsafe { o.contents.err = core::ptr::null_mut(); }
12816                         CResult_FundingLockedDecodeErrorZPtr { err }
12817                 };
12818                 Self {
12819                         contents,
12820                         result_ok: o.result_ok,
12821                 }
12822         }
12823 }
12824 impl Clone for CResult_FundingLockedDecodeErrorZ {
12825         fn clone(&self) -> Self {
12826                 if self.result_ok {
12827                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12828                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12829                         } }
12830                 } else {
12831                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12832                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12833                         } }
12834                 }
12835         }
12836 }
12837 #[no_mangle]
12838 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12839 /// but with all dynamically-allocated buffers duplicated in new buffers.
12840 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12841 #[repr(C)]
12842 /// The contents of CResult_InitDecodeErrorZ
12843 pub union CResult_InitDecodeErrorZPtr {
12844         /// A pointer to the contents in the success state.
12845         /// Reading from this pointer when `result_ok` is not set is undefined.
12846         pub result: *mut crate::lightning::ln::msgs::Init,
12847         /// A pointer to the contents in the error state.
12848         /// Reading from this pointer when `result_ok` is set is undefined.
12849         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12850 }
12851 #[repr(C)]
12852 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12853 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12854 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12855 pub struct CResult_InitDecodeErrorZ {
12856         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12857         /// `err` or `result` depending on the state of `result_ok`.
12858         pub contents: CResult_InitDecodeErrorZPtr,
12859         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12860         pub result_ok: bool,
12861 }
12862 #[no_mangle]
12863 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12864 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12865         CResult_InitDecodeErrorZ {
12866                 contents: CResult_InitDecodeErrorZPtr {
12867                         result: Box::into_raw(Box::new(o)),
12868                 },
12869                 result_ok: true,
12870         }
12871 }
12872 #[no_mangle]
12873 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12874 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12875         CResult_InitDecodeErrorZ {
12876                 contents: CResult_InitDecodeErrorZPtr {
12877                         err: Box::into_raw(Box::new(e)),
12878                 },
12879                 result_ok: false,
12880         }
12881 }
12882 /// Checks if the given object is currently in the success state
12883 #[no_mangle]
12884 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12885         o.result_ok
12886 }
12887 #[no_mangle]
12888 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12889 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12890 impl Drop for CResult_InitDecodeErrorZ {
12891         fn drop(&mut self) {
12892                 if self.result_ok {
12893                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12894                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12895                         }
12896                 } else {
12897                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12898                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12899                         }
12900                 }
12901         }
12902 }
12903 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12904         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12905                 let contents = if o.result_ok {
12906                         let result = unsafe { o.contents.result };
12907                         unsafe { o.contents.result = core::ptr::null_mut() };
12908                         CResult_InitDecodeErrorZPtr { result }
12909                 } else {
12910                         let err = unsafe { o.contents.err };
12911                         unsafe { o.contents.err = core::ptr::null_mut(); }
12912                         CResult_InitDecodeErrorZPtr { err }
12913                 };
12914                 Self {
12915                         contents,
12916                         result_ok: o.result_ok,
12917                 }
12918         }
12919 }
12920 impl Clone for CResult_InitDecodeErrorZ {
12921         fn clone(&self) -> Self {
12922                 if self.result_ok {
12923                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12924                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12925                         } }
12926                 } else {
12927                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12928                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12929                         } }
12930                 }
12931         }
12932 }
12933 #[no_mangle]
12934 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12935 /// but with all dynamically-allocated buffers duplicated in new buffers.
12936 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12937 #[repr(C)]
12938 /// The contents of CResult_OpenChannelDecodeErrorZ
12939 pub union CResult_OpenChannelDecodeErrorZPtr {
12940         /// A pointer to the contents in the success state.
12941         /// Reading from this pointer when `result_ok` is not set is undefined.
12942         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12943         /// A pointer to the contents in the error state.
12944         /// Reading from this pointer when `result_ok` is set is undefined.
12945         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12946 }
12947 #[repr(C)]
12948 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12949 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12950 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12951 pub struct CResult_OpenChannelDecodeErrorZ {
12952         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12953         /// `err` or `result` depending on the state of `result_ok`.
12954         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12955         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12956         pub result_ok: bool,
12957 }
12958 #[no_mangle]
12959 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12960 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12961         CResult_OpenChannelDecodeErrorZ {
12962                 contents: CResult_OpenChannelDecodeErrorZPtr {
12963                         result: Box::into_raw(Box::new(o)),
12964                 },
12965                 result_ok: true,
12966         }
12967 }
12968 #[no_mangle]
12969 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12970 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12971         CResult_OpenChannelDecodeErrorZ {
12972                 contents: CResult_OpenChannelDecodeErrorZPtr {
12973                         err: Box::into_raw(Box::new(e)),
12974                 },
12975                 result_ok: false,
12976         }
12977 }
12978 /// Checks if the given object is currently in the success state
12979 #[no_mangle]
12980 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12981         o.result_ok
12982 }
12983 #[no_mangle]
12984 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12985 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12986 impl Drop for CResult_OpenChannelDecodeErrorZ {
12987         fn drop(&mut self) {
12988                 if self.result_ok {
12989                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12990                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12991                         }
12992                 } else {
12993                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12994                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12995                         }
12996                 }
12997         }
12998 }
12999 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13000         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13001                 let contents = if o.result_ok {
13002                         let result = unsafe { o.contents.result };
13003                         unsafe { o.contents.result = core::ptr::null_mut() };
13004                         CResult_OpenChannelDecodeErrorZPtr { result }
13005                 } else {
13006                         let err = unsafe { o.contents.err };
13007                         unsafe { o.contents.err = core::ptr::null_mut(); }
13008                         CResult_OpenChannelDecodeErrorZPtr { err }
13009                 };
13010                 Self {
13011                         contents,
13012                         result_ok: o.result_ok,
13013                 }
13014         }
13015 }
13016 impl Clone for CResult_OpenChannelDecodeErrorZ {
13017         fn clone(&self) -> Self {
13018                 if self.result_ok {
13019                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13020                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13021                         } }
13022                 } else {
13023                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13024                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13025                         } }
13026                 }
13027         }
13028 }
13029 #[no_mangle]
13030 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13031 /// but with all dynamically-allocated buffers duplicated in new buffers.
13032 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13033 #[repr(C)]
13034 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13035 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13036         /// A pointer to the contents in the success state.
13037         /// Reading from this pointer when `result_ok` is not set is undefined.
13038         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13039         /// A pointer to the contents in the error state.
13040         /// Reading from this pointer when `result_ok` is set is undefined.
13041         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13042 }
13043 #[repr(C)]
13044 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13045 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13046 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13047 pub struct CResult_RevokeAndACKDecodeErrorZ {
13048         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13049         /// `err` or `result` depending on the state of `result_ok`.
13050         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13051         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13052         pub result_ok: bool,
13053 }
13054 #[no_mangle]
13055 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13056 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13057         CResult_RevokeAndACKDecodeErrorZ {
13058                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13059                         result: Box::into_raw(Box::new(o)),
13060                 },
13061                 result_ok: true,
13062         }
13063 }
13064 #[no_mangle]
13065 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13066 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13067         CResult_RevokeAndACKDecodeErrorZ {
13068                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13069                         err: Box::into_raw(Box::new(e)),
13070                 },
13071                 result_ok: false,
13072         }
13073 }
13074 /// Checks if the given object is currently in the success state
13075 #[no_mangle]
13076 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13077         o.result_ok
13078 }
13079 #[no_mangle]
13080 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13081 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13082 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13083         fn drop(&mut self) {
13084                 if self.result_ok {
13085                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13086                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13087                         }
13088                 } else {
13089                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13090                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13091                         }
13092                 }
13093         }
13094 }
13095 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13096         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13097                 let contents = if o.result_ok {
13098                         let result = unsafe { o.contents.result };
13099                         unsafe { o.contents.result = core::ptr::null_mut() };
13100                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13101                 } else {
13102                         let err = unsafe { o.contents.err };
13103                         unsafe { o.contents.err = core::ptr::null_mut(); }
13104                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13105                 };
13106                 Self {
13107                         contents,
13108                         result_ok: o.result_ok,
13109                 }
13110         }
13111 }
13112 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13113         fn clone(&self) -> Self {
13114                 if self.result_ok {
13115                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13116                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13117                         } }
13118                 } else {
13119                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13120                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13121                         } }
13122                 }
13123         }
13124 }
13125 #[no_mangle]
13126 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13127 /// but with all dynamically-allocated buffers duplicated in new buffers.
13128 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13129 #[repr(C)]
13130 /// The contents of CResult_ShutdownDecodeErrorZ
13131 pub union CResult_ShutdownDecodeErrorZPtr {
13132         /// A pointer to the contents in the success state.
13133         /// Reading from this pointer when `result_ok` is not set is undefined.
13134         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13135         /// A pointer to the contents in the error state.
13136         /// Reading from this pointer when `result_ok` is set is undefined.
13137         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13138 }
13139 #[repr(C)]
13140 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13141 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13142 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13143 pub struct CResult_ShutdownDecodeErrorZ {
13144         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13145         /// `err` or `result` depending on the state of `result_ok`.
13146         pub contents: CResult_ShutdownDecodeErrorZPtr,
13147         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13148         pub result_ok: bool,
13149 }
13150 #[no_mangle]
13151 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13152 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13153         CResult_ShutdownDecodeErrorZ {
13154                 contents: CResult_ShutdownDecodeErrorZPtr {
13155                         result: Box::into_raw(Box::new(o)),
13156                 },
13157                 result_ok: true,
13158         }
13159 }
13160 #[no_mangle]
13161 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13162 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13163         CResult_ShutdownDecodeErrorZ {
13164                 contents: CResult_ShutdownDecodeErrorZPtr {
13165                         err: Box::into_raw(Box::new(e)),
13166                 },
13167                 result_ok: false,
13168         }
13169 }
13170 /// Checks if the given object is currently in the success state
13171 #[no_mangle]
13172 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13173         o.result_ok
13174 }
13175 #[no_mangle]
13176 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13177 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13178 impl Drop for CResult_ShutdownDecodeErrorZ {
13179         fn drop(&mut self) {
13180                 if self.result_ok {
13181                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13182                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13183                         }
13184                 } else {
13185                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13186                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13187                         }
13188                 }
13189         }
13190 }
13191 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13192         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13193                 let contents = if o.result_ok {
13194                         let result = unsafe { o.contents.result };
13195                         unsafe { o.contents.result = core::ptr::null_mut() };
13196                         CResult_ShutdownDecodeErrorZPtr { result }
13197                 } else {
13198                         let err = unsafe { o.contents.err };
13199                         unsafe { o.contents.err = core::ptr::null_mut(); }
13200                         CResult_ShutdownDecodeErrorZPtr { err }
13201                 };
13202                 Self {
13203                         contents,
13204                         result_ok: o.result_ok,
13205                 }
13206         }
13207 }
13208 impl Clone for CResult_ShutdownDecodeErrorZ {
13209         fn clone(&self) -> Self {
13210                 if self.result_ok {
13211                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13212                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13213                         } }
13214                 } else {
13215                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13216                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13217                         } }
13218                 }
13219         }
13220 }
13221 #[no_mangle]
13222 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13223 /// but with all dynamically-allocated buffers duplicated in new buffers.
13224 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13225 #[repr(C)]
13226 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13227 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13228         /// A pointer to the contents in the success state.
13229         /// Reading from this pointer when `result_ok` is not set is undefined.
13230         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13231         /// A pointer to the contents in the error state.
13232         /// Reading from this pointer when `result_ok` is set is undefined.
13233         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13234 }
13235 #[repr(C)]
13236 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13237 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13238 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13239 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13240         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13241         /// `err` or `result` depending on the state of `result_ok`.
13242         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13243         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13244         pub result_ok: bool,
13245 }
13246 #[no_mangle]
13247 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13248 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13249         CResult_UpdateFailHTLCDecodeErrorZ {
13250                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13251                         result: Box::into_raw(Box::new(o)),
13252                 },
13253                 result_ok: true,
13254         }
13255 }
13256 #[no_mangle]
13257 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13258 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13259         CResult_UpdateFailHTLCDecodeErrorZ {
13260                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13261                         err: Box::into_raw(Box::new(e)),
13262                 },
13263                 result_ok: false,
13264         }
13265 }
13266 /// Checks if the given object is currently in the success state
13267 #[no_mangle]
13268 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13269         o.result_ok
13270 }
13271 #[no_mangle]
13272 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13273 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13274 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13275         fn drop(&mut self) {
13276                 if self.result_ok {
13277                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13278                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13279                         }
13280                 } else {
13281                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13282                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13283                         }
13284                 }
13285         }
13286 }
13287 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13288         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13289                 let contents = if o.result_ok {
13290                         let result = unsafe { o.contents.result };
13291                         unsafe { o.contents.result = core::ptr::null_mut() };
13292                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13293                 } else {
13294                         let err = unsafe { o.contents.err };
13295                         unsafe { o.contents.err = core::ptr::null_mut(); }
13296                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13297                 };
13298                 Self {
13299                         contents,
13300                         result_ok: o.result_ok,
13301                 }
13302         }
13303 }
13304 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13305         fn clone(&self) -> Self {
13306                 if self.result_ok {
13307                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13308                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13309                         } }
13310                 } else {
13311                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13312                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13313                         } }
13314                 }
13315         }
13316 }
13317 #[no_mangle]
13318 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13319 /// but with all dynamically-allocated buffers duplicated in new buffers.
13320 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13321 #[repr(C)]
13322 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13323 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13324         /// A pointer to the contents in the success state.
13325         /// Reading from this pointer when `result_ok` is not set is undefined.
13326         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13327         /// A pointer to the contents in the error state.
13328         /// Reading from this pointer when `result_ok` is set is undefined.
13329         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13330 }
13331 #[repr(C)]
13332 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13333 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13334 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13335 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13336         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13337         /// `err` or `result` depending on the state of `result_ok`.
13338         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13339         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13340         pub result_ok: bool,
13341 }
13342 #[no_mangle]
13343 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13344 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13345         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13346                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13347                         result: Box::into_raw(Box::new(o)),
13348                 },
13349                 result_ok: true,
13350         }
13351 }
13352 #[no_mangle]
13353 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13354 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13355         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13356                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13357                         err: Box::into_raw(Box::new(e)),
13358                 },
13359                 result_ok: false,
13360         }
13361 }
13362 /// Checks if the given object is currently in the success state
13363 #[no_mangle]
13364 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13365         o.result_ok
13366 }
13367 #[no_mangle]
13368 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13369 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13370 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13371         fn drop(&mut self) {
13372                 if self.result_ok {
13373                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13374                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13375                         }
13376                 } else {
13377                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13378                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13379                         }
13380                 }
13381         }
13382 }
13383 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13384         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13385                 let contents = if o.result_ok {
13386                         let result = unsafe { o.contents.result };
13387                         unsafe { o.contents.result = core::ptr::null_mut() };
13388                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13389                 } else {
13390                         let err = unsafe { o.contents.err };
13391                         unsafe { o.contents.err = core::ptr::null_mut(); }
13392                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13393                 };
13394                 Self {
13395                         contents,
13396                         result_ok: o.result_ok,
13397                 }
13398         }
13399 }
13400 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13401         fn clone(&self) -> Self {
13402                 if self.result_ok {
13403                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13404                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13405                         } }
13406                 } else {
13407                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13408                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13409                         } }
13410                 }
13411         }
13412 }
13413 #[no_mangle]
13414 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13415 /// but with all dynamically-allocated buffers duplicated in new buffers.
13416 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13417 #[repr(C)]
13418 /// The contents of CResult_UpdateFeeDecodeErrorZ
13419 pub union CResult_UpdateFeeDecodeErrorZPtr {
13420         /// A pointer to the contents in the success state.
13421         /// Reading from this pointer when `result_ok` is not set is undefined.
13422         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13423         /// A pointer to the contents in the error state.
13424         /// Reading from this pointer when `result_ok` is set is undefined.
13425         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13426 }
13427 #[repr(C)]
13428 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13429 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13431 pub struct CResult_UpdateFeeDecodeErrorZ {
13432         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13433         /// `err` or `result` depending on the state of `result_ok`.
13434         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13435         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13436         pub result_ok: bool,
13437 }
13438 #[no_mangle]
13439 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13440 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13441         CResult_UpdateFeeDecodeErrorZ {
13442                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13443                         result: Box::into_raw(Box::new(o)),
13444                 },
13445                 result_ok: true,
13446         }
13447 }
13448 #[no_mangle]
13449 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13450 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13451         CResult_UpdateFeeDecodeErrorZ {
13452                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13453                         err: Box::into_raw(Box::new(e)),
13454                 },
13455                 result_ok: false,
13456         }
13457 }
13458 /// Checks if the given object is currently in the success state
13459 #[no_mangle]
13460 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13461         o.result_ok
13462 }
13463 #[no_mangle]
13464 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13465 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13466 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13467         fn drop(&mut self) {
13468                 if self.result_ok {
13469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13471                         }
13472                 } else {
13473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13475                         }
13476                 }
13477         }
13478 }
13479 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13480         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13481                 let contents = if o.result_ok {
13482                         let result = unsafe { o.contents.result };
13483                         unsafe { o.contents.result = core::ptr::null_mut() };
13484                         CResult_UpdateFeeDecodeErrorZPtr { result }
13485                 } else {
13486                         let err = unsafe { o.contents.err };
13487                         unsafe { o.contents.err = core::ptr::null_mut(); }
13488                         CResult_UpdateFeeDecodeErrorZPtr { err }
13489                 };
13490                 Self {
13491                         contents,
13492                         result_ok: o.result_ok,
13493                 }
13494         }
13495 }
13496 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13497         fn clone(&self) -> Self {
13498                 if self.result_ok {
13499                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13500                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13501                         } }
13502                 } else {
13503                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13505                         } }
13506                 }
13507         }
13508 }
13509 #[no_mangle]
13510 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13511 /// but with all dynamically-allocated buffers duplicated in new buffers.
13512 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13513 #[repr(C)]
13514 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13515 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13516         /// A pointer to the contents in the success state.
13517         /// Reading from this pointer when `result_ok` is not set is undefined.
13518         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13519         /// A pointer to the contents in the error state.
13520         /// Reading from this pointer when `result_ok` is set is undefined.
13521         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13522 }
13523 #[repr(C)]
13524 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13525 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13526 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13527 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13528         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13529         /// `err` or `result` depending on the state of `result_ok`.
13530         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13531         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13532         pub result_ok: bool,
13533 }
13534 #[no_mangle]
13535 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13536 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13537         CResult_UpdateFulfillHTLCDecodeErrorZ {
13538                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13539                         result: Box::into_raw(Box::new(o)),
13540                 },
13541                 result_ok: true,
13542         }
13543 }
13544 #[no_mangle]
13545 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13546 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13547         CResult_UpdateFulfillHTLCDecodeErrorZ {
13548                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13549                         err: Box::into_raw(Box::new(e)),
13550                 },
13551                 result_ok: false,
13552         }
13553 }
13554 /// Checks if the given object is currently in the success state
13555 #[no_mangle]
13556 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13557         o.result_ok
13558 }
13559 #[no_mangle]
13560 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13561 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13562 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13563         fn drop(&mut self) {
13564                 if self.result_ok {
13565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13567                         }
13568                 } else {
13569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13571                         }
13572                 }
13573         }
13574 }
13575 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13576         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13577                 let contents = if o.result_ok {
13578                         let result = unsafe { o.contents.result };
13579                         unsafe { o.contents.result = core::ptr::null_mut() };
13580                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13581                 } else {
13582                         let err = unsafe { o.contents.err };
13583                         unsafe { o.contents.err = core::ptr::null_mut(); }
13584                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13585                 };
13586                 Self {
13587                         contents,
13588                         result_ok: o.result_ok,
13589                 }
13590         }
13591 }
13592 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13593         fn clone(&self) -> Self {
13594                 if self.result_ok {
13595                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13596                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13597                         } }
13598                 } else {
13599                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13600                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13601                         } }
13602                 }
13603         }
13604 }
13605 #[no_mangle]
13606 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13607 /// but with all dynamically-allocated buffers duplicated in new buffers.
13608 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13609 #[repr(C)]
13610 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13611 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13612         /// A pointer to the contents in the success state.
13613         /// Reading from this pointer when `result_ok` is not set is undefined.
13614         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13615         /// A pointer to the contents in the error state.
13616         /// Reading from this pointer when `result_ok` is set is undefined.
13617         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13618 }
13619 #[repr(C)]
13620 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13621 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13622 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13623 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13624         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13625         /// `err` or `result` depending on the state of `result_ok`.
13626         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13627         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13628         pub result_ok: bool,
13629 }
13630 #[no_mangle]
13631 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13632 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13633         CResult_UpdateAddHTLCDecodeErrorZ {
13634                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13635                         result: Box::into_raw(Box::new(o)),
13636                 },
13637                 result_ok: true,
13638         }
13639 }
13640 #[no_mangle]
13641 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13642 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13643         CResult_UpdateAddHTLCDecodeErrorZ {
13644                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13645                         err: Box::into_raw(Box::new(e)),
13646                 },
13647                 result_ok: false,
13648         }
13649 }
13650 /// Checks if the given object is currently in the success state
13651 #[no_mangle]
13652 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13653         o.result_ok
13654 }
13655 #[no_mangle]
13656 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13657 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13658 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13659         fn drop(&mut self) {
13660                 if self.result_ok {
13661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13663                         }
13664                 } else {
13665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13667                         }
13668                 }
13669         }
13670 }
13671 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13672         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13673                 let contents = if o.result_ok {
13674                         let result = unsafe { o.contents.result };
13675                         unsafe { o.contents.result = core::ptr::null_mut() };
13676                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13677                 } else {
13678                         let err = unsafe { o.contents.err };
13679                         unsafe { o.contents.err = core::ptr::null_mut(); }
13680                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13681                 };
13682                 Self {
13683                         contents,
13684                         result_ok: o.result_ok,
13685                 }
13686         }
13687 }
13688 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13689         fn clone(&self) -> Self {
13690                 if self.result_ok {
13691                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13692                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13693                         } }
13694                 } else {
13695                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13696                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13697                         } }
13698                 }
13699         }
13700 }
13701 #[no_mangle]
13702 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13703 /// but with all dynamically-allocated buffers duplicated in new buffers.
13704 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13705 #[repr(C)]
13706 /// The contents of CResult_PingDecodeErrorZ
13707 pub union CResult_PingDecodeErrorZPtr {
13708         /// A pointer to the contents in the success state.
13709         /// Reading from this pointer when `result_ok` is not set is undefined.
13710         pub result: *mut crate::lightning::ln::msgs::Ping,
13711         /// A pointer to the contents in the error state.
13712         /// Reading from this pointer when `result_ok` is set is undefined.
13713         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13714 }
13715 #[repr(C)]
13716 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13717 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13718 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13719 pub struct CResult_PingDecodeErrorZ {
13720         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13721         /// `err` or `result` depending on the state of `result_ok`.
13722         pub contents: CResult_PingDecodeErrorZPtr,
13723         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13724         pub result_ok: bool,
13725 }
13726 #[no_mangle]
13727 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13728 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13729         CResult_PingDecodeErrorZ {
13730                 contents: CResult_PingDecodeErrorZPtr {
13731                         result: Box::into_raw(Box::new(o)),
13732                 },
13733                 result_ok: true,
13734         }
13735 }
13736 #[no_mangle]
13737 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13738 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13739         CResult_PingDecodeErrorZ {
13740                 contents: CResult_PingDecodeErrorZPtr {
13741                         err: Box::into_raw(Box::new(e)),
13742                 },
13743                 result_ok: false,
13744         }
13745 }
13746 /// Checks if the given object is currently in the success state
13747 #[no_mangle]
13748 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13749         o.result_ok
13750 }
13751 #[no_mangle]
13752 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13753 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13754 impl Drop for CResult_PingDecodeErrorZ {
13755         fn drop(&mut self) {
13756                 if self.result_ok {
13757                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13758                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13759                         }
13760                 } else {
13761                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13762                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13763                         }
13764                 }
13765         }
13766 }
13767 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13768         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13769                 let contents = if o.result_ok {
13770                         let result = unsafe { o.contents.result };
13771                         unsafe { o.contents.result = core::ptr::null_mut() };
13772                         CResult_PingDecodeErrorZPtr { result }
13773                 } else {
13774                         let err = unsafe { o.contents.err };
13775                         unsafe { o.contents.err = core::ptr::null_mut(); }
13776                         CResult_PingDecodeErrorZPtr { err }
13777                 };
13778                 Self {
13779                         contents,
13780                         result_ok: o.result_ok,
13781                 }
13782         }
13783 }
13784 impl Clone for CResult_PingDecodeErrorZ {
13785         fn clone(&self) -> Self {
13786                 if self.result_ok {
13787                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13788                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13789                         } }
13790                 } else {
13791                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13792                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13793                         } }
13794                 }
13795         }
13796 }
13797 #[no_mangle]
13798 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13799 /// but with all dynamically-allocated buffers duplicated in new buffers.
13800 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13801 #[repr(C)]
13802 /// The contents of CResult_PongDecodeErrorZ
13803 pub union CResult_PongDecodeErrorZPtr {
13804         /// A pointer to the contents in the success state.
13805         /// Reading from this pointer when `result_ok` is not set is undefined.
13806         pub result: *mut crate::lightning::ln::msgs::Pong,
13807         /// A pointer to the contents in the error state.
13808         /// Reading from this pointer when `result_ok` is set is undefined.
13809         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13810 }
13811 #[repr(C)]
13812 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13813 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13815 pub struct CResult_PongDecodeErrorZ {
13816         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13817         /// `err` or `result` depending on the state of `result_ok`.
13818         pub contents: CResult_PongDecodeErrorZPtr,
13819         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13820         pub result_ok: bool,
13821 }
13822 #[no_mangle]
13823 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13824 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13825         CResult_PongDecodeErrorZ {
13826                 contents: CResult_PongDecodeErrorZPtr {
13827                         result: Box::into_raw(Box::new(o)),
13828                 },
13829                 result_ok: true,
13830         }
13831 }
13832 #[no_mangle]
13833 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13834 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13835         CResult_PongDecodeErrorZ {
13836                 contents: CResult_PongDecodeErrorZPtr {
13837                         err: Box::into_raw(Box::new(e)),
13838                 },
13839                 result_ok: false,
13840         }
13841 }
13842 /// Checks if the given object is currently in the success state
13843 #[no_mangle]
13844 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13845         o.result_ok
13846 }
13847 #[no_mangle]
13848 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13849 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13850 impl Drop for CResult_PongDecodeErrorZ {
13851         fn drop(&mut self) {
13852                 if self.result_ok {
13853                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13854                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13855                         }
13856                 } else {
13857                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13858                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13859                         }
13860                 }
13861         }
13862 }
13863 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13864         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13865                 let contents = if o.result_ok {
13866                         let result = unsafe { o.contents.result };
13867                         unsafe { o.contents.result = core::ptr::null_mut() };
13868                         CResult_PongDecodeErrorZPtr { result }
13869                 } else {
13870                         let err = unsafe { o.contents.err };
13871                         unsafe { o.contents.err = core::ptr::null_mut(); }
13872                         CResult_PongDecodeErrorZPtr { err }
13873                 };
13874                 Self {
13875                         contents,
13876                         result_ok: o.result_ok,
13877                 }
13878         }
13879 }
13880 impl Clone for CResult_PongDecodeErrorZ {
13881         fn clone(&self) -> Self {
13882                 if self.result_ok {
13883                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13884                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13885                         } }
13886                 } else {
13887                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13888                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13889                         } }
13890                 }
13891         }
13892 }
13893 #[no_mangle]
13894 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13895 /// but with all dynamically-allocated buffers duplicated in new buffers.
13896 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13897 #[repr(C)]
13898 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13899 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13900         /// A pointer to the contents in the success state.
13901         /// Reading from this pointer when `result_ok` is not set is undefined.
13902         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13903         /// A pointer to the contents in the error state.
13904         /// Reading from this pointer when `result_ok` is set is undefined.
13905         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13906 }
13907 #[repr(C)]
13908 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13909 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13910 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13911 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13912         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13913         /// `err` or `result` depending on the state of `result_ok`.
13914         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13915         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13916         pub result_ok: bool,
13917 }
13918 #[no_mangle]
13919 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13920 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13921         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13922                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13923                         result: Box::into_raw(Box::new(o)),
13924                 },
13925                 result_ok: true,
13926         }
13927 }
13928 #[no_mangle]
13929 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13930 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13931         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13932                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13933                         err: Box::into_raw(Box::new(e)),
13934                 },
13935                 result_ok: false,
13936         }
13937 }
13938 /// Checks if the given object is currently in the success state
13939 #[no_mangle]
13940 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13941         o.result_ok
13942 }
13943 #[no_mangle]
13944 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13945 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13946 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13947         fn drop(&mut self) {
13948                 if self.result_ok {
13949                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13950                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13951                         }
13952                 } else {
13953                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13954                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13955                         }
13956                 }
13957         }
13958 }
13959 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13960         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13961                 let contents = if o.result_ok {
13962                         let result = unsafe { o.contents.result };
13963                         unsafe { o.contents.result = core::ptr::null_mut() };
13964                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13965                 } else {
13966                         let err = unsafe { o.contents.err };
13967                         unsafe { o.contents.err = core::ptr::null_mut(); }
13968                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13969                 };
13970                 Self {
13971                         contents,
13972                         result_ok: o.result_ok,
13973                 }
13974         }
13975 }
13976 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13977         fn clone(&self) -> Self {
13978                 if self.result_ok {
13979                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13980                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13981                         } }
13982                 } else {
13983                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13984                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13985                         } }
13986                 }
13987         }
13988 }
13989 #[no_mangle]
13990 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13991 /// but with all dynamically-allocated buffers duplicated in new buffers.
13992 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13993 #[repr(C)]
13994 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13995 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13996         /// A pointer to the contents in the success state.
13997         /// Reading from this pointer when `result_ok` is not set is undefined.
13998         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13999         /// A pointer to the contents in the error state.
14000         /// Reading from this pointer when `result_ok` is set is undefined.
14001         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14002 }
14003 #[repr(C)]
14004 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14005 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14007 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14008         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14009         /// `err` or `result` depending on the state of `result_ok`.
14010         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14011         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14012         pub result_ok: bool,
14013 }
14014 #[no_mangle]
14015 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14016 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14017         CResult_ChannelAnnouncementDecodeErrorZ {
14018                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14019                         result: Box::into_raw(Box::new(o)),
14020                 },
14021                 result_ok: true,
14022         }
14023 }
14024 #[no_mangle]
14025 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14026 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14027         CResult_ChannelAnnouncementDecodeErrorZ {
14028                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14029                         err: Box::into_raw(Box::new(e)),
14030                 },
14031                 result_ok: false,
14032         }
14033 }
14034 /// Checks if the given object is currently in the success state
14035 #[no_mangle]
14036 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14037         o.result_ok
14038 }
14039 #[no_mangle]
14040 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14041 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14042 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14043         fn drop(&mut self) {
14044                 if self.result_ok {
14045                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14046                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14047                         }
14048                 } else {
14049                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14050                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14051                         }
14052                 }
14053         }
14054 }
14055 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14056         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14057                 let contents = if o.result_ok {
14058                         let result = unsafe { o.contents.result };
14059                         unsafe { o.contents.result = core::ptr::null_mut() };
14060                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14061                 } else {
14062                         let err = unsafe { o.contents.err };
14063                         unsafe { o.contents.err = core::ptr::null_mut(); }
14064                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14065                 };
14066                 Self {
14067                         contents,
14068                         result_ok: o.result_ok,
14069                 }
14070         }
14071 }
14072 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14073         fn clone(&self) -> Self {
14074                 if self.result_ok {
14075                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14076                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14077                         } }
14078                 } else {
14079                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14080                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14081                         } }
14082                 }
14083         }
14084 }
14085 #[no_mangle]
14086 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14087 /// but with all dynamically-allocated buffers duplicated in new buffers.
14088 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14089 #[repr(C)]
14090 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14091 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14092         /// A pointer to the contents in the success state.
14093         /// Reading from this pointer when `result_ok` is not set is undefined.
14094         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14095         /// A pointer to the contents in the error state.
14096         /// Reading from this pointer when `result_ok` is set is undefined.
14097         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14098 }
14099 #[repr(C)]
14100 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14101 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14103 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14104         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14105         /// `err` or `result` depending on the state of `result_ok`.
14106         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14107         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14108         pub result_ok: bool,
14109 }
14110 #[no_mangle]
14111 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14112 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14113         CResult_UnsignedChannelUpdateDecodeErrorZ {
14114                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14115                         result: Box::into_raw(Box::new(o)),
14116                 },
14117                 result_ok: true,
14118         }
14119 }
14120 #[no_mangle]
14121 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14122 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14123         CResult_UnsignedChannelUpdateDecodeErrorZ {
14124                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14125                         err: Box::into_raw(Box::new(e)),
14126                 },
14127                 result_ok: false,
14128         }
14129 }
14130 /// Checks if the given object is currently in the success state
14131 #[no_mangle]
14132 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14133         o.result_ok
14134 }
14135 #[no_mangle]
14136 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14137 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14138 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14139         fn drop(&mut self) {
14140                 if self.result_ok {
14141                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14142                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14143                         }
14144                 } else {
14145                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14146                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14147                         }
14148                 }
14149         }
14150 }
14151 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14152         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14153                 let contents = if o.result_ok {
14154                         let result = unsafe { o.contents.result };
14155                         unsafe { o.contents.result = core::ptr::null_mut() };
14156                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14157                 } else {
14158                         let err = unsafe { o.contents.err };
14159                         unsafe { o.contents.err = core::ptr::null_mut(); }
14160                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14161                 };
14162                 Self {
14163                         contents,
14164                         result_ok: o.result_ok,
14165                 }
14166         }
14167 }
14168 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14169         fn clone(&self) -> Self {
14170                 if self.result_ok {
14171                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14172                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14173                         } }
14174                 } else {
14175                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14176                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14177                         } }
14178                 }
14179         }
14180 }
14181 #[no_mangle]
14182 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14183 /// but with all dynamically-allocated buffers duplicated in new buffers.
14184 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14185 #[repr(C)]
14186 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14187 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14188         /// A pointer to the contents in the success state.
14189         /// Reading from this pointer when `result_ok` is not set is undefined.
14190         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14191         /// A pointer to the contents in the error state.
14192         /// Reading from this pointer when `result_ok` is set is undefined.
14193         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14194 }
14195 #[repr(C)]
14196 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14197 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14199 pub struct CResult_ChannelUpdateDecodeErrorZ {
14200         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14201         /// `err` or `result` depending on the state of `result_ok`.
14202         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14203         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14204         pub result_ok: bool,
14205 }
14206 #[no_mangle]
14207 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14208 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14209         CResult_ChannelUpdateDecodeErrorZ {
14210                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14211                         result: Box::into_raw(Box::new(o)),
14212                 },
14213                 result_ok: true,
14214         }
14215 }
14216 #[no_mangle]
14217 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14218 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14219         CResult_ChannelUpdateDecodeErrorZ {
14220                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14221                         err: Box::into_raw(Box::new(e)),
14222                 },
14223                 result_ok: false,
14224         }
14225 }
14226 /// Checks if the given object is currently in the success state
14227 #[no_mangle]
14228 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14229         o.result_ok
14230 }
14231 #[no_mangle]
14232 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14233 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14234 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14235         fn drop(&mut self) {
14236                 if self.result_ok {
14237                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14238                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14239                         }
14240                 } else {
14241                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14242                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14243                         }
14244                 }
14245         }
14246 }
14247 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14248         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14249                 let contents = if o.result_ok {
14250                         let result = unsafe { o.contents.result };
14251                         unsafe { o.contents.result = core::ptr::null_mut() };
14252                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14253                 } else {
14254                         let err = unsafe { o.contents.err };
14255                         unsafe { o.contents.err = core::ptr::null_mut(); }
14256                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14257                 };
14258                 Self {
14259                         contents,
14260                         result_ok: o.result_ok,
14261                 }
14262         }
14263 }
14264 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14265         fn clone(&self) -> Self {
14266                 if self.result_ok {
14267                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14268                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14269                         } }
14270                 } else {
14271                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14272                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14273                         } }
14274                 }
14275         }
14276 }
14277 #[no_mangle]
14278 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14279 /// but with all dynamically-allocated buffers duplicated in new buffers.
14280 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14281 #[repr(C)]
14282 /// The contents of CResult_ErrorMessageDecodeErrorZ
14283 pub union CResult_ErrorMessageDecodeErrorZPtr {
14284         /// A pointer to the contents in the success state.
14285         /// Reading from this pointer when `result_ok` is not set is undefined.
14286         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14287         /// A pointer to the contents in the error state.
14288         /// Reading from this pointer when `result_ok` is set is undefined.
14289         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14290 }
14291 #[repr(C)]
14292 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14293 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14295 pub struct CResult_ErrorMessageDecodeErrorZ {
14296         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14297         /// `err` or `result` depending on the state of `result_ok`.
14298         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14299         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14300         pub result_ok: bool,
14301 }
14302 #[no_mangle]
14303 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14304 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14305         CResult_ErrorMessageDecodeErrorZ {
14306                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14307                         result: Box::into_raw(Box::new(o)),
14308                 },
14309                 result_ok: true,
14310         }
14311 }
14312 #[no_mangle]
14313 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14314 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14315         CResult_ErrorMessageDecodeErrorZ {
14316                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14317                         err: Box::into_raw(Box::new(e)),
14318                 },
14319                 result_ok: false,
14320         }
14321 }
14322 /// Checks if the given object is currently in the success state
14323 #[no_mangle]
14324 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14325         o.result_ok
14326 }
14327 #[no_mangle]
14328 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14329 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14330 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14331         fn drop(&mut self) {
14332                 if self.result_ok {
14333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14335                         }
14336                 } else {
14337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14339                         }
14340                 }
14341         }
14342 }
14343 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14344         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14345                 let contents = if o.result_ok {
14346                         let result = unsafe { o.contents.result };
14347                         unsafe { o.contents.result = core::ptr::null_mut() };
14348                         CResult_ErrorMessageDecodeErrorZPtr { result }
14349                 } else {
14350                         let err = unsafe { o.contents.err };
14351                         unsafe { o.contents.err = core::ptr::null_mut(); }
14352                         CResult_ErrorMessageDecodeErrorZPtr { err }
14353                 };
14354                 Self {
14355                         contents,
14356                         result_ok: o.result_ok,
14357                 }
14358         }
14359 }
14360 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14361         fn clone(&self) -> Self {
14362                 if self.result_ok {
14363                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14364                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14365                         } }
14366                 } else {
14367                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14368                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14369                         } }
14370                 }
14371         }
14372 }
14373 #[no_mangle]
14374 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14375 /// but with all dynamically-allocated buffers duplicated in new buffers.
14376 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14377 #[repr(C)]
14378 /// The contents of CResult_WarningMessageDecodeErrorZ
14379 pub union CResult_WarningMessageDecodeErrorZPtr {
14380         /// A pointer to the contents in the success state.
14381         /// Reading from this pointer when `result_ok` is not set is undefined.
14382         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14383         /// A pointer to the contents in the error state.
14384         /// Reading from this pointer when `result_ok` is set is undefined.
14385         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14386 }
14387 #[repr(C)]
14388 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14389 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14391 pub struct CResult_WarningMessageDecodeErrorZ {
14392         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14393         /// `err` or `result` depending on the state of `result_ok`.
14394         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14395         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14396         pub result_ok: bool,
14397 }
14398 #[no_mangle]
14399 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14400 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14401         CResult_WarningMessageDecodeErrorZ {
14402                 contents: CResult_WarningMessageDecodeErrorZPtr {
14403                         result: Box::into_raw(Box::new(o)),
14404                 },
14405                 result_ok: true,
14406         }
14407 }
14408 #[no_mangle]
14409 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14410 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14411         CResult_WarningMessageDecodeErrorZ {
14412                 contents: CResult_WarningMessageDecodeErrorZPtr {
14413                         err: Box::into_raw(Box::new(e)),
14414                 },
14415                 result_ok: false,
14416         }
14417 }
14418 /// Checks if the given object is currently in the success state
14419 #[no_mangle]
14420 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14421         o.result_ok
14422 }
14423 #[no_mangle]
14424 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14425 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14426 impl Drop for CResult_WarningMessageDecodeErrorZ {
14427         fn drop(&mut self) {
14428                 if self.result_ok {
14429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14431                         }
14432                 } else {
14433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14435                         }
14436                 }
14437         }
14438 }
14439 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14440         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14441                 let contents = if o.result_ok {
14442                         let result = unsafe { o.contents.result };
14443                         unsafe { o.contents.result = core::ptr::null_mut() };
14444                         CResult_WarningMessageDecodeErrorZPtr { result }
14445                 } else {
14446                         let err = unsafe { o.contents.err };
14447                         unsafe { o.contents.err = core::ptr::null_mut(); }
14448                         CResult_WarningMessageDecodeErrorZPtr { err }
14449                 };
14450                 Self {
14451                         contents,
14452                         result_ok: o.result_ok,
14453                 }
14454         }
14455 }
14456 impl Clone for CResult_WarningMessageDecodeErrorZ {
14457         fn clone(&self) -> Self {
14458                 if self.result_ok {
14459                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14460                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14461                         } }
14462                 } else {
14463                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14464                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14465                         } }
14466                 }
14467         }
14468 }
14469 #[no_mangle]
14470 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14471 /// but with all dynamically-allocated buffers duplicated in new buffers.
14472 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14473 #[repr(C)]
14474 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14475 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14476         /// A pointer to the contents in the success state.
14477         /// Reading from this pointer when `result_ok` is not set is undefined.
14478         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14479         /// A pointer to the contents in the error state.
14480         /// Reading from this pointer when `result_ok` is set is undefined.
14481         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14482 }
14483 #[repr(C)]
14484 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14485 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14486 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14487 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14488         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14489         /// `err` or `result` depending on the state of `result_ok`.
14490         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14491         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14492         pub result_ok: bool,
14493 }
14494 #[no_mangle]
14495 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14496 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14497         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14498                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14499                         result: Box::into_raw(Box::new(o)),
14500                 },
14501                 result_ok: true,
14502         }
14503 }
14504 #[no_mangle]
14505 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14506 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14507         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14508                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14509                         err: Box::into_raw(Box::new(e)),
14510                 },
14511                 result_ok: false,
14512         }
14513 }
14514 /// Checks if the given object is currently in the success state
14515 #[no_mangle]
14516 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14517         o.result_ok
14518 }
14519 #[no_mangle]
14520 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14521 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14522 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14523         fn drop(&mut self) {
14524                 if self.result_ok {
14525                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14526                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14527                         }
14528                 } else {
14529                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14530                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14531                         }
14532                 }
14533         }
14534 }
14535 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14536         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14537                 let contents = if o.result_ok {
14538                         let result = unsafe { o.contents.result };
14539                         unsafe { o.contents.result = core::ptr::null_mut() };
14540                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14541                 } else {
14542                         let err = unsafe { o.contents.err };
14543                         unsafe { o.contents.err = core::ptr::null_mut(); }
14544                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14545                 };
14546                 Self {
14547                         contents,
14548                         result_ok: o.result_ok,
14549                 }
14550         }
14551 }
14552 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14553         fn clone(&self) -> Self {
14554                 if self.result_ok {
14555                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14556                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14557                         } }
14558                 } else {
14559                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14560                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14561                         } }
14562                 }
14563         }
14564 }
14565 #[no_mangle]
14566 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14567 /// but with all dynamically-allocated buffers duplicated in new buffers.
14568 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14569 #[repr(C)]
14570 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14571 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14572         /// A pointer to the contents in the success state.
14573         /// Reading from this pointer when `result_ok` is not set is undefined.
14574         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14575         /// A pointer to the contents in the error state.
14576         /// Reading from this pointer when `result_ok` is set is undefined.
14577         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14578 }
14579 #[repr(C)]
14580 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14581 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14582 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14583 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14584         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14585         /// `err` or `result` depending on the state of `result_ok`.
14586         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14587         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14588         pub result_ok: bool,
14589 }
14590 #[no_mangle]
14591 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14592 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14593         CResult_NodeAnnouncementDecodeErrorZ {
14594                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14595                         result: Box::into_raw(Box::new(o)),
14596                 },
14597                 result_ok: true,
14598         }
14599 }
14600 #[no_mangle]
14601 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14602 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14603         CResult_NodeAnnouncementDecodeErrorZ {
14604                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14605                         err: Box::into_raw(Box::new(e)),
14606                 },
14607                 result_ok: false,
14608         }
14609 }
14610 /// Checks if the given object is currently in the success state
14611 #[no_mangle]
14612 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14613         o.result_ok
14614 }
14615 #[no_mangle]
14616 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14617 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14618 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14619         fn drop(&mut self) {
14620                 if self.result_ok {
14621                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14622                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14623                         }
14624                 } else {
14625                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14626                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14627                         }
14628                 }
14629         }
14630 }
14631 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14632         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14633                 let contents = if o.result_ok {
14634                         let result = unsafe { o.contents.result };
14635                         unsafe { o.contents.result = core::ptr::null_mut() };
14636                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14637                 } else {
14638                         let err = unsafe { o.contents.err };
14639                         unsafe { o.contents.err = core::ptr::null_mut(); }
14640                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14641                 };
14642                 Self {
14643                         contents,
14644                         result_ok: o.result_ok,
14645                 }
14646         }
14647 }
14648 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14649         fn clone(&self) -> Self {
14650                 if self.result_ok {
14651                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14652                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14653                         } }
14654                 } else {
14655                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14656                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14657                         } }
14658                 }
14659         }
14660 }
14661 #[no_mangle]
14662 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14663 /// but with all dynamically-allocated buffers duplicated in new buffers.
14664 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14665 #[repr(C)]
14666 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14667 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14668         /// A pointer to the contents in the success state.
14669         /// Reading from this pointer when `result_ok` is not set is undefined.
14670         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14671         /// A pointer to the contents in the error state.
14672         /// Reading from this pointer when `result_ok` is set is undefined.
14673         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14674 }
14675 #[repr(C)]
14676 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14677 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14678 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14679 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14680         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14681         /// `err` or `result` depending on the state of `result_ok`.
14682         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14683         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14684         pub result_ok: bool,
14685 }
14686 #[no_mangle]
14687 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14688 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14689         CResult_QueryShortChannelIdsDecodeErrorZ {
14690                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14691                         result: Box::into_raw(Box::new(o)),
14692                 },
14693                 result_ok: true,
14694         }
14695 }
14696 #[no_mangle]
14697 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14698 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14699         CResult_QueryShortChannelIdsDecodeErrorZ {
14700                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14701                         err: Box::into_raw(Box::new(e)),
14702                 },
14703                 result_ok: false,
14704         }
14705 }
14706 /// Checks if the given object is currently in the success state
14707 #[no_mangle]
14708 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14709         o.result_ok
14710 }
14711 #[no_mangle]
14712 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14713 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14714 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14715         fn drop(&mut self) {
14716                 if self.result_ok {
14717                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14718                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14719                         }
14720                 } else {
14721                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14722                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14723                         }
14724                 }
14725         }
14726 }
14727 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14728         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14729                 let contents = if o.result_ok {
14730                         let result = unsafe { o.contents.result };
14731                         unsafe { o.contents.result = core::ptr::null_mut() };
14732                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14733                 } else {
14734                         let err = unsafe { o.contents.err };
14735                         unsafe { o.contents.err = core::ptr::null_mut(); }
14736                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14737                 };
14738                 Self {
14739                         contents,
14740                         result_ok: o.result_ok,
14741                 }
14742         }
14743 }
14744 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14745         fn clone(&self) -> Self {
14746                 if self.result_ok {
14747                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14748                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14749                         } }
14750                 } else {
14751                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14752                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14753                         } }
14754                 }
14755         }
14756 }
14757 #[no_mangle]
14758 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14759 /// but with all dynamically-allocated buffers duplicated in new buffers.
14760 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14761 #[repr(C)]
14762 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14763 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14764         /// A pointer to the contents in the success state.
14765         /// Reading from this pointer when `result_ok` is not set is undefined.
14766         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14767         /// A pointer to the contents in the error state.
14768         /// Reading from this pointer when `result_ok` is set is undefined.
14769         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14770 }
14771 #[repr(C)]
14772 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14773 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14774 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14775 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14776         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14777         /// `err` or `result` depending on the state of `result_ok`.
14778         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14779         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14780         pub result_ok: bool,
14781 }
14782 #[no_mangle]
14783 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14784 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14785         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14786                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14787                         result: Box::into_raw(Box::new(o)),
14788                 },
14789                 result_ok: true,
14790         }
14791 }
14792 #[no_mangle]
14793 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14794 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14795         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14796                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14797                         err: Box::into_raw(Box::new(e)),
14798                 },
14799                 result_ok: false,
14800         }
14801 }
14802 /// Checks if the given object is currently in the success state
14803 #[no_mangle]
14804 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14805         o.result_ok
14806 }
14807 #[no_mangle]
14808 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14809 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14810 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14811         fn drop(&mut self) {
14812                 if self.result_ok {
14813                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14814                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14815                         }
14816                 } else {
14817                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14818                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14819                         }
14820                 }
14821         }
14822 }
14823 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14824         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14825                 let contents = if o.result_ok {
14826                         let result = unsafe { o.contents.result };
14827                         unsafe { o.contents.result = core::ptr::null_mut() };
14828                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14829                 } else {
14830                         let err = unsafe { o.contents.err };
14831                         unsafe { o.contents.err = core::ptr::null_mut(); }
14832                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14833                 };
14834                 Self {
14835                         contents,
14836                         result_ok: o.result_ok,
14837                 }
14838         }
14839 }
14840 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14841         fn clone(&self) -> Self {
14842                 if self.result_ok {
14843                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14844                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14845                         } }
14846                 } else {
14847                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14848                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14849                         } }
14850                 }
14851         }
14852 }
14853 #[no_mangle]
14854 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14855 /// but with all dynamically-allocated buffers duplicated in new buffers.
14856 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14857 #[repr(C)]
14858 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14859 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14860         /// A pointer to the contents in the success state.
14861         /// Reading from this pointer when `result_ok` is not set is undefined.
14862         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14863         /// A pointer to the contents in the error state.
14864         /// Reading from this pointer when `result_ok` is set is undefined.
14865         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14866 }
14867 #[repr(C)]
14868 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14869 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14870 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14871 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14872         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14873         /// `err` or `result` depending on the state of `result_ok`.
14874         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14875         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14876         pub result_ok: bool,
14877 }
14878 #[no_mangle]
14879 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14880 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14881         CResult_QueryChannelRangeDecodeErrorZ {
14882                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14883                         result: Box::into_raw(Box::new(o)),
14884                 },
14885                 result_ok: true,
14886         }
14887 }
14888 #[no_mangle]
14889 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14890 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14891         CResult_QueryChannelRangeDecodeErrorZ {
14892                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14893                         err: Box::into_raw(Box::new(e)),
14894                 },
14895                 result_ok: false,
14896         }
14897 }
14898 /// Checks if the given object is currently in the success state
14899 #[no_mangle]
14900 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14901         o.result_ok
14902 }
14903 #[no_mangle]
14904 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14905 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14906 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14907         fn drop(&mut self) {
14908                 if self.result_ok {
14909                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14910                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14911                         }
14912                 } else {
14913                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14914                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14915                         }
14916                 }
14917         }
14918 }
14919 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14920         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14921                 let contents = if o.result_ok {
14922                         let result = unsafe { o.contents.result };
14923                         unsafe { o.contents.result = core::ptr::null_mut() };
14924                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14925                 } else {
14926                         let err = unsafe { o.contents.err };
14927                         unsafe { o.contents.err = core::ptr::null_mut(); }
14928                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14929                 };
14930                 Self {
14931                         contents,
14932                         result_ok: o.result_ok,
14933                 }
14934         }
14935 }
14936 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14937         fn clone(&self) -> Self {
14938                 if self.result_ok {
14939                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14940                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14941                         } }
14942                 } else {
14943                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14944                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14945                         } }
14946                 }
14947         }
14948 }
14949 #[no_mangle]
14950 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14951 /// but with all dynamically-allocated buffers duplicated in new buffers.
14952 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14953 #[repr(C)]
14954 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14955 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14956         /// A pointer to the contents in the success state.
14957         /// Reading from this pointer when `result_ok` is not set is undefined.
14958         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14959         /// A pointer to the contents in the error state.
14960         /// Reading from this pointer when `result_ok` is set is undefined.
14961         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14962 }
14963 #[repr(C)]
14964 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14965 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14966 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14967 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14968         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14969         /// `err` or `result` depending on the state of `result_ok`.
14970         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14971         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14972         pub result_ok: bool,
14973 }
14974 #[no_mangle]
14975 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14976 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14977         CResult_ReplyChannelRangeDecodeErrorZ {
14978                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14979                         result: Box::into_raw(Box::new(o)),
14980                 },
14981                 result_ok: true,
14982         }
14983 }
14984 #[no_mangle]
14985 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14986 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14987         CResult_ReplyChannelRangeDecodeErrorZ {
14988                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14989                         err: Box::into_raw(Box::new(e)),
14990                 },
14991                 result_ok: false,
14992         }
14993 }
14994 /// Checks if the given object is currently in the success state
14995 #[no_mangle]
14996 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
14997         o.result_ok
14998 }
14999 #[no_mangle]
15000 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15001 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15002 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15003         fn drop(&mut self) {
15004                 if self.result_ok {
15005                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15006                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15007                         }
15008                 } else {
15009                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15010                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15011                         }
15012                 }
15013         }
15014 }
15015 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15016         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15017                 let contents = if o.result_ok {
15018                         let result = unsafe { o.contents.result };
15019                         unsafe { o.contents.result = core::ptr::null_mut() };
15020                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15021                 } else {
15022                         let err = unsafe { o.contents.err };
15023                         unsafe { o.contents.err = core::ptr::null_mut(); }
15024                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15025                 };
15026                 Self {
15027                         contents,
15028                         result_ok: o.result_ok,
15029                 }
15030         }
15031 }
15032 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15033         fn clone(&self) -> Self {
15034                 if self.result_ok {
15035                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15036                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15037                         } }
15038                 } else {
15039                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15040                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15041                         } }
15042                 }
15043         }
15044 }
15045 #[no_mangle]
15046 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15047 /// but with all dynamically-allocated buffers duplicated in new buffers.
15048 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15049 #[repr(C)]
15050 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15051 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15052         /// A pointer to the contents in the success state.
15053         /// Reading from this pointer when `result_ok` is not set is undefined.
15054         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15055         /// A pointer to the contents in the error state.
15056         /// Reading from this pointer when `result_ok` is set is undefined.
15057         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15058 }
15059 #[repr(C)]
15060 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15061 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15062 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15063 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15064         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15065         /// `err` or `result` depending on the state of `result_ok`.
15066         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15067         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15068         pub result_ok: bool,
15069 }
15070 #[no_mangle]
15071 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15072 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15073         CResult_GossipTimestampFilterDecodeErrorZ {
15074                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15075                         result: Box::into_raw(Box::new(o)),
15076                 },
15077                 result_ok: true,
15078         }
15079 }
15080 #[no_mangle]
15081 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15082 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15083         CResult_GossipTimestampFilterDecodeErrorZ {
15084                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15085                         err: Box::into_raw(Box::new(e)),
15086                 },
15087                 result_ok: false,
15088         }
15089 }
15090 /// Checks if the given object is currently in the success state
15091 #[no_mangle]
15092 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15093         o.result_ok
15094 }
15095 #[no_mangle]
15096 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15097 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15098 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15099         fn drop(&mut self) {
15100                 if self.result_ok {
15101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15103                         }
15104                 } else {
15105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15107                         }
15108                 }
15109         }
15110 }
15111 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15112         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15113                 let contents = if o.result_ok {
15114                         let result = unsafe { o.contents.result };
15115                         unsafe { o.contents.result = core::ptr::null_mut() };
15116                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15117                 } else {
15118                         let err = unsafe { o.contents.err };
15119                         unsafe { o.contents.err = core::ptr::null_mut(); }
15120                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15121                 };
15122                 Self {
15123                         contents,
15124                         result_ok: o.result_ok,
15125                 }
15126         }
15127 }
15128 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15129         fn clone(&self) -> Self {
15130                 if self.result_ok {
15131                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15132                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15133                         } }
15134                 } else {
15135                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15136                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15137                         } }
15138                 }
15139         }
15140 }
15141 #[no_mangle]
15142 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15143 /// but with all dynamically-allocated buffers duplicated in new buffers.
15144 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15145 #[repr(C)]
15146 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15147 /// This corresponds to std::vector in C++
15148 pub struct CVec_PhantomRouteHintsZ {
15149         /// The elements in the array.
15150         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15151         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15152         /// The number of elements pointed to by `data`.
15153         pub datalen: usize
15154 }
15155 impl CVec_PhantomRouteHintsZ {
15156         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15157                 if self.datalen == 0 { return Vec::new(); }
15158                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15159                 self.data = core::ptr::null_mut();
15160                 self.datalen = 0;
15161                 ret
15162         }
15163         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15164                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15165         }
15166 }
15167 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15168         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15169                 let datalen = v.len();
15170                 let data = Box::into_raw(v.into_boxed_slice());
15171                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15172         }
15173 }
15174 #[no_mangle]
15175 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15176 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15177 impl Drop for CVec_PhantomRouteHintsZ {
15178         fn drop(&mut self) {
15179                 if self.datalen == 0 { return; }
15180                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15181         }
15182 }
15183 #[repr(C)]
15184 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15185 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15186         /// A pointer to the contents in the success state.
15187         /// Reading from this pointer when `result_ok` is not set is undefined.
15188         pub result: *mut crate::lightning_invoice::Invoice,
15189         /// A pointer to the contents in the error state.
15190         /// Reading from this pointer when `result_ok` is set is undefined.
15191         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15192 }
15193 #[repr(C)]
15194 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15197 pub struct CResult_InvoiceSignOrCreationErrorZ {
15198         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15199         /// `err` or `result` depending on the state of `result_ok`.
15200         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15201         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15202         pub result_ok: bool,
15203 }
15204 #[no_mangle]
15205 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15206 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15207         CResult_InvoiceSignOrCreationErrorZ {
15208                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15209                         result: Box::into_raw(Box::new(o)),
15210                 },
15211                 result_ok: true,
15212         }
15213 }
15214 #[no_mangle]
15215 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15216 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15217         CResult_InvoiceSignOrCreationErrorZ {
15218                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15219                         err: Box::into_raw(Box::new(e)),
15220                 },
15221                 result_ok: false,
15222         }
15223 }
15224 /// Checks if the given object is currently in the success state
15225 #[no_mangle]
15226 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15227         o.result_ok
15228 }
15229 #[no_mangle]
15230 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15231 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15232 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15233         fn drop(&mut self) {
15234                 if self.result_ok {
15235                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15236                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15237                         }
15238                 } else {
15239                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15240                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15241                         }
15242                 }
15243         }
15244 }
15245 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15246         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15247                 let contents = if o.result_ok {
15248                         let result = unsafe { o.contents.result };
15249                         unsafe { o.contents.result = core::ptr::null_mut() };
15250                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15251                 } else {
15252                         let err = unsafe { o.contents.err };
15253                         unsafe { o.contents.err = core::ptr::null_mut(); }
15254                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15255                 };
15256                 Self {
15257                         contents,
15258                         result_ok: o.result_ok,
15259                 }
15260         }
15261 }
15262 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15263         fn clone(&self) -> Self {
15264                 if self.result_ok {
15265                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15266                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15267                         } }
15268                 } else {
15269                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15270                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15271                         } }
15272                 }
15273         }
15274 }
15275 #[no_mangle]
15276 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15277 /// but with all dynamically-allocated buffers duplicated in new buffers.
15278 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15279 #[repr(C)]
15280 /// An enum which can either contain a crate::lightning::chain::Filter or not
15281 pub enum COption_FilterZ {
15282         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15283         Some(crate::lightning::chain::Filter),
15284         /// When we're in this state, this COption_FilterZ contains nothing
15285         None
15286 }
15287 impl COption_FilterZ {
15288         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15289                 if let Self::None = self { false } else { true }
15290         }
15291         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15292                 !self.is_some()
15293         }
15294         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15295                 if let Self::Some(v) = self { v } else { unreachable!() }
15296         }
15297 }
15298 #[no_mangle]
15299 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15300 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15301         COption_FilterZ::Some(o)
15302 }
15303 #[no_mangle]
15304 /// Constructs a new COption_FilterZ containing nothing
15305 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15306         COption_FilterZ::None
15307 }
15308 #[no_mangle]
15309 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15310 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15311 #[repr(C)]
15312 /// The contents of CResult_LockedChannelMonitorNoneZ
15313 pub union CResult_LockedChannelMonitorNoneZPtr {
15314         /// A pointer to the contents in the success state.
15315         /// Reading from this pointer when `result_ok` is not set is undefined.
15316         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15317         /// Note that this value is always NULL, as there are no contents in the Err variant
15318         pub err: *mut core::ffi::c_void,
15319 }
15320 #[repr(C)]
15321 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_LockedChannelMonitorNoneZ {
15325         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15326         /// `err` or `result` depending on the state of `result_ok`.
15327         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15328         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15329         pub result_ok: bool,
15330 }
15331 #[no_mangle]
15332 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15333 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15334         CResult_LockedChannelMonitorNoneZ {
15335                 contents: CResult_LockedChannelMonitorNoneZPtr {
15336                         result: Box::into_raw(Box::new(o)),
15337                 },
15338                 result_ok: true,
15339         }
15340 }
15341 #[no_mangle]
15342 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15343 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15344         CResult_LockedChannelMonitorNoneZ {
15345                 contents: CResult_LockedChannelMonitorNoneZPtr {
15346                         err: core::ptr::null_mut(),
15347                 },
15348                 result_ok: false,
15349         }
15350 }
15351 /// Checks if the given object is currently in the success state
15352 #[no_mangle]
15353 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15354         o.result_ok
15355 }
15356 #[no_mangle]
15357 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15358 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15359 impl Drop for CResult_LockedChannelMonitorNoneZ {
15360         fn drop(&mut self) {
15361                 if self.result_ok {
15362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15364                         }
15365                 } else {
15366                 }
15367         }
15368 }
15369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15370         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15371                 let contents = if o.result_ok {
15372                         let result = unsafe { o.contents.result };
15373                         unsafe { o.contents.result = core::ptr::null_mut() };
15374                         CResult_LockedChannelMonitorNoneZPtr { result }
15375                 } else {
15376                         let _ = unsafe { Box::from_raw(o.contents.err) };
15377                         o.contents.err = core::ptr::null_mut();
15378                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15379                 };
15380                 Self {
15381                         contents,
15382                         result_ok: o.result_ok,
15383                 }
15384         }
15385 }
15386 #[repr(C)]
15387 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15388 /// This corresponds to std::vector in C++
15389 pub struct CVec_OutPointZ {
15390         /// The elements in the array.
15391         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15392         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15393         /// The number of elements pointed to by `data`.
15394         pub datalen: usize
15395 }
15396 impl CVec_OutPointZ {
15397         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15398                 if self.datalen == 0 { return Vec::new(); }
15399                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15400                 self.data = core::ptr::null_mut();
15401                 self.datalen = 0;
15402                 ret
15403         }
15404         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15405                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15406         }
15407 }
15408 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15409         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15410                 let datalen = v.len();
15411                 let data = Box::into_raw(v.into_boxed_slice());
15412                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15413         }
15414 }
15415 #[no_mangle]
15416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15417 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15418 impl Drop for CVec_OutPointZ {
15419         fn drop(&mut self) {
15420                 if self.datalen == 0 { return; }
15421                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15422         }
15423 }
15424 impl Clone for CVec_OutPointZ {
15425         fn clone(&self) -> Self {
15426                 let mut res = Vec::new();
15427                 if self.datalen == 0 { return Self::from(res); }
15428                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15429                 Self::from(res)
15430         }
15431 }