eb22b5ab20719509d58fc477e5876ee2807a4a79
[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 /// A dynamically-allocated array of u64s of arbitrary size.
2353 /// This corresponds to std::vector in C++
2354 pub struct CVec_u64Z {
2355         /// The elements in the array.
2356         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2357         pub data: *mut u64,
2358         /// The number of elements pointed to by `data`.
2359         pub datalen: usize
2360 }
2361 impl CVec_u64Z {
2362         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2363                 if self.datalen == 0 { return Vec::new(); }
2364                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2365                 self.data = core::ptr::null_mut();
2366                 self.datalen = 0;
2367                 ret
2368         }
2369         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2370                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2371         }
2372 }
2373 impl From<Vec<u64>> for CVec_u64Z {
2374         fn from(v: Vec<u64>) -> Self {
2375                 let datalen = v.len();
2376                 let data = Box::into_raw(v.into_boxed_slice());
2377                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2378         }
2379 }
2380 #[no_mangle]
2381 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2382 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2383 impl Drop for CVec_u64Z {
2384         fn drop(&mut self) {
2385                 if self.datalen == 0 { return; }
2386                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2387         }
2388 }
2389 impl Clone for CVec_u64Z {
2390         fn clone(&self) -> Self {
2391                 let mut res = Vec::new();
2392                 if self.datalen == 0 { return Self::from(res); }
2393                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2394                 Self::from(res)
2395         }
2396 }
2397 #[repr(C)]
2398 /// The contents of CResult_PaymentParametersDecodeErrorZ
2399 pub union CResult_PaymentParametersDecodeErrorZPtr {
2400         /// A pointer to the contents in the success state.
2401         /// Reading from this pointer when `result_ok` is not set is undefined.
2402         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2403         /// A pointer to the contents in the error state.
2404         /// Reading from this pointer when `result_ok` is set is undefined.
2405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2406 }
2407 #[repr(C)]
2408 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2409 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2411 pub struct CResult_PaymentParametersDecodeErrorZ {
2412         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2413         /// `err` or `result` depending on the state of `result_ok`.
2414         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2415         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2416         pub result_ok: bool,
2417 }
2418 #[no_mangle]
2419 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2420 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2421         CResult_PaymentParametersDecodeErrorZ {
2422                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2423                         result: Box::into_raw(Box::new(o)),
2424                 },
2425                 result_ok: true,
2426         }
2427 }
2428 #[no_mangle]
2429 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2430 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2431         CResult_PaymentParametersDecodeErrorZ {
2432                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2433                         err: Box::into_raw(Box::new(e)),
2434                 },
2435                 result_ok: false,
2436         }
2437 }
2438 /// Checks if the given object is currently in the success state
2439 #[no_mangle]
2440 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2441         o.result_ok
2442 }
2443 #[no_mangle]
2444 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2445 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2446 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2447         fn drop(&mut self) {
2448                 if self.result_ok {
2449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2451                         }
2452                 } else {
2453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2455                         }
2456                 }
2457         }
2458 }
2459 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2461                 let contents = if o.result_ok {
2462                         let result = unsafe { o.contents.result };
2463                         unsafe { o.contents.result = core::ptr::null_mut() };
2464                         CResult_PaymentParametersDecodeErrorZPtr { result }
2465                 } else {
2466                         let err = unsafe { o.contents.err };
2467                         unsafe { o.contents.err = core::ptr::null_mut(); }
2468                         CResult_PaymentParametersDecodeErrorZPtr { err }
2469                 };
2470                 Self {
2471                         contents,
2472                         result_ok: o.result_ok,
2473                 }
2474         }
2475 }
2476 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2477         fn clone(&self) -> Self {
2478                 if self.result_ok {
2479                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2480                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2481                         } }
2482                 } else {
2483                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2484                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2485                         } }
2486                 }
2487         }
2488 }
2489 #[no_mangle]
2490 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2491 /// but with all dynamically-allocated buffers duplicated in new buffers.
2492 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2493 #[repr(C)]
2494 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2495 /// This corresponds to std::vector in C++
2496 pub struct CVec_RouteHintHopZ {
2497         /// The elements in the array.
2498         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2499         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2500         /// The number of elements pointed to by `data`.
2501         pub datalen: usize
2502 }
2503 impl CVec_RouteHintHopZ {
2504         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2505                 if self.datalen == 0 { return Vec::new(); }
2506                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2507                 self.data = core::ptr::null_mut();
2508                 self.datalen = 0;
2509                 ret
2510         }
2511         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2512                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2513         }
2514 }
2515 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2516         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2517                 let datalen = v.len();
2518                 let data = Box::into_raw(v.into_boxed_slice());
2519                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2520         }
2521 }
2522 #[no_mangle]
2523 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2524 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2525 impl Drop for CVec_RouteHintHopZ {
2526         fn drop(&mut self) {
2527                 if self.datalen == 0 { return; }
2528                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2529         }
2530 }
2531 impl Clone for CVec_RouteHintHopZ {
2532         fn clone(&self) -> Self {
2533                 let mut res = Vec::new();
2534                 if self.datalen == 0 { return Self::from(res); }
2535                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2536                 Self::from(res)
2537         }
2538 }
2539 #[repr(C)]
2540 /// The contents of CResult_RouteHintDecodeErrorZ
2541 pub union CResult_RouteHintDecodeErrorZPtr {
2542         /// A pointer to the contents in the success state.
2543         /// Reading from this pointer when `result_ok` is not set is undefined.
2544         pub result: *mut crate::lightning::routing::router::RouteHint,
2545         /// A pointer to the contents in the error state.
2546         /// Reading from this pointer when `result_ok` is set is undefined.
2547         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2548 }
2549 #[repr(C)]
2550 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2551 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2552 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2553 pub struct CResult_RouteHintDecodeErrorZ {
2554         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2555         /// `err` or `result` depending on the state of `result_ok`.
2556         pub contents: CResult_RouteHintDecodeErrorZPtr,
2557         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2558         pub result_ok: bool,
2559 }
2560 #[no_mangle]
2561 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2562 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2563         CResult_RouteHintDecodeErrorZ {
2564                 contents: CResult_RouteHintDecodeErrorZPtr {
2565                         result: Box::into_raw(Box::new(o)),
2566                 },
2567                 result_ok: true,
2568         }
2569 }
2570 #[no_mangle]
2571 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2572 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2573         CResult_RouteHintDecodeErrorZ {
2574                 contents: CResult_RouteHintDecodeErrorZPtr {
2575                         err: Box::into_raw(Box::new(e)),
2576                 },
2577                 result_ok: false,
2578         }
2579 }
2580 /// Checks if the given object is currently in the success state
2581 #[no_mangle]
2582 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2583         o.result_ok
2584 }
2585 #[no_mangle]
2586 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2587 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2588 impl Drop for CResult_RouteHintDecodeErrorZ {
2589         fn drop(&mut self) {
2590                 if self.result_ok {
2591                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2592                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2593                         }
2594                 } else {
2595                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2596                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2597                         }
2598                 }
2599         }
2600 }
2601 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2602         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2603                 let contents = if o.result_ok {
2604                         let result = unsafe { o.contents.result };
2605                         unsafe { o.contents.result = core::ptr::null_mut() };
2606                         CResult_RouteHintDecodeErrorZPtr { result }
2607                 } else {
2608                         let err = unsafe { o.contents.err };
2609                         unsafe { o.contents.err = core::ptr::null_mut(); }
2610                         CResult_RouteHintDecodeErrorZPtr { err }
2611                 };
2612                 Self {
2613                         contents,
2614                         result_ok: o.result_ok,
2615                 }
2616         }
2617 }
2618 impl Clone for CResult_RouteHintDecodeErrorZ {
2619         fn clone(&self) -> Self {
2620                 if self.result_ok {
2621                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2622                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2623                         } }
2624                 } else {
2625                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2626                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2627                         } }
2628                 }
2629         }
2630 }
2631 #[no_mangle]
2632 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2633 /// but with all dynamically-allocated buffers duplicated in new buffers.
2634 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2635 #[repr(C)]
2636 /// The contents of CResult_RouteHintHopDecodeErrorZ
2637 pub union CResult_RouteHintHopDecodeErrorZPtr {
2638         /// A pointer to the contents in the success state.
2639         /// Reading from this pointer when `result_ok` is not set is undefined.
2640         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2641         /// A pointer to the contents in the error state.
2642         /// Reading from this pointer when `result_ok` is set is undefined.
2643         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2644 }
2645 #[repr(C)]
2646 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2647 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2648 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2649 pub struct CResult_RouteHintHopDecodeErrorZ {
2650         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2651         /// `err` or `result` depending on the state of `result_ok`.
2652         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2653         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2654         pub result_ok: bool,
2655 }
2656 #[no_mangle]
2657 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2658 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2659         CResult_RouteHintHopDecodeErrorZ {
2660                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2661                         result: Box::into_raw(Box::new(o)),
2662                 },
2663                 result_ok: true,
2664         }
2665 }
2666 #[no_mangle]
2667 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2668 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2669         CResult_RouteHintHopDecodeErrorZ {
2670                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2671                         err: Box::into_raw(Box::new(e)),
2672                 },
2673                 result_ok: false,
2674         }
2675 }
2676 /// Checks if the given object is currently in the success state
2677 #[no_mangle]
2678 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2679         o.result_ok
2680 }
2681 #[no_mangle]
2682 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2683 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2684 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2685         fn drop(&mut self) {
2686                 if self.result_ok {
2687                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2688                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2689                         }
2690                 } else {
2691                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2692                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2693                         }
2694                 }
2695         }
2696 }
2697 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2698         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2699                 let contents = if o.result_ok {
2700                         let result = unsafe { o.contents.result };
2701                         unsafe { o.contents.result = core::ptr::null_mut() };
2702                         CResult_RouteHintHopDecodeErrorZPtr { result }
2703                 } else {
2704                         let err = unsafe { o.contents.err };
2705                         unsafe { o.contents.err = core::ptr::null_mut(); }
2706                         CResult_RouteHintHopDecodeErrorZPtr { err }
2707                 };
2708                 Self {
2709                         contents,
2710                         result_ok: o.result_ok,
2711                 }
2712         }
2713 }
2714 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2715         fn clone(&self) -> Self {
2716                 if self.result_ok {
2717                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2718                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2719                         } }
2720                 } else {
2721                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2722                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2723                         } }
2724                 }
2725         }
2726 }
2727 #[no_mangle]
2728 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2729 /// but with all dynamically-allocated buffers duplicated in new buffers.
2730 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2731 #[repr(C)]
2732 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2733 /// This corresponds to std::vector in C++
2734 pub struct CVec_ChannelDetailsZ {
2735         /// The elements in the array.
2736         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2737         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2738         /// The number of elements pointed to by `data`.
2739         pub datalen: usize
2740 }
2741 impl CVec_ChannelDetailsZ {
2742         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2743                 if self.datalen == 0 { return Vec::new(); }
2744                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2745                 self.data = core::ptr::null_mut();
2746                 self.datalen = 0;
2747                 ret
2748         }
2749         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2750                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2751         }
2752 }
2753 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2754         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2755                 let datalen = v.len();
2756                 let data = Box::into_raw(v.into_boxed_slice());
2757                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2758         }
2759 }
2760 #[no_mangle]
2761 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2762 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2763 impl Drop for CVec_ChannelDetailsZ {
2764         fn drop(&mut self) {
2765                 if self.datalen == 0 { return; }
2766                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2767         }
2768 }
2769 impl Clone for CVec_ChannelDetailsZ {
2770         fn clone(&self) -> Self {
2771                 let mut res = Vec::new();
2772                 if self.datalen == 0 { return Self::from(res); }
2773                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2774                 Self::from(res)
2775         }
2776 }
2777 #[repr(C)]
2778 /// The contents of CResult_RouteLightningErrorZ
2779 pub union CResult_RouteLightningErrorZPtr {
2780         /// A pointer to the contents in the success state.
2781         /// Reading from this pointer when `result_ok` is not set is undefined.
2782         pub result: *mut crate::lightning::routing::router::Route,
2783         /// A pointer to the contents in the error state.
2784         /// Reading from this pointer when `result_ok` is set is undefined.
2785         pub err: *mut crate::lightning::ln::msgs::LightningError,
2786 }
2787 #[repr(C)]
2788 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2789 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2791 pub struct CResult_RouteLightningErrorZ {
2792         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2793         /// `err` or `result` depending on the state of `result_ok`.
2794         pub contents: CResult_RouteLightningErrorZPtr,
2795         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2796         pub result_ok: bool,
2797 }
2798 #[no_mangle]
2799 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2800 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2801         CResult_RouteLightningErrorZ {
2802                 contents: CResult_RouteLightningErrorZPtr {
2803                         result: Box::into_raw(Box::new(o)),
2804                 },
2805                 result_ok: true,
2806         }
2807 }
2808 #[no_mangle]
2809 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2810 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2811         CResult_RouteLightningErrorZ {
2812                 contents: CResult_RouteLightningErrorZPtr {
2813                         err: Box::into_raw(Box::new(e)),
2814                 },
2815                 result_ok: false,
2816         }
2817 }
2818 /// Checks if the given object is currently in the success state
2819 #[no_mangle]
2820 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2821         o.result_ok
2822 }
2823 #[no_mangle]
2824 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2825 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2826 impl Drop for CResult_RouteLightningErrorZ {
2827         fn drop(&mut self) {
2828                 if self.result_ok {
2829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2831                         }
2832                 } else {
2833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2835                         }
2836                 }
2837         }
2838 }
2839 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2840         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2841                 let contents = if o.result_ok {
2842                         let result = unsafe { o.contents.result };
2843                         unsafe { o.contents.result = core::ptr::null_mut() };
2844                         CResult_RouteLightningErrorZPtr { result }
2845                 } else {
2846                         let err = unsafe { o.contents.err };
2847                         unsafe { o.contents.err = core::ptr::null_mut(); }
2848                         CResult_RouteLightningErrorZPtr { err }
2849                 };
2850                 Self {
2851                         contents,
2852                         result_ok: o.result_ok,
2853                 }
2854         }
2855 }
2856 impl Clone for CResult_RouteLightningErrorZ {
2857         fn clone(&self) -> Self {
2858                 if self.result_ok {
2859                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2860                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2861                         } }
2862                 } else {
2863                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2864                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2865                         } }
2866                 }
2867         }
2868 }
2869 #[no_mangle]
2870 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2871 /// but with all dynamically-allocated buffers duplicated in new buffers.
2872 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2873 #[repr(C)]
2874 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2875 /// This corresponds to std::vector in C++
2876 pub struct CVec_PublicKeyZ {
2877         /// The elements in the array.
2878         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2879         pub data: *mut crate::c_types::PublicKey,
2880         /// The number of elements pointed to by `data`.
2881         pub datalen: usize
2882 }
2883 impl CVec_PublicKeyZ {
2884         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
2885                 if self.datalen == 0 { return Vec::new(); }
2886                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2887                 self.data = core::ptr::null_mut();
2888                 self.datalen = 0;
2889                 ret
2890         }
2891         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
2892                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2893         }
2894 }
2895 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
2896         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
2897                 let datalen = v.len();
2898                 let data = Box::into_raw(v.into_boxed_slice());
2899                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2900         }
2901 }
2902 #[no_mangle]
2903 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2904 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
2905 impl Drop for CVec_PublicKeyZ {
2906         fn drop(&mut self) {
2907                 if self.datalen == 0 { return; }
2908                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2909         }
2910 }
2911 impl Clone for CVec_PublicKeyZ {
2912         fn clone(&self) -> Self {
2913                 let mut res = Vec::new();
2914                 if self.datalen == 0 { return Self::from(res); }
2915                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2916                 Self::from(res)
2917         }
2918 }
2919 #[repr(C)]
2920 /// The contents of CResult_PaymentPurposeDecodeErrorZ
2921 pub union CResult_PaymentPurposeDecodeErrorZPtr {
2922         /// A pointer to the contents in the success state.
2923         /// Reading from this pointer when `result_ok` is not set is undefined.
2924         pub result: *mut crate::lightning::util::events::PaymentPurpose,
2925         /// A pointer to the contents in the error state.
2926         /// Reading from this pointer when `result_ok` is set is undefined.
2927         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2928 }
2929 #[repr(C)]
2930 /// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2931 /// containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2932 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2933 pub struct CResult_PaymentPurposeDecodeErrorZ {
2934         /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2935         /// `err` or `result` depending on the state of `result_ok`.
2936         pub contents: CResult_PaymentPurposeDecodeErrorZPtr,
2937         /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2938         pub result_ok: bool,
2939 }
2940 #[no_mangle]
2941 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
2942 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::util::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ {
2943         CResult_PaymentPurposeDecodeErrorZ {
2944                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2945                         result: Box::into_raw(Box::new(o)),
2946                 },
2947                 result_ok: true,
2948         }
2949 }
2950 #[no_mangle]
2951 /// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
2952 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ {
2953         CResult_PaymentPurposeDecodeErrorZ {
2954                 contents: CResult_PaymentPurposeDecodeErrorZPtr {
2955                         err: Box::into_raw(Box::new(e)),
2956                 },
2957                 result_ok: false,
2958         }
2959 }
2960 /// Checks if the given object is currently in the success state
2961 #[no_mangle]
2962 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool {
2963         o.result_ok
2964 }
2965 #[no_mangle]
2966 /// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
2967 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { }
2968 impl Drop for CResult_PaymentPurposeDecodeErrorZ {
2969         fn drop(&mut self) {
2970                 if self.result_ok {
2971                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2972                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2973                         }
2974                 } else {
2975                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2976                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2977                         }
2978                 }
2979         }
2980 }
2981 impl From<crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentPurposeDecodeErrorZ {
2982         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::events::PaymentPurpose, crate::lightning::ln::msgs::DecodeError>) -> Self {
2983                 let contents = if o.result_ok {
2984                         let result = unsafe { o.contents.result };
2985                         unsafe { o.contents.result = core::ptr::null_mut() };
2986                         CResult_PaymentPurposeDecodeErrorZPtr { result }
2987                 } else {
2988                         let err = unsafe { o.contents.err };
2989                         unsafe { o.contents.err = core::ptr::null_mut(); }
2990                         CResult_PaymentPurposeDecodeErrorZPtr { err }
2991                 };
2992                 Self {
2993                         contents,
2994                         result_ok: o.result_ok,
2995                 }
2996         }
2997 }
2998 impl Clone for CResult_PaymentPurposeDecodeErrorZ {
2999         fn clone(&self) -> Self {
3000                 if self.result_ok {
3001                         Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3002                                 result: Box::into_raw(Box::new(<crate::lightning::util::events::PaymentPurpose>::clone(unsafe { &*self.contents.result })))
3003                         } }
3004                 } else {
3005                         Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr {
3006                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3007                         } }
3008                 }
3009         }
3010 }
3011 #[no_mangle]
3012 /// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
3013 /// but with all dynamically-allocated buffers duplicated in new buffers.
3014 pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) }
3015 #[repr(C)]
3016 #[derive(Clone)]
3017 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3018 pub enum COption_ClosureReasonZ {
3019         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3020         Some(crate::lightning::util::events::ClosureReason),
3021         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3022         None
3023 }
3024 impl COption_ClosureReasonZ {
3025         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3026                 if let Self::None = self { false } else { true }
3027         }
3028         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3029                 !self.is_some()
3030         }
3031         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3032                 if let Self::Some(v) = self { v } else { unreachable!() }
3033         }
3034 }
3035 #[no_mangle]
3036 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3037 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3038         COption_ClosureReasonZ::Some(o)
3039 }
3040 #[no_mangle]
3041 /// Constructs a new COption_ClosureReasonZ containing nothing
3042 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3043         COption_ClosureReasonZ::None
3044 }
3045 #[no_mangle]
3046 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3047 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3048 #[no_mangle]
3049 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3050 /// but with all dynamically-allocated buffers duplicated in new buffers.
3051 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3052 #[repr(C)]
3053 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3054 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3055         /// A pointer to the contents in the success state.
3056         /// Reading from this pointer when `result_ok` is not set is undefined.
3057         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3058         /// A pointer to the contents in the error state.
3059         /// Reading from this pointer when `result_ok` is set is undefined.
3060         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3061 }
3062 #[repr(C)]
3063 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3064 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3066 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3067         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3068         /// `err` or `result` depending on the state of `result_ok`.
3069         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3070         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3071         pub result_ok: bool,
3072 }
3073 #[no_mangle]
3074 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3075 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3076         CResult_COption_ClosureReasonZDecodeErrorZ {
3077                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3078                         result: Box::into_raw(Box::new(o)),
3079                 },
3080                 result_ok: true,
3081         }
3082 }
3083 #[no_mangle]
3084 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3085 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3086         CResult_COption_ClosureReasonZDecodeErrorZ {
3087                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3088                         err: Box::into_raw(Box::new(e)),
3089                 },
3090                 result_ok: false,
3091         }
3092 }
3093 /// Checks if the given object is currently in the success state
3094 #[no_mangle]
3095 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3096         o.result_ok
3097 }
3098 #[no_mangle]
3099 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3100 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3101 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3102         fn drop(&mut self) {
3103                 if self.result_ok {
3104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3106                         }
3107                 } else {
3108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3110                         }
3111                 }
3112         }
3113 }
3114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3115         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3116                 let contents = if o.result_ok {
3117                         let result = unsafe { o.contents.result };
3118                         unsafe { o.contents.result = core::ptr::null_mut() };
3119                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3120                 } else {
3121                         let err = unsafe { o.contents.err };
3122                         unsafe { o.contents.err = core::ptr::null_mut(); }
3123                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3124                 };
3125                 Self {
3126                         contents,
3127                         result_ok: o.result_ok,
3128                 }
3129         }
3130 }
3131 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3132         fn clone(&self) -> Self {
3133                 if self.result_ok {
3134                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3135                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3136                         } }
3137                 } else {
3138                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3139                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3140                         } }
3141                 }
3142         }
3143 }
3144 #[no_mangle]
3145 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3146 /// but with all dynamically-allocated buffers duplicated in new buffers.
3147 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3148 #[repr(C)]
3149 #[derive(Clone)]
3150 /// An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
3151 pub enum COption_HTLCDestinationZ {
3152         /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
3153         Some(crate::lightning::util::events::HTLCDestination),
3154         /// When we're in this state, this COption_HTLCDestinationZ contains nothing
3155         None
3156 }
3157 impl COption_HTLCDestinationZ {
3158         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3159                 if let Self::None = self { false } else { true }
3160         }
3161         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3162                 !self.is_some()
3163         }
3164         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::HTLCDestination {
3165                 if let Self::Some(v) = self { v } else { unreachable!() }
3166         }
3167 }
3168 #[no_mangle]
3169 /// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
3170 pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::util::events::HTLCDestination) -> COption_HTLCDestinationZ {
3171         COption_HTLCDestinationZ::Some(o)
3172 }
3173 #[no_mangle]
3174 /// Constructs a new COption_HTLCDestinationZ containing nothing
3175 pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ {
3176         COption_HTLCDestinationZ::None
3177 }
3178 #[no_mangle]
3179 /// Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
3180 pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { }
3181 #[no_mangle]
3182 /// Creates a new COption_HTLCDestinationZ which has the same data as `orig`
3183 /// but with all dynamically-allocated buffers duplicated in new buffers.
3184 pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) }
3185 #[repr(C)]
3186 /// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
3187 pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3188         /// A pointer to the contents in the success state.
3189         /// Reading from this pointer when `result_ok` is not set is undefined.
3190         pub result: *mut crate::c_types::derived::COption_HTLCDestinationZ,
3191         /// A pointer to the contents in the error state.
3192         /// Reading from this pointer when `result_ok` is set is undefined.
3193         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3194 }
3195 #[repr(C)]
3196 /// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
3197 /// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3198 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3199 pub struct CResult_COption_HTLCDestinationZDecodeErrorZ {
3200         /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
3201         /// `err` or `result` depending on the state of `result_ok`.
3202         pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr,
3203         /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
3204         pub result_ok: bool,
3205 }
3206 #[no_mangle]
3207 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
3208 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3209         CResult_COption_HTLCDestinationZDecodeErrorZ {
3210                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3211                         result: Box::into_raw(Box::new(o)),
3212                 },
3213                 result_ok: true,
3214         }
3215 }
3216 #[no_mangle]
3217 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
3218 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ {
3219         CResult_COption_HTLCDestinationZDecodeErrorZ {
3220                 contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3221                         err: Box::into_raw(Box::new(e)),
3222                 },
3223                 result_ok: false,
3224         }
3225 }
3226 /// Checks if the given object is currently in the success state
3227 #[no_mangle]
3228 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool {
3229         o.result_ok
3230 }
3231 #[no_mangle]
3232 /// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
3233 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { }
3234 impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ {
3235         fn drop(&mut self) {
3236                 if self.result_ok {
3237                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3238                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3239                         }
3240                 } else {
3241                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3242                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3243                         }
3244                 }
3245         }
3246 }
3247 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_HTLCDestinationZDecodeErrorZ {
3248         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_HTLCDestinationZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3249                 let contents = if o.result_ok {
3250                         let result = unsafe { o.contents.result };
3251                         unsafe { o.contents.result = core::ptr::null_mut() };
3252                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { result }
3253                 } else {
3254                         let err = unsafe { o.contents.err };
3255                         unsafe { o.contents.err = core::ptr::null_mut(); }
3256                         CResult_COption_HTLCDestinationZDecodeErrorZPtr { err }
3257                 };
3258                 Self {
3259                         contents,
3260                         result_ok: o.result_ok,
3261                 }
3262         }
3263 }
3264 impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ {
3265         fn clone(&self) -> Self {
3266                 if self.result_ok {
3267                         Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3268                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_HTLCDestinationZ>::clone(unsafe { &*self.contents.result })))
3269                         } }
3270                 } else {
3271                         Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr {
3272                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3273                         } }
3274                 }
3275         }
3276 }
3277 #[no_mangle]
3278 /// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
3279 /// but with all dynamically-allocated buffers duplicated in new buffers.
3280 pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) }
3281 #[repr(C)]
3282 #[derive(Clone)]
3283 /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
3284 pub enum COption_NetworkUpdateZ {
3285         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
3286         Some(crate::lightning::routing::gossip::NetworkUpdate),
3287         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3288         None
3289 }
3290 impl COption_NetworkUpdateZ {
3291         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3292                 if let Self::None = self { false } else { true }
3293         }
3294         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3295                 !self.is_some()
3296         }
3297         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate {
3298                 if let Self::Some(v) = self { v } else { unreachable!() }
3299         }
3300 }
3301 #[no_mangle]
3302 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
3303 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ {
3304         COption_NetworkUpdateZ::Some(o)
3305 }
3306 #[no_mangle]
3307 /// Constructs a new COption_NetworkUpdateZ containing nothing
3308 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3309         COption_NetworkUpdateZ::None
3310 }
3311 #[no_mangle]
3312 /// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
3313 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3314 #[no_mangle]
3315 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3316 /// but with all dynamically-allocated buffers duplicated in new buffers.
3317 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3318 #[repr(C)]
3319 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3320 /// This corresponds to std::vector in C++
3321 pub struct CVec_SpendableOutputDescriptorZ {
3322         /// The elements in the array.
3323         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3324         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3325         /// The number of elements pointed to by `data`.
3326         pub datalen: usize
3327 }
3328 impl CVec_SpendableOutputDescriptorZ {
3329         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3330                 if self.datalen == 0 { return Vec::new(); }
3331                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3332                 self.data = core::ptr::null_mut();
3333                 self.datalen = 0;
3334                 ret
3335         }
3336         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3337                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3338         }
3339 }
3340 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3341         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3342                 let datalen = v.len();
3343                 let data = Box::into_raw(v.into_boxed_slice());
3344                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3345         }
3346 }
3347 #[no_mangle]
3348 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3349 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3350 impl Drop for CVec_SpendableOutputDescriptorZ {
3351         fn drop(&mut self) {
3352                 if self.datalen == 0 { return; }
3353                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3354         }
3355 }
3356 impl Clone for CVec_SpendableOutputDescriptorZ {
3357         fn clone(&self) -> Self {
3358                 let mut res = Vec::new();
3359                 if self.datalen == 0 { return Self::from(res); }
3360                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3361                 Self::from(res)
3362         }
3363 }
3364 #[repr(C)]
3365 #[derive(Clone)]
3366 /// An enum which can either contain a crate::lightning::util::events::Event or not
3367 pub enum COption_EventZ {
3368         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3369         Some(crate::lightning::util::events::Event),
3370         /// When we're in this state, this COption_EventZ contains nothing
3371         None
3372 }
3373 impl COption_EventZ {
3374         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3375                 if let Self::None = self { false } else { true }
3376         }
3377         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3378                 !self.is_some()
3379         }
3380         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3381                 if let Self::Some(v) = self { v } else { unreachable!() }
3382         }
3383 }
3384 #[no_mangle]
3385 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3386 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3387         COption_EventZ::Some(o)
3388 }
3389 #[no_mangle]
3390 /// Constructs a new COption_EventZ containing nothing
3391 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3392         COption_EventZ::None
3393 }
3394 #[no_mangle]
3395 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3396 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3397 #[no_mangle]
3398 /// Creates a new COption_EventZ which has the same data as `orig`
3399 /// but with all dynamically-allocated buffers duplicated in new buffers.
3400 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3401 #[repr(C)]
3402 /// The contents of CResult_COption_EventZDecodeErrorZ
3403 pub union CResult_COption_EventZDecodeErrorZPtr {
3404         /// A pointer to the contents in the success state.
3405         /// Reading from this pointer when `result_ok` is not set is undefined.
3406         pub result: *mut crate::c_types::derived::COption_EventZ,
3407         /// A pointer to the contents in the error state.
3408         /// Reading from this pointer when `result_ok` is set is undefined.
3409         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3410 }
3411 #[repr(C)]
3412 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3413 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3414 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3415 pub struct CResult_COption_EventZDecodeErrorZ {
3416         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3417         /// `err` or `result` depending on the state of `result_ok`.
3418         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3419         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3420         pub result_ok: bool,
3421 }
3422 #[no_mangle]
3423 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3424 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3425         CResult_COption_EventZDecodeErrorZ {
3426                 contents: CResult_COption_EventZDecodeErrorZPtr {
3427                         result: Box::into_raw(Box::new(o)),
3428                 },
3429                 result_ok: true,
3430         }
3431 }
3432 #[no_mangle]
3433 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3434 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3435         CResult_COption_EventZDecodeErrorZ {
3436                 contents: CResult_COption_EventZDecodeErrorZPtr {
3437                         err: Box::into_raw(Box::new(e)),
3438                 },
3439                 result_ok: false,
3440         }
3441 }
3442 /// Checks if the given object is currently in the success state
3443 #[no_mangle]
3444 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3445         o.result_ok
3446 }
3447 #[no_mangle]
3448 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3449 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3450 impl Drop for CResult_COption_EventZDecodeErrorZ {
3451         fn drop(&mut self) {
3452                 if self.result_ok {
3453                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3454                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3455                         }
3456                 } else {
3457                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3458                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3459                         }
3460                 }
3461         }
3462 }
3463 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3464         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3465                 let contents = if o.result_ok {
3466                         let result = unsafe { o.contents.result };
3467                         unsafe { o.contents.result = core::ptr::null_mut() };
3468                         CResult_COption_EventZDecodeErrorZPtr { result }
3469                 } else {
3470                         let err = unsafe { o.contents.err };
3471                         unsafe { o.contents.err = core::ptr::null_mut(); }
3472                         CResult_COption_EventZDecodeErrorZPtr { err }
3473                 };
3474                 Self {
3475                         contents,
3476                         result_ok: o.result_ok,
3477                 }
3478         }
3479 }
3480 impl Clone for CResult_COption_EventZDecodeErrorZ {
3481         fn clone(&self) -> Self {
3482                 if self.result_ok {
3483                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3484                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3485                         } }
3486                 } else {
3487                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3488                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3489                         } }
3490                 }
3491         }
3492 }
3493 #[no_mangle]
3494 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3495 /// but with all dynamically-allocated buffers duplicated in new buffers.
3496 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3497 #[repr(C)]
3498 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3499 /// This corresponds to std::vector in C++
3500 pub struct CVec_MessageSendEventZ {
3501         /// The elements in the array.
3502         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3503         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3504         /// The number of elements pointed to by `data`.
3505         pub datalen: usize
3506 }
3507 impl CVec_MessageSendEventZ {
3508         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3509                 if self.datalen == 0 { return Vec::new(); }
3510                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3511                 self.data = core::ptr::null_mut();
3512                 self.datalen = 0;
3513                 ret
3514         }
3515         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3516                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3517         }
3518 }
3519 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3520         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3521                 let datalen = v.len();
3522                 let data = Box::into_raw(v.into_boxed_slice());
3523                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3524         }
3525 }
3526 #[no_mangle]
3527 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3528 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3529 impl Drop for CVec_MessageSendEventZ {
3530         fn drop(&mut self) {
3531                 if self.datalen == 0 { return; }
3532                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3533         }
3534 }
3535 impl Clone for CVec_MessageSendEventZ {
3536         fn clone(&self) -> Self {
3537                 let mut res = Vec::new();
3538                 if self.datalen == 0 { return Self::from(res); }
3539                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3540                 Self::from(res)
3541         }
3542 }
3543 #[repr(C)]
3544 /// The contents of CResult_TxOutAccessErrorZ
3545 pub union CResult_TxOutAccessErrorZPtr {
3546         /// A pointer to the contents in the success state.
3547         /// Reading from this pointer when `result_ok` is not set is undefined.
3548         pub result: *mut crate::c_types::TxOut,
3549         /// A pointer to the contents in the error state.
3550         /// Reading from this pointer when `result_ok` is set is undefined.
3551         pub err: *mut crate::lightning::chain::AccessError,
3552 }
3553 #[repr(C)]
3554 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3555 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3556 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3557 pub struct CResult_TxOutAccessErrorZ {
3558         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
3559         /// `err` or `result` depending on the state of `result_ok`.
3560         pub contents: CResult_TxOutAccessErrorZPtr,
3561         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
3562         pub result_ok: bool,
3563 }
3564 #[no_mangle]
3565 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
3566 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3567         CResult_TxOutAccessErrorZ {
3568                 contents: CResult_TxOutAccessErrorZPtr {
3569                         result: Box::into_raw(Box::new(o)),
3570                 },
3571                 result_ok: true,
3572         }
3573 }
3574 #[no_mangle]
3575 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
3576 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3577         CResult_TxOutAccessErrorZ {
3578                 contents: CResult_TxOutAccessErrorZPtr {
3579                         err: Box::into_raw(Box::new(e)),
3580                 },
3581                 result_ok: false,
3582         }
3583 }
3584 /// Checks if the given object is currently in the success state
3585 #[no_mangle]
3586 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
3587         o.result_ok
3588 }
3589 #[no_mangle]
3590 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
3591 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3592 impl Drop for CResult_TxOutAccessErrorZ {
3593         fn drop(&mut self) {
3594                 if self.result_ok {
3595                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3596                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3597                         }
3598                 } else {
3599                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3600                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3601                         }
3602                 }
3603         }
3604 }
3605 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3606         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
3607                 let contents = if o.result_ok {
3608                         let result = unsafe { o.contents.result };
3609                         unsafe { o.contents.result = core::ptr::null_mut() };
3610                         CResult_TxOutAccessErrorZPtr { result }
3611                 } else {
3612                         let err = unsafe { o.contents.err };
3613                         unsafe { o.contents.err = core::ptr::null_mut(); }
3614                         CResult_TxOutAccessErrorZPtr { err }
3615                 };
3616                 Self {
3617                         contents,
3618                         result_ok: o.result_ok,
3619                 }
3620         }
3621 }
3622 impl Clone for CResult_TxOutAccessErrorZ {
3623         fn clone(&self) -> Self {
3624                 if self.result_ok {
3625                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3626                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3627                         } }
3628                 } else {
3629                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3630                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3631                         } }
3632                 }
3633         }
3634 }
3635 #[no_mangle]
3636 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
3637 /// but with all dynamically-allocated buffers duplicated in new buffers.
3638 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
3639 #[repr(C)]
3640 /// A tuple of 2 elements. See the individual fields for the types contained.
3641 pub struct C2Tuple_usizeTransactionZ {
3642         /// The element at position 0
3643         pub a: usize,
3644         /// The element at position 1
3645         pub b: crate::c_types::Transaction,
3646 }
3647 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
3648         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
3649                 Self {
3650                         a: tup.0,
3651                         b: tup.1,
3652                 }
3653         }
3654 }
3655 impl C2Tuple_usizeTransactionZ {
3656         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
3657                 (self.a, self.b)
3658         }
3659 }
3660 impl Clone for C2Tuple_usizeTransactionZ {
3661         fn clone(&self) -> Self {
3662                 Self {
3663                         a: Clone::clone(&self.a),
3664                         b: Clone::clone(&self.b),
3665                 }
3666         }
3667 }
3668 #[no_mangle]
3669 /// Creates a new tuple which has the same data as `orig`
3670 /// but with all dynamically-allocated buffers duplicated in new buffers.
3671 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
3672 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
3673 #[no_mangle]
3674 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
3675         C2Tuple_usizeTransactionZ { a, b, }
3676 }
3677
3678 #[no_mangle]
3679 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
3680 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
3681 #[repr(C)]
3682 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
3683 /// This corresponds to std::vector in C++
3684 pub struct CVec_C2Tuple_usizeTransactionZZ {
3685         /// The elements in the array.
3686         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3687         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
3688         /// The number of elements pointed to by `data`.
3689         pub datalen: usize
3690 }
3691 impl CVec_C2Tuple_usizeTransactionZZ {
3692         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
3693                 if self.datalen == 0 { return Vec::new(); }
3694                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3695                 self.data = core::ptr::null_mut();
3696                 self.datalen = 0;
3697                 ret
3698         }
3699         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
3700                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3701         }
3702 }
3703 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
3704         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
3705                 let datalen = v.len();
3706                 let data = Box::into_raw(v.into_boxed_slice());
3707                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3708         }
3709 }
3710 #[no_mangle]
3711 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3712 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
3713 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
3714         fn drop(&mut self) {
3715                 if self.datalen == 0 { return; }
3716                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3717         }
3718 }
3719 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3720         fn clone(&self) -> Self {
3721                 let mut res = Vec::new();
3722                 if self.datalen == 0 { return Self::from(res); }
3723                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3724                 Self::from(res)
3725         }
3726 }
3727 #[repr(C)]
3728 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3729 /// This corresponds to std::vector in C++
3730 pub struct CVec_TxidZ {
3731         /// The elements in the array.
3732         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3733         pub data: *mut crate::c_types::ThirtyTwoBytes,
3734         /// The number of elements pointed to by `data`.
3735         pub datalen: usize
3736 }
3737 impl CVec_TxidZ {
3738         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3739                 if self.datalen == 0 { return Vec::new(); }
3740                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3741                 self.data = core::ptr::null_mut();
3742                 self.datalen = 0;
3743                 ret
3744         }
3745         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3746                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3747         }
3748 }
3749 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3750         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3751                 let datalen = v.len();
3752                 let data = Box::into_raw(v.into_boxed_slice());
3753                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3754         }
3755 }
3756 #[no_mangle]
3757 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3758 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3759 impl Drop for CVec_TxidZ {
3760         fn drop(&mut self) {
3761                 if self.datalen == 0 { return; }
3762                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3763         }
3764 }
3765 impl Clone for CVec_TxidZ {
3766         fn clone(&self) -> Self {
3767                 let mut res = Vec::new();
3768                 if self.datalen == 0 { return Self::from(res); }
3769                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3770                 Self::from(res)
3771         }
3772 }
3773 #[repr(C)]
3774 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3775 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3776         /// Note that this value is always NULL, as there are no contents in the OK variant
3777         pub result: *mut core::ffi::c_void,
3778         /// A pointer to the contents in the error state.
3779         /// Reading from this pointer when `result_ok` is set is undefined.
3780         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3781 }
3782 #[repr(C)]
3783 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3784 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3786 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3787         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3788         /// `err` or `result` depending on the state of `result_ok`.
3789         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3790         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3791         pub result_ok: bool,
3792 }
3793 #[no_mangle]
3794 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3795 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3796         CResult_NoneChannelMonitorUpdateErrZ {
3797                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3798                         result: core::ptr::null_mut(),
3799                 },
3800                 result_ok: true,
3801         }
3802 }
3803 #[no_mangle]
3804 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3805 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3806         CResult_NoneChannelMonitorUpdateErrZ {
3807                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3808                         err: Box::into_raw(Box::new(e)),
3809                 },
3810                 result_ok: false,
3811         }
3812 }
3813 /// Checks if the given object is currently in the success state
3814 #[no_mangle]
3815 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3816         o.result_ok
3817 }
3818 #[no_mangle]
3819 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3820 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3821 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3822         fn drop(&mut self) {
3823                 if self.result_ok {
3824                 } else {
3825                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3826                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3827                         }
3828                 }
3829         }
3830 }
3831 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3832         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3833                 let contents = if o.result_ok {
3834                         let _ = unsafe { Box::from_raw(o.contents.result) };
3835                         o.contents.result = core::ptr::null_mut();
3836                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3837                 } else {
3838                         let err = unsafe { o.contents.err };
3839                         unsafe { o.contents.err = core::ptr::null_mut(); }
3840                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3841                 };
3842                 Self {
3843                         contents,
3844                         result_ok: o.result_ok,
3845                 }
3846         }
3847 }
3848 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3849         fn clone(&self) -> Self {
3850                 if self.result_ok {
3851                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3852                                 result: core::ptr::null_mut()
3853                         } }
3854                 } else {
3855                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3856                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3857                         } }
3858                 }
3859         }
3860 }
3861 #[no_mangle]
3862 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3863 /// but with all dynamically-allocated buffers duplicated in new buffers.
3864 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3865 #[repr(C)]
3866 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3867 /// This corresponds to std::vector in C++
3868 pub struct CVec_MonitorEventZ {
3869         /// The elements in the array.
3870         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3871         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3872         /// The number of elements pointed to by `data`.
3873         pub datalen: usize
3874 }
3875 impl CVec_MonitorEventZ {
3876         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3877                 if self.datalen == 0 { return Vec::new(); }
3878                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3879                 self.data = core::ptr::null_mut();
3880                 self.datalen = 0;
3881                 ret
3882         }
3883         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3884                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3885         }
3886 }
3887 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3888         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3889                 let datalen = v.len();
3890                 let data = Box::into_raw(v.into_boxed_slice());
3891                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3892         }
3893 }
3894 #[no_mangle]
3895 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3896 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3897 impl Drop for CVec_MonitorEventZ {
3898         fn drop(&mut self) {
3899                 if self.datalen == 0 { return; }
3900                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3901         }
3902 }
3903 impl Clone for CVec_MonitorEventZ {
3904         fn clone(&self) -> Self {
3905                 let mut res = Vec::new();
3906                 if self.datalen == 0 { return Self::from(res); }
3907                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3908                 Self::from(res)
3909         }
3910 }
3911 #[repr(C)]
3912 /// A tuple of 3 elements. See the individual fields for the types contained.
3913 pub struct C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3914         /// The element at position 0
3915         pub a: crate::lightning::chain::transaction::OutPoint,
3916         /// The element at position 1
3917         pub b: crate::c_types::derived::CVec_MonitorEventZ,
3918         /// The element at position 2
3919         pub c: crate::c_types::PublicKey,
3920 }
3921 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3922         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self {
3923                 Self {
3924                         a: tup.0,
3925                         b: tup.1,
3926                         c: tup.2,
3927                 }
3928         }
3929 }
3930 impl C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3931         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) {
3932                 (self.a, self.b, self.c)
3933         }
3934 }
3935 impl Clone for C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3936         fn clone(&self) -> Self {
3937                 Self {
3938                         a: Clone::clone(&self.a),
3939                         b: Clone::clone(&self.b),
3940                         c: Clone::clone(&self.c),
3941                 }
3942         }
3943 }
3944 #[no_mangle]
3945 /// Creates a new tuple which has the same data as `orig`
3946 /// but with all dynamically-allocated buffers duplicated in new buffers.
3947 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig: &C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) }
3948 /// Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
3949 #[no_mangle]
3950 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorEventZ, c: crate::c_types::PublicKey) -> C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
3951         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { a, b, c, }
3952 }
3953
3954 #[no_mangle]
3955 /// Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
3956 pub extern "C" fn C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res: C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) { }
3957 #[repr(C)]
3958 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
3959 /// This corresponds to std::vector in C++
3960 pub struct CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3961         /// The elements in the array.
3962         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3963         pub data: *mut crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ,
3964         /// The number of elements pointed to by `data`.
3965         pub datalen: usize
3966 }
3967 impl CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3968         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ> {
3969                 if self.datalen == 0 { return Vec::new(); }
3970                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3971                 self.data = core::ptr::null_mut();
3972                 self.datalen = 0;
3973                 ret
3974         }
3975         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ] {
3976                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3977         }
3978 }
3979 impl From<Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>> for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3980         fn from(v: Vec<crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ>) -> Self {
3981                 let datalen = v.len();
3982                 let data = Box::into_raw(v.into_boxed_slice());
3983                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3984         }
3985 }
3986 #[no_mangle]
3987 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3988 pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ) { }
3989 impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3990         fn drop(&mut self) {
3991                 if self.datalen == 0 { return; }
3992                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3993         }
3994 }
3995 impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
3996         fn clone(&self) -> Self {
3997                 let mut res = Vec::new();
3998                 if self.datalen == 0 { return Self::from(res); }
3999                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4000                 Self::from(res)
4001         }
4002 }
4003 #[repr(C)]
4004 #[derive(Clone)]
4005 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4006 pub enum COption_C2Tuple_usizeTransactionZZ {
4007         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4008         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
4009         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4010         None
4011 }
4012 impl COption_C2Tuple_usizeTransactionZZ {
4013         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4014                 if let Self::None = self { false } else { true }
4015         }
4016         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4017                 !self.is_some()
4018         }
4019         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
4020                 if let Self::Some(v) = self { v } else { unreachable!() }
4021         }
4022 }
4023 #[no_mangle]
4024 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
4025 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
4026         COption_C2Tuple_usizeTransactionZZ::Some(o)
4027 }
4028 #[no_mangle]
4029 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
4030 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
4031         COption_C2Tuple_usizeTransactionZZ::None
4032 }
4033 #[no_mangle]
4034 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
4035 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
4036 #[no_mangle]
4037 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
4038 /// but with all dynamically-allocated buffers duplicated in new buffers.
4039 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
4040 #[repr(C)]
4041 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4042 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
4043         /// A pointer to the contents in the success state.
4044         /// Reading from this pointer when `result_ok` is not set is undefined.
4045         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
4046         /// A pointer to the contents in the error state.
4047         /// Reading from this pointer when `result_ok` is set is undefined.
4048         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4049 }
4050 #[repr(C)]
4051 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4052 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4053 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4054 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
4055         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4056         /// `err` or `result` depending on the state of `result_ok`.
4057         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
4058         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4059         pub result_ok: bool,
4060 }
4061 #[no_mangle]
4062 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
4063 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4064         CResult_FixedPenaltyScorerDecodeErrorZ {
4065                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4066                         result: Box::into_raw(Box::new(o)),
4067                 },
4068                 result_ok: true,
4069         }
4070 }
4071 #[no_mangle]
4072 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
4073 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
4074         CResult_FixedPenaltyScorerDecodeErrorZ {
4075                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4076                         err: Box::into_raw(Box::new(e)),
4077                 },
4078                 result_ok: false,
4079         }
4080 }
4081 /// Checks if the given object is currently in the success state
4082 #[no_mangle]
4083 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
4084         o.result_ok
4085 }
4086 #[no_mangle]
4087 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
4088 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
4089 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
4090         fn drop(&mut self) {
4091                 if self.result_ok {
4092                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4093                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4094                         }
4095                 } else {
4096                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4097                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4098                         }
4099                 }
4100         }
4101 }
4102 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
4103         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4104                 let contents = if o.result_ok {
4105                         let result = unsafe { o.contents.result };
4106                         unsafe { o.contents.result = core::ptr::null_mut() };
4107                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
4108                 } else {
4109                         let err = unsafe { o.contents.err };
4110                         unsafe { o.contents.err = core::ptr::null_mut(); }
4111                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
4112                 };
4113                 Self {
4114                         contents,
4115                         result_ok: o.result_ok,
4116                 }
4117         }
4118 }
4119 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
4120         fn clone(&self) -> Self {
4121                 if self.result_ok {
4122                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4123                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
4124                         } }
4125                 } else {
4126                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
4127                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4128                         } }
4129                 }
4130         }
4131 }
4132 #[no_mangle]
4133 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
4134 /// but with all dynamically-allocated buffers duplicated in new buffers.
4135 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
4136 #[repr(C)]
4137 /// A tuple of 2 elements. See the individual fields for the types contained.
4138 pub struct C2Tuple_u64u64Z {
4139         /// The element at position 0
4140         pub a: u64,
4141         /// The element at position 1
4142         pub b: u64,
4143 }
4144 impl From<(u64, u64)> for C2Tuple_u64u64Z {
4145         fn from (tup: (u64, u64)) -> Self {
4146                 Self {
4147                         a: tup.0,
4148                         b: tup.1,
4149                 }
4150         }
4151 }
4152 impl C2Tuple_u64u64Z {
4153         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
4154                 (self.a, self.b)
4155         }
4156 }
4157 impl Clone for C2Tuple_u64u64Z {
4158         fn clone(&self) -> Self {
4159                 Self {
4160                         a: Clone::clone(&self.a),
4161                         b: Clone::clone(&self.b),
4162                 }
4163         }
4164 }
4165 #[no_mangle]
4166 /// Creates a new tuple which has the same data as `orig`
4167 /// but with all dynamically-allocated buffers duplicated in new buffers.
4168 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) }
4169 /// Creates a new C2Tuple_u64u64Z from the contained elements.
4170 #[no_mangle]
4171 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
4172         C2Tuple_u64u64Z { a, b, }
4173 }
4174
4175 #[no_mangle]
4176 /// Frees any resources used by the C2Tuple_u64u64Z.
4177 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
4178 #[repr(C)]
4179 #[derive(Clone)]
4180 /// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4181 pub enum COption_C2Tuple_u64u64ZZ {
4182         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4183         Some(crate::c_types::derived::C2Tuple_u64u64Z),
4184         /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4185         None
4186 }
4187 impl COption_C2Tuple_u64u64ZZ {
4188         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
4189                 if let Self::None = self { false } else { true }
4190         }
4191         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
4192                 !self.is_some()
4193         }
4194         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z {
4195                 if let Self::Some(v) = self { v } else { unreachable!() }
4196         }
4197 }
4198 #[no_mangle]
4199 /// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
4200 pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ {
4201         COption_C2Tuple_u64u64ZZ::Some(o)
4202 }
4203 #[no_mangle]
4204 /// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
4205 pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ {
4206         COption_C2Tuple_u64u64ZZ::None
4207 }
4208 #[no_mangle]
4209 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
4210 pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { }
4211 #[no_mangle]
4212 /// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
4213 /// but with all dynamically-allocated buffers duplicated in new buffers.
4214 pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) }
4215 #[repr(C)]
4216 /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4217 /// This corresponds to std::vector in C++
4218 pub struct CVec_NodeIdZ {
4219         /// The elements in the array.
4220         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4221         pub data: *mut crate::lightning::routing::gossip::NodeId,
4222         /// The number of elements pointed to by `data`.
4223         pub datalen: usize
4224 }
4225 impl CVec_NodeIdZ {
4226         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::gossip::NodeId> {
4227                 if self.datalen == 0 { return Vec::new(); }
4228                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4229                 self.data = core::ptr::null_mut();
4230                 self.datalen = 0;
4231                 ret
4232         }
4233         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] {
4234                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4235         }
4236 }
4237 impl From<Vec<crate::lightning::routing::gossip::NodeId>> for CVec_NodeIdZ {
4238         fn from(v: Vec<crate::lightning::routing::gossip::NodeId>) -> Self {
4239                 let datalen = v.len();
4240                 let data = Box::into_raw(v.into_boxed_slice());
4241                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4242         }
4243 }
4244 #[no_mangle]
4245 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4246 pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { }
4247 impl Drop for CVec_NodeIdZ {
4248         fn drop(&mut self) {
4249                 if self.datalen == 0 { return; }
4250                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4251         }
4252 }
4253 impl Clone for CVec_NodeIdZ {
4254         fn clone(&self) -> Self {
4255                 let mut res = Vec::new();
4256                 if self.datalen == 0 { return Self::from(res); }
4257                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4258                 Self::from(res)
4259         }
4260 }
4261 #[repr(C)]
4262 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4263 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4264         /// A pointer to the contents in the success state.
4265         /// Reading from this pointer when `result_ok` is not set is undefined.
4266         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4267         /// A pointer to the contents in the error state.
4268         /// Reading from this pointer when `result_ok` is set is undefined.
4269         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4270 }
4271 #[repr(C)]
4272 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4273 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4275 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4276         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4277         /// `err` or `result` depending on the state of `result_ok`.
4278         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4279         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4280         pub result_ok: bool,
4281 }
4282 #[no_mangle]
4283 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4284 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4285         CResult_ProbabilisticScorerDecodeErrorZ {
4286                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4287                         result: Box::into_raw(Box::new(o)),
4288                 },
4289                 result_ok: true,
4290         }
4291 }
4292 #[no_mangle]
4293 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4294 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4295         CResult_ProbabilisticScorerDecodeErrorZ {
4296                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4297                         err: Box::into_raw(Box::new(e)),
4298                 },
4299                 result_ok: false,
4300         }
4301 }
4302 /// Checks if the given object is currently in the success state
4303 #[no_mangle]
4304 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4305         o.result_ok
4306 }
4307 #[no_mangle]
4308 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4309 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4310 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4311         fn drop(&mut self) {
4312                 if self.result_ok {
4313                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4314                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4315                         }
4316                 } else {
4317                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4318                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4319                         }
4320                 }
4321         }
4322 }
4323 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4324         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4325                 let contents = if o.result_ok {
4326                         let result = unsafe { o.contents.result };
4327                         unsafe { o.contents.result = core::ptr::null_mut() };
4328                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4329                 } else {
4330                         let err = unsafe { o.contents.err };
4331                         unsafe { o.contents.err = core::ptr::null_mut(); }
4332                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4333                 };
4334                 Self {
4335                         contents,
4336                         result_ok: o.result_ok,
4337                 }
4338         }
4339 }
4340 #[repr(C)]
4341 /// The contents of CResult_InitFeaturesDecodeErrorZ
4342 pub union CResult_InitFeaturesDecodeErrorZPtr {
4343         /// A pointer to the contents in the success state.
4344         /// Reading from this pointer when `result_ok` is not set is undefined.
4345         pub result: *mut crate::lightning::ln::features::InitFeatures,
4346         /// A pointer to the contents in the error state.
4347         /// Reading from this pointer when `result_ok` is set is undefined.
4348         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4349 }
4350 #[repr(C)]
4351 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4352 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4353 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4354 pub struct CResult_InitFeaturesDecodeErrorZ {
4355         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4356         /// `err` or `result` depending on the state of `result_ok`.
4357         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4358         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4359         pub result_ok: bool,
4360 }
4361 #[no_mangle]
4362 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4363 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4364         CResult_InitFeaturesDecodeErrorZ {
4365                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4366                         result: Box::into_raw(Box::new(o)),
4367                 },
4368                 result_ok: true,
4369         }
4370 }
4371 #[no_mangle]
4372 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4373 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4374         CResult_InitFeaturesDecodeErrorZ {
4375                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4376                         err: Box::into_raw(Box::new(e)),
4377                 },
4378                 result_ok: false,
4379         }
4380 }
4381 /// Checks if the given object is currently in the success state
4382 #[no_mangle]
4383 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4384         o.result_ok
4385 }
4386 #[no_mangle]
4387 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4388 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4389 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4390         fn drop(&mut self) {
4391                 if self.result_ok {
4392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4394                         }
4395                 } else {
4396                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4397                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4398                         }
4399                 }
4400         }
4401 }
4402 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4403         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4404                 let contents = if o.result_ok {
4405                         let result = unsafe { o.contents.result };
4406                         unsafe { o.contents.result = core::ptr::null_mut() };
4407                         CResult_InitFeaturesDecodeErrorZPtr { result }
4408                 } else {
4409                         let err = unsafe { o.contents.err };
4410                         unsafe { o.contents.err = core::ptr::null_mut(); }
4411                         CResult_InitFeaturesDecodeErrorZPtr { err }
4412                 };
4413                 Self {
4414                         contents,
4415                         result_ok: o.result_ok,
4416                 }
4417         }
4418 }
4419 impl Clone for CResult_InitFeaturesDecodeErrorZ {
4420         fn clone(&self) -> Self {
4421                 if self.result_ok {
4422                         Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr {
4423                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InitFeatures>::clone(unsafe { &*self.contents.result })))
4424                         } }
4425                 } else {
4426                         Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr {
4427                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4428                         } }
4429                 }
4430         }
4431 }
4432 #[no_mangle]
4433 /// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
4434 /// but with all dynamically-allocated buffers duplicated in new buffers.
4435 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) }
4436 #[repr(C)]
4437 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4438 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4439         /// A pointer to the contents in the success state.
4440         /// Reading from this pointer when `result_ok` is not set is undefined.
4441         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4442         /// A pointer to the contents in the error state.
4443         /// Reading from this pointer when `result_ok` is set is undefined.
4444         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4445 }
4446 #[repr(C)]
4447 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4448 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4450 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4451         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4452         /// `err` or `result` depending on the state of `result_ok`.
4453         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4454         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4455         pub result_ok: bool,
4456 }
4457 #[no_mangle]
4458 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4459 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4460         CResult_ChannelFeaturesDecodeErrorZ {
4461                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4462                         result: Box::into_raw(Box::new(o)),
4463                 },
4464                 result_ok: true,
4465         }
4466 }
4467 #[no_mangle]
4468 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4469 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4470         CResult_ChannelFeaturesDecodeErrorZ {
4471                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4472                         err: Box::into_raw(Box::new(e)),
4473                 },
4474                 result_ok: false,
4475         }
4476 }
4477 /// Checks if the given object is currently in the success state
4478 #[no_mangle]
4479 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4480         o.result_ok
4481 }
4482 #[no_mangle]
4483 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4484 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4485 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4486         fn drop(&mut self) {
4487                 if self.result_ok {
4488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4490                         }
4491                 } else {
4492                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4493                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4494                         }
4495                 }
4496         }
4497 }
4498 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4499         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4500                 let contents = if o.result_ok {
4501                         let result = unsafe { o.contents.result };
4502                         unsafe { o.contents.result = core::ptr::null_mut() };
4503                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4504                 } else {
4505                         let err = unsafe { o.contents.err };
4506                         unsafe { o.contents.err = core::ptr::null_mut(); }
4507                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4508                 };
4509                 Self {
4510                         contents,
4511                         result_ok: o.result_ok,
4512                 }
4513         }
4514 }
4515 impl Clone for CResult_ChannelFeaturesDecodeErrorZ {
4516         fn clone(&self) -> Self {
4517                 if self.result_ok {
4518                         Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4519                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelFeatures>::clone(unsafe { &*self.contents.result })))
4520                         } }
4521                 } else {
4522                         Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4523                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4524                         } }
4525                 }
4526         }
4527 }
4528 #[no_mangle]
4529 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
4530 /// but with all dynamically-allocated buffers duplicated in new buffers.
4531 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) }
4532 #[repr(C)]
4533 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4534 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4535         /// A pointer to the contents in the success state.
4536         /// Reading from this pointer when `result_ok` is not set is undefined.
4537         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4538         /// A pointer to the contents in the error state.
4539         /// Reading from this pointer when `result_ok` is set is undefined.
4540         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4541 }
4542 #[repr(C)]
4543 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4544 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4545 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4546 pub struct CResult_NodeFeaturesDecodeErrorZ {
4547         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4548         /// `err` or `result` depending on the state of `result_ok`.
4549         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4550         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4551         pub result_ok: bool,
4552 }
4553 #[no_mangle]
4554 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4555 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4556         CResult_NodeFeaturesDecodeErrorZ {
4557                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4558                         result: Box::into_raw(Box::new(o)),
4559                 },
4560                 result_ok: true,
4561         }
4562 }
4563 #[no_mangle]
4564 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4565 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4566         CResult_NodeFeaturesDecodeErrorZ {
4567                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4568                         err: Box::into_raw(Box::new(e)),
4569                 },
4570                 result_ok: false,
4571         }
4572 }
4573 /// Checks if the given object is currently in the success state
4574 #[no_mangle]
4575 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4576         o.result_ok
4577 }
4578 #[no_mangle]
4579 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4580 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4581 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4582         fn drop(&mut self) {
4583                 if self.result_ok {
4584                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4585                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4586                         }
4587                 } else {
4588                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4589                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4590                         }
4591                 }
4592         }
4593 }
4594 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4595         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4596                 let contents = if o.result_ok {
4597                         let result = unsafe { o.contents.result };
4598                         unsafe { o.contents.result = core::ptr::null_mut() };
4599                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4600                 } else {
4601                         let err = unsafe { o.contents.err };
4602                         unsafe { o.contents.err = core::ptr::null_mut(); }
4603                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4604                 };
4605                 Self {
4606                         contents,
4607                         result_ok: o.result_ok,
4608                 }
4609         }
4610 }
4611 impl Clone for CResult_NodeFeaturesDecodeErrorZ {
4612         fn clone(&self) -> Self {
4613                 if self.result_ok {
4614                         Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4615                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::NodeFeatures>::clone(unsafe { &*self.contents.result })))
4616                         } }
4617                 } else {
4618                         Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr {
4619                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4620                         } }
4621                 }
4622         }
4623 }
4624 #[no_mangle]
4625 /// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
4626 /// but with all dynamically-allocated buffers duplicated in new buffers.
4627 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4628 #[repr(C)]
4629 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4630 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4631         /// A pointer to the contents in the success state.
4632         /// Reading from this pointer when `result_ok` is not set is undefined.
4633         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4634         /// A pointer to the contents in the error state.
4635         /// Reading from this pointer when `result_ok` is set is undefined.
4636         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4637 }
4638 #[repr(C)]
4639 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4640 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4641 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4642 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4643         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4644         /// `err` or `result` depending on the state of `result_ok`.
4645         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4646         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4647         pub result_ok: bool,
4648 }
4649 #[no_mangle]
4650 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4651 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4652         CResult_InvoiceFeaturesDecodeErrorZ {
4653                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4654                         result: Box::into_raw(Box::new(o)),
4655                 },
4656                 result_ok: true,
4657         }
4658 }
4659 #[no_mangle]
4660 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4661 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4662         CResult_InvoiceFeaturesDecodeErrorZ {
4663                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4664                         err: Box::into_raw(Box::new(e)),
4665                 },
4666                 result_ok: false,
4667         }
4668 }
4669 /// Checks if the given object is currently in the success state
4670 #[no_mangle]
4671 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4672         o.result_ok
4673 }
4674 #[no_mangle]
4675 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4676 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4677 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4678         fn drop(&mut self) {
4679                 if self.result_ok {
4680                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4681                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4682                         }
4683                 } else {
4684                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4685                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4686                         }
4687                 }
4688         }
4689 }
4690 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4691         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4692                 let contents = if o.result_ok {
4693                         let result = unsafe { o.contents.result };
4694                         unsafe { o.contents.result = core::ptr::null_mut() };
4695                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4696                 } else {
4697                         let err = unsafe { o.contents.err };
4698                         unsafe { o.contents.err = core::ptr::null_mut(); }
4699                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4700                 };
4701                 Self {
4702                         contents,
4703                         result_ok: o.result_ok,
4704                 }
4705         }
4706 }
4707 impl Clone for CResult_InvoiceFeaturesDecodeErrorZ {
4708         fn clone(&self) -> Self {
4709                 if self.result_ok {
4710                         Self { result_ok: true, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4711                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::InvoiceFeatures>::clone(unsafe { &*self.contents.result })))
4712                         } }
4713                 } else {
4714                         Self { result_ok: false, contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4715                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4716                         } }
4717                 }
4718         }
4719 }
4720 #[no_mangle]
4721 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
4722 /// but with all dynamically-allocated buffers duplicated in new buffers.
4723 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceFeaturesDecodeErrorZ) -> CResult_InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) }
4724 #[repr(C)]
4725 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4726 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4727         /// A pointer to the contents in the success state.
4728         /// Reading from this pointer when `result_ok` is not set is undefined.
4729         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4730         /// A pointer to the contents in the error state.
4731         /// Reading from this pointer when `result_ok` is set is undefined.
4732         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4733 }
4734 #[repr(C)]
4735 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4736 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4737 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4738 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4739         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4740         /// `err` or `result` depending on the state of `result_ok`.
4741         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4742         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4743         pub result_ok: bool,
4744 }
4745 #[no_mangle]
4746 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4747 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4748         CResult_ChannelTypeFeaturesDecodeErrorZ {
4749                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4750                         result: Box::into_raw(Box::new(o)),
4751                 },
4752                 result_ok: true,
4753         }
4754 }
4755 #[no_mangle]
4756 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4757 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4758         CResult_ChannelTypeFeaturesDecodeErrorZ {
4759                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4760                         err: Box::into_raw(Box::new(e)),
4761                 },
4762                 result_ok: false,
4763         }
4764 }
4765 /// Checks if the given object is currently in the success state
4766 #[no_mangle]
4767 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4768         o.result_ok
4769 }
4770 #[no_mangle]
4771 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4772 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4773 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4774         fn drop(&mut self) {
4775                 if self.result_ok {
4776                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4777                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4778                         }
4779                 } else {
4780                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4781                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4782                         }
4783                 }
4784         }
4785 }
4786 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4787         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4788                 let contents = if o.result_ok {
4789                         let result = unsafe { o.contents.result };
4790                         unsafe { o.contents.result = core::ptr::null_mut() };
4791                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4792                 } else {
4793                         let err = unsafe { o.contents.err };
4794                         unsafe { o.contents.err = core::ptr::null_mut(); }
4795                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4796                 };
4797                 Self {
4798                         contents,
4799                         result_ok: o.result_ok,
4800                 }
4801         }
4802 }
4803 impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ {
4804         fn clone(&self) -> Self {
4805                 if self.result_ok {
4806                         Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4807                                 result: Box::into_raw(Box::new(<crate::lightning::ln::features::ChannelTypeFeatures>::clone(unsafe { &*self.contents.result })))
4808                         } }
4809                 } else {
4810                         Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4811                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4812                         } }
4813                 }
4814         }
4815 }
4816 #[no_mangle]
4817 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
4818 /// but with all dynamically-allocated buffers duplicated in new buffers.
4819 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) }
4820 #[repr(C)]
4821 /// The contents of CResult_NodeIdDecodeErrorZ
4822 pub union CResult_NodeIdDecodeErrorZPtr {
4823         /// A pointer to the contents in the success state.
4824         /// Reading from this pointer when `result_ok` is not set is undefined.
4825         pub result: *mut crate::lightning::routing::gossip::NodeId,
4826         /// A pointer to the contents in the error state.
4827         /// Reading from this pointer when `result_ok` is set is undefined.
4828         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4829 }
4830 #[repr(C)]
4831 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4832 /// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4834 pub struct CResult_NodeIdDecodeErrorZ {
4835         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4836         /// `err` or `result` depending on the state of `result_ok`.
4837         pub contents: CResult_NodeIdDecodeErrorZPtr,
4838         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4839         pub result_ok: bool,
4840 }
4841 #[no_mangle]
4842 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
4843 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ {
4844         CResult_NodeIdDecodeErrorZ {
4845                 contents: CResult_NodeIdDecodeErrorZPtr {
4846                         result: Box::into_raw(Box::new(o)),
4847                 },
4848                 result_ok: true,
4849         }
4850 }
4851 #[no_mangle]
4852 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
4853 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
4854         CResult_NodeIdDecodeErrorZ {
4855                 contents: CResult_NodeIdDecodeErrorZPtr {
4856                         err: Box::into_raw(Box::new(e)),
4857                 },
4858                 result_ok: false,
4859         }
4860 }
4861 /// Checks if the given object is currently in the success state
4862 #[no_mangle]
4863 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
4864         o.result_ok
4865 }
4866 #[no_mangle]
4867 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
4868 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
4869 impl Drop for CResult_NodeIdDecodeErrorZ {
4870         fn drop(&mut self) {
4871                 if self.result_ok {
4872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4874                         }
4875                 } else {
4876                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4877                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4878                         }
4879                 }
4880         }
4881 }
4882 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
4883         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
4884                 let contents = if o.result_ok {
4885                         let result = unsafe { o.contents.result };
4886                         unsafe { o.contents.result = core::ptr::null_mut() };
4887                         CResult_NodeIdDecodeErrorZPtr { result }
4888                 } else {
4889                         let err = unsafe { o.contents.err };
4890                         unsafe { o.contents.err = core::ptr::null_mut(); }
4891                         CResult_NodeIdDecodeErrorZPtr { err }
4892                 };
4893                 Self {
4894                         contents,
4895                         result_ok: o.result_ok,
4896                 }
4897         }
4898 }
4899 impl Clone for CResult_NodeIdDecodeErrorZ {
4900         fn clone(&self) -> Self {
4901                 if self.result_ok {
4902                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
4903                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeId>::clone(unsafe { &*self.contents.result })))
4904                         } }
4905                 } else {
4906                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
4907                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4908                         } }
4909                 }
4910         }
4911 }
4912 #[no_mangle]
4913 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
4914 /// but with all dynamically-allocated buffers duplicated in new buffers.
4915 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
4916 #[repr(C)]
4917 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4918 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4919         /// A pointer to the contents in the success state.
4920         /// Reading from this pointer when `result_ok` is not set is undefined.
4921         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
4922         /// A pointer to the contents in the error state.
4923         /// Reading from this pointer when `result_ok` is set is undefined.
4924         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4925 }
4926 #[repr(C)]
4927 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4928 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4929 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4930 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
4931         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4932         /// `err` or `result` depending on the state of `result_ok`.
4933         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
4934         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4935         pub result_ok: bool,
4936 }
4937 #[no_mangle]
4938 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
4939 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4940         CResult_COption_NetworkUpdateZDecodeErrorZ {
4941                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4942                         result: Box::into_raw(Box::new(o)),
4943                 },
4944                 result_ok: true,
4945         }
4946 }
4947 #[no_mangle]
4948 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
4949 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
4950         CResult_COption_NetworkUpdateZDecodeErrorZ {
4951                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4952                         err: Box::into_raw(Box::new(e)),
4953                 },
4954                 result_ok: false,
4955         }
4956 }
4957 /// Checks if the given object is currently in the success state
4958 #[no_mangle]
4959 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
4960         o.result_ok
4961 }
4962 #[no_mangle]
4963 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
4964 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
4965 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
4966         fn drop(&mut self) {
4967                 if self.result_ok {
4968                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4969                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4970                         }
4971                 } else {
4972                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4973                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4974                         }
4975                 }
4976         }
4977 }
4978 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
4979         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
4980                 let contents = if o.result_ok {
4981                         let result = unsafe { o.contents.result };
4982                         unsafe { o.contents.result = core::ptr::null_mut() };
4983                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
4984                 } else {
4985                         let err = unsafe { o.contents.err };
4986                         unsafe { o.contents.err = core::ptr::null_mut(); }
4987                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
4988                 };
4989                 Self {
4990                         contents,
4991                         result_ok: o.result_ok,
4992                 }
4993         }
4994 }
4995 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
4996         fn clone(&self) -> Self {
4997                 if self.result_ok {
4998                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
4999                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
5000                         } }
5001                 } else {
5002                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
5003                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5004                         } }
5005                 }
5006         }
5007 }
5008 #[no_mangle]
5009 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
5010 /// but with all dynamically-allocated buffers duplicated in new buffers.
5011 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
5012 #[repr(C)]
5013 /// An enum which can either contain a crate::lightning::chain::Access or not
5014 pub enum COption_AccessZ {
5015         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5016         Some(crate::lightning::chain::Access),
5017         /// When we're in this state, this COption_AccessZ contains nothing
5018         None
5019 }
5020 impl COption_AccessZ {
5021         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5022                 if let Self::None = self { false } else { true }
5023         }
5024         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5025                 !self.is_some()
5026         }
5027         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
5028                 if let Self::Some(v) = self { v } else { unreachable!() }
5029         }
5030 }
5031 #[no_mangle]
5032 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
5033 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
5034         COption_AccessZ::Some(o)
5035 }
5036 #[no_mangle]
5037 /// Constructs a new COption_AccessZ containing nothing
5038 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
5039         COption_AccessZ::None
5040 }
5041 #[no_mangle]
5042 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
5043 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
5044 #[repr(C)]
5045 /// The contents of CResult_boolLightningErrorZ
5046 pub union CResult_boolLightningErrorZPtr {
5047         /// A pointer to the contents in the success state.
5048         /// Reading from this pointer when `result_ok` is not set is undefined.
5049         pub result: *mut bool,
5050         /// A pointer to the contents in the error state.
5051         /// Reading from this pointer when `result_ok` is set is undefined.
5052         pub err: *mut crate::lightning::ln::msgs::LightningError,
5053 }
5054 #[repr(C)]
5055 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
5056 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5058 pub struct CResult_boolLightningErrorZ {
5059         /// The contents of this CResult_boolLightningErrorZ, accessible via either
5060         /// `err` or `result` depending on the state of `result_ok`.
5061         pub contents: CResult_boolLightningErrorZPtr,
5062         /// Whether this CResult_boolLightningErrorZ represents a success state.
5063         pub result_ok: bool,
5064 }
5065 #[no_mangle]
5066 /// Creates a new CResult_boolLightningErrorZ in the success state.
5067 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
5068         CResult_boolLightningErrorZ {
5069                 contents: CResult_boolLightningErrorZPtr {
5070                         result: Box::into_raw(Box::new(o)),
5071                 },
5072                 result_ok: true,
5073         }
5074 }
5075 #[no_mangle]
5076 /// Creates a new CResult_boolLightningErrorZ in the error state.
5077 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
5078         CResult_boolLightningErrorZ {
5079                 contents: CResult_boolLightningErrorZPtr {
5080                         err: Box::into_raw(Box::new(e)),
5081                 },
5082                 result_ok: false,
5083         }
5084 }
5085 /// Checks if the given object is currently in the success state
5086 #[no_mangle]
5087 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
5088         o.result_ok
5089 }
5090 #[no_mangle]
5091 /// Frees any resources used by the CResult_boolLightningErrorZ.
5092 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
5093 impl Drop for CResult_boolLightningErrorZ {
5094         fn drop(&mut self) {
5095                 if self.result_ok {
5096                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5097                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5098                         }
5099                 } else {
5100                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5101                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5102                         }
5103                 }
5104         }
5105 }
5106 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
5107         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
5108                 let contents = if o.result_ok {
5109                         let result = unsafe { o.contents.result };
5110                         unsafe { o.contents.result = core::ptr::null_mut() };
5111                         CResult_boolLightningErrorZPtr { result }
5112                 } else {
5113                         let err = unsafe { o.contents.err };
5114                         unsafe { o.contents.err = core::ptr::null_mut(); }
5115                         CResult_boolLightningErrorZPtr { err }
5116                 };
5117                 Self {
5118                         contents,
5119                         result_ok: o.result_ok,
5120                 }
5121         }
5122 }
5123 impl Clone for CResult_boolLightningErrorZ {
5124         fn clone(&self) -> Self {
5125                 if self.result_ok {
5126                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
5127                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
5128                         } }
5129                 } else {
5130                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
5131                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5132                         } }
5133                 }
5134         }
5135 }
5136 #[no_mangle]
5137 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
5138 /// but with all dynamically-allocated buffers duplicated in new buffers.
5139 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
5140 #[repr(C)]
5141 /// A tuple of 3 elements. See the individual fields for the types contained.
5142 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5143         /// The element at position 0
5144         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
5145         /// The element at position 1
5146         pub b: crate::lightning::ln::msgs::ChannelUpdate,
5147         /// The element at position 2
5148         pub c: crate::lightning::ln::msgs::ChannelUpdate,
5149 }
5150 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5151         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
5152                 Self {
5153                         a: tup.0,
5154                         b: tup.1,
5155                         c: tup.2,
5156                 }
5157         }
5158 }
5159 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5160         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
5161                 (self.a, self.b, self.c)
5162         }
5163 }
5164 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5165         fn clone(&self) -> Self {
5166                 Self {
5167                         a: Clone::clone(&self.a),
5168                         b: Clone::clone(&self.b),
5169                         c: Clone::clone(&self.c),
5170                 }
5171         }
5172 }
5173 #[no_mangle]
5174 /// Creates a new tuple which has the same data as `orig`
5175 /// but with all dynamically-allocated buffers duplicated in new buffers.
5176 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
5177 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
5178 #[no_mangle]
5179 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 {
5180         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
5181 }
5182
5183 #[no_mangle]
5184 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
5185 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
5186 #[repr(C)]
5187 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5188 /// This corresponds to std::vector in C++
5189 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5190         /// The elements in the array.
5191         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5192         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
5193         /// The number of elements pointed to by `data`.
5194         pub datalen: usize
5195 }
5196 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5197         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
5198                 if self.datalen == 0 { return Vec::new(); }
5199                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5200                 self.data = core::ptr::null_mut();
5201                 self.datalen = 0;
5202                 ret
5203         }
5204         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
5205                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5206         }
5207 }
5208 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5209         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
5210                 let datalen = v.len();
5211                 let data = Box::into_raw(v.into_boxed_slice());
5212                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5213         }
5214 }
5215 #[no_mangle]
5216 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5217 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
5218 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5219         fn drop(&mut self) {
5220                 if self.datalen == 0 { return; }
5221                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5222         }
5223 }
5224 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5225         fn clone(&self) -> Self {
5226                 let mut res = Vec::new();
5227                 if self.datalen == 0 { return Self::from(res); }
5228                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5229                 Self::from(res)
5230         }
5231 }
5232 #[repr(C)]
5233 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5234 /// This corresponds to std::vector in C++
5235 pub struct CVec_NodeAnnouncementZ {
5236         /// The elements in the array.
5237         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5238         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
5239         /// The number of elements pointed to by `data`.
5240         pub datalen: usize
5241 }
5242 impl CVec_NodeAnnouncementZ {
5243         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
5244                 if self.datalen == 0 { return Vec::new(); }
5245                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5246                 self.data = core::ptr::null_mut();
5247                 self.datalen = 0;
5248                 ret
5249         }
5250         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
5251                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5252         }
5253 }
5254 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
5255         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
5256                 let datalen = v.len();
5257                 let data = Box::into_raw(v.into_boxed_slice());
5258                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5259         }
5260 }
5261 #[no_mangle]
5262 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5263 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
5264 impl Drop for CVec_NodeAnnouncementZ {
5265         fn drop(&mut self) {
5266                 if self.datalen == 0 { return; }
5267                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5268         }
5269 }
5270 impl Clone for CVec_NodeAnnouncementZ {
5271         fn clone(&self) -> Self {
5272                 let mut res = Vec::new();
5273                 if self.datalen == 0 { return Self::from(res); }
5274                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5275                 Self::from(res)
5276         }
5277 }
5278 #[repr(C)]
5279 /// The contents of CResult_NoneLightningErrorZ
5280 pub union CResult_NoneLightningErrorZPtr {
5281         /// Note that this value is always NULL, as there are no contents in the OK variant
5282         pub result: *mut core::ffi::c_void,
5283         /// A pointer to the contents in the error state.
5284         /// Reading from this pointer when `result_ok` is set is undefined.
5285         pub err: *mut crate::lightning::ln::msgs::LightningError,
5286 }
5287 #[repr(C)]
5288 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5289 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5290 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5291 pub struct CResult_NoneLightningErrorZ {
5292         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
5293         /// `err` or `result` depending on the state of `result_ok`.
5294         pub contents: CResult_NoneLightningErrorZPtr,
5295         /// Whether this CResult_NoneLightningErrorZ represents a success state.
5296         pub result_ok: bool,
5297 }
5298 #[no_mangle]
5299 /// Creates a new CResult_NoneLightningErrorZ in the success state.
5300 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
5301         CResult_NoneLightningErrorZ {
5302                 contents: CResult_NoneLightningErrorZPtr {
5303                         result: core::ptr::null_mut(),
5304                 },
5305                 result_ok: true,
5306         }
5307 }
5308 #[no_mangle]
5309 /// Creates a new CResult_NoneLightningErrorZ in the error state.
5310 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
5311         CResult_NoneLightningErrorZ {
5312                 contents: CResult_NoneLightningErrorZPtr {
5313                         err: Box::into_raw(Box::new(e)),
5314                 },
5315                 result_ok: false,
5316         }
5317 }
5318 /// Checks if the given object is currently in the success state
5319 #[no_mangle]
5320 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
5321         o.result_ok
5322 }
5323 #[no_mangle]
5324 /// Frees any resources used by the CResult_NoneLightningErrorZ.
5325 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
5326 impl Drop for CResult_NoneLightningErrorZ {
5327         fn drop(&mut self) {
5328                 if self.result_ok {
5329                 } else {
5330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5332                         }
5333                 }
5334         }
5335 }
5336 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
5337         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
5338                 let contents = if o.result_ok {
5339                         let _ = unsafe { Box::from_raw(o.contents.result) };
5340                         o.contents.result = core::ptr::null_mut();
5341                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
5342                 } else {
5343                         let err = unsafe { o.contents.err };
5344                         unsafe { o.contents.err = core::ptr::null_mut(); }
5345                         CResult_NoneLightningErrorZPtr { err }
5346                 };
5347                 Self {
5348                         contents,
5349                         result_ok: o.result_ok,
5350                 }
5351         }
5352 }
5353 impl Clone for CResult_NoneLightningErrorZ {
5354         fn clone(&self) -> Self {
5355                 if self.result_ok {
5356                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
5357                                 result: core::ptr::null_mut()
5358                         } }
5359                 } else {
5360                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
5361                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
5362                         } }
5363                 }
5364         }
5365 }
5366 #[no_mangle]
5367 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
5368 /// but with all dynamically-allocated buffers duplicated in new buffers.
5369 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
5370 #[repr(C)]
5371 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5372 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
5373         /// A pointer to the contents in the success state.
5374         /// Reading from this pointer when `result_ok` is not set is undefined.
5375         pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo,
5376         /// A pointer to the contents in the error state.
5377         /// Reading from this pointer when `result_ok` is set is undefined.
5378         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5379 }
5380 #[repr(C)]
5381 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5382 /// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5383 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5384 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
5385         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5386         /// `err` or `result` depending on the state of `result_ok`.
5387         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
5388         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5389         pub result_ok: bool,
5390 }
5391 #[no_mangle]
5392 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
5393 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5394         CResult_ChannelUpdateInfoDecodeErrorZ {
5395                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5396                         result: Box::into_raw(Box::new(o)),
5397                 },
5398                 result_ok: true,
5399         }
5400 }
5401 #[no_mangle]
5402 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
5403 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
5404         CResult_ChannelUpdateInfoDecodeErrorZ {
5405                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5406                         err: Box::into_raw(Box::new(e)),
5407                 },
5408                 result_ok: false,
5409         }
5410 }
5411 /// Checks if the given object is currently in the success state
5412 #[no_mangle]
5413 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
5414         o.result_ok
5415 }
5416 #[no_mangle]
5417 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
5418 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
5419 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
5420         fn drop(&mut self) {
5421                 if self.result_ok {
5422                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5423                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5424                         }
5425                 } else {
5426                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5427                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5428                         }
5429                 }
5430         }
5431 }
5432 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
5433         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5434                 let contents = if o.result_ok {
5435                         let result = unsafe { o.contents.result };
5436                         unsafe { o.contents.result = core::ptr::null_mut() };
5437                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
5438                 } else {
5439                         let err = unsafe { o.contents.err };
5440                         unsafe { o.contents.err = core::ptr::null_mut(); }
5441                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
5442                 };
5443                 Self {
5444                         contents,
5445                         result_ok: o.result_ok,
5446                 }
5447         }
5448 }
5449 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
5450         fn clone(&self) -> Self {
5451                 if self.result_ok {
5452                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5453                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
5454                         } }
5455                 } else {
5456                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
5457                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5458                         } }
5459                 }
5460         }
5461 }
5462 #[no_mangle]
5463 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
5464 /// but with all dynamically-allocated buffers duplicated in new buffers.
5465 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
5466 #[repr(C)]
5467 /// The contents of CResult_ChannelInfoDecodeErrorZ
5468 pub union CResult_ChannelInfoDecodeErrorZPtr {
5469         /// A pointer to the contents in the success state.
5470         /// Reading from this pointer when `result_ok` is not set is undefined.
5471         pub result: *mut crate::lightning::routing::gossip::ChannelInfo,
5472         /// A pointer to the contents in the error state.
5473         /// Reading from this pointer when `result_ok` is set is undefined.
5474         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5475 }
5476 #[repr(C)]
5477 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5478 /// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5479 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5480 pub struct CResult_ChannelInfoDecodeErrorZ {
5481         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5482         /// `err` or `result` depending on the state of `result_ok`.
5483         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
5484         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5485         pub result_ok: bool,
5486 }
5487 #[no_mangle]
5488 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
5489 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
5490         CResult_ChannelInfoDecodeErrorZ {
5491                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5492                         result: Box::into_raw(Box::new(o)),
5493                 },
5494                 result_ok: true,
5495         }
5496 }
5497 #[no_mangle]
5498 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
5499 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
5500         CResult_ChannelInfoDecodeErrorZ {
5501                 contents: CResult_ChannelInfoDecodeErrorZPtr {
5502                         err: Box::into_raw(Box::new(e)),
5503                 },
5504                 result_ok: false,
5505         }
5506 }
5507 /// Checks if the given object is currently in the success state
5508 #[no_mangle]
5509 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
5510         o.result_ok
5511 }
5512 #[no_mangle]
5513 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
5514 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
5515 impl Drop for CResult_ChannelInfoDecodeErrorZ {
5516         fn drop(&mut self) {
5517                 if self.result_ok {
5518                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5519                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5520                         }
5521                 } else {
5522                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5523                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5524                         }
5525                 }
5526         }
5527 }
5528 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
5529         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5530                 let contents = if o.result_ok {
5531                         let result = unsafe { o.contents.result };
5532                         unsafe { o.contents.result = core::ptr::null_mut() };
5533                         CResult_ChannelInfoDecodeErrorZPtr { result }
5534                 } else {
5535                         let err = unsafe { o.contents.err };
5536                         unsafe { o.contents.err = core::ptr::null_mut(); }
5537                         CResult_ChannelInfoDecodeErrorZPtr { err }
5538                 };
5539                 Self {
5540                         contents,
5541                         result_ok: o.result_ok,
5542                 }
5543         }
5544 }
5545 impl Clone for CResult_ChannelInfoDecodeErrorZ {
5546         fn clone(&self) -> Self {
5547                 if self.result_ok {
5548                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
5549                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::ChannelInfo>::clone(unsafe { &*self.contents.result })))
5550                         } }
5551                 } else {
5552                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
5553                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5554                         } }
5555                 }
5556         }
5557 }
5558 #[no_mangle]
5559 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
5560 /// but with all dynamically-allocated buffers duplicated in new buffers.
5561 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
5562 #[repr(C)]
5563 /// The contents of CResult_RoutingFeesDecodeErrorZ
5564 pub union CResult_RoutingFeesDecodeErrorZPtr {
5565         /// A pointer to the contents in the success state.
5566         /// Reading from this pointer when `result_ok` is not set is undefined.
5567         pub result: *mut crate::lightning::routing::gossip::RoutingFees,
5568         /// A pointer to the contents in the error state.
5569         /// Reading from this pointer when `result_ok` is set is undefined.
5570         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5571 }
5572 #[repr(C)]
5573 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5574 /// containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5575 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5576 pub struct CResult_RoutingFeesDecodeErrorZ {
5577         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5578         /// `err` or `result` depending on the state of `result_ok`.
5579         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
5580         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5581         pub result_ok: bool,
5582 }
5583 #[no_mangle]
5584 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
5585 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::gossip::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
5586         CResult_RoutingFeesDecodeErrorZ {
5587                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5588                         result: Box::into_raw(Box::new(o)),
5589                 },
5590                 result_ok: true,
5591         }
5592 }
5593 #[no_mangle]
5594 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
5595 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
5596         CResult_RoutingFeesDecodeErrorZ {
5597                 contents: CResult_RoutingFeesDecodeErrorZPtr {
5598                         err: Box::into_raw(Box::new(e)),
5599                 },
5600                 result_ok: false,
5601         }
5602 }
5603 /// Checks if the given object is currently in the success state
5604 #[no_mangle]
5605 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
5606         o.result_ok
5607 }
5608 #[no_mangle]
5609 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
5610 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
5611 impl Drop for CResult_RoutingFeesDecodeErrorZ {
5612         fn drop(&mut self) {
5613                 if self.result_ok {
5614                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5615                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5616                         }
5617                 } else {
5618                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5619                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5620                         }
5621                 }
5622         }
5623 }
5624 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
5625         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
5626                 let contents = if o.result_ok {
5627                         let result = unsafe { o.contents.result };
5628                         unsafe { o.contents.result = core::ptr::null_mut() };
5629                         CResult_RoutingFeesDecodeErrorZPtr { result }
5630                 } else {
5631                         let err = unsafe { o.contents.err };
5632                         unsafe { o.contents.err = core::ptr::null_mut(); }
5633                         CResult_RoutingFeesDecodeErrorZPtr { err }
5634                 };
5635                 Self {
5636                         contents,
5637                         result_ok: o.result_ok,
5638                 }
5639         }
5640 }
5641 impl Clone for CResult_RoutingFeesDecodeErrorZ {
5642         fn clone(&self) -> Self {
5643                 if self.result_ok {
5644                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
5645                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::RoutingFees>::clone(unsafe { &*self.contents.result })))
5646                         } }
5647                 } else {
5648                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
5649                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5650                         } }
5651                 }
5652         }
5653 }
5654 #[no_mangle]
5655 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
5656 /// but with all dynamically-allocated buffers duplicated in new buffers.
5657 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
5658 #[repr(C)]
5659 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5660 /// This corresponds to std::vector in C++
5661 pub struct CVec_NetAddressZ {
5662         /// The elements in the array.
5663         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5664         pub data: *mut crate::lightning::ln::msgs::NetAddress,
5665         /// The number of elements pointed to by `data`.
5666         pub datalen: usize
5667 }
5668 impl CVec_NetAddressZ {
5669         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
5670                 if self.datalen == 0 { return Vec::new(); }
5671                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5672                 self.data = core::ptr::null_mut();
5673                 self.datalen = 0;
5674                 ret
5675         }
5676         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
5677                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5678         }
5679 }
5680 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
5681         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
5682                 let datalen = v.len();
5683                 let data = Box::into_raw(v.into_boxed_slice());
5684                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5685         }
5686 }
5687 #[no_mangle]
5688 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5689 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
5690 impl Drop for CVec_NetAddressZ {
5691         fn drop(&mut self) {
5692                 if self.datalen == 0 { return; }
5693                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5694         }
5695 }
5696 impl Clone for CVec_NetAddressZ {
5697         fn clone(&self) -> Self {
5698                 let mut res = Vec::new();
5699                 if self.datalen == 0 { return Self::from(res); }
5700                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5701                 Self::from(res)
5702         }
5703 }
5704 #[repr(C)]
5705 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5706 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5707         /// A pointer to the contents in the success state.
5708         /// Reading from this pointer when `result_ok` is not set is undefined.
5709         pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo,
5710         /// A pointer to the contents in the error state.
5711         /// Reading from this pointer when `result_ok` is set is undefined.
5712         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5713 }
5714 #[repr(C)]
5715 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5716 /// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5718 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
5719         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5720         /// `err` or `result` depending on the state of `result_ok`.
5721         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
5722         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5723         pub result_ok: bool,
5724 }
5725 #[no_mangle]
5726 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
5727 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5728         CResult_NodeAnnouncementInfoDecodeErrorZ {
5729                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5730                         result: Box::into_raw(Box::new(o)),
5731                 },
5732                 result_ok: true,
5733         }
5734 }
5735 #[no_mangle]
5736 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
5737 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
5738         CResult_NodeAnnouncementInfoDecodeErrorZ {
5739                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5740                         err: Box::into_raw(Box::new(e)),
5741                 },
5742                 result_ok: false,
5743         }
5744 }
5745 /// Checks if the given object is currently in the success state
5746 #[no_mangle]
5747 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
5748         o.result_ok
5749 }
5750 #[no_mangle]
5751 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
5752 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
5753 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
5754         fn drop(&mut self) {
5755                 if self.result_ok {
5756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5758                         }
5759                 } else {
5760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5762                         }
5763                 }
5764         }
5765 }
5766 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
5767         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5768                 let contents = if o.result_ok {
5769                         let result = unsafe { o.contents.result };
5770                         unsafe { o.contents.result = core::ptr::null_mut() };
5771                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
5772                 } else {
5773                         let err = unsafe { o.contents.err };
5774                         unsafe { o.contents.err = core::ptr::null_mut(); }
5775                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
5776                 };
5777                 Self {
5778                         contents,
5779                         result_ok: o.result_ok,
5780                 }
5781         }
5782 }
5783 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
5784         fn clone(&self) -> Self {
5785                 if self.result_ok {
5786                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5787                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
5788                         } }
5789                 } else {
5790                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
5791                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5792                         } }
5793                 }
5794         }
5795 }
5796 #[no_mangle]
5797 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
5798 /// but with all dynamically-allocated buffers duplicated in new buffers.
5799 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
5800 #[repr(C)]
5801 /// The contents of CResult_NodeAliasDecodeErrorZ
5802 pub union CResult_NodeAliasDecodeErrorZPtr {
5803         /// A pointer to the contents in the success state.
5804         /// Reading from this pointer when `result_ok` is not set is undefined.
5805         pub result: *mut crate::lightning::routing::gossip::NodeAlias,
5806         /// A pointer to the contents in the error state.
5807         /// Reading from this pointer when `result_ok` is set is undefined.
5808         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5809 }
5810 #[repr(C)]
5811 /// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5812 /// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5814 pub struct CResult_NodeAliasDecodeErrorZ {
5815         /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5816         /// `err` or `result` depending on the state of `result_ok`.
5817         pub contents: CResult_NodeAliasDecodeErrorZPtr,
5818         /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5819         pub result_ok: bool,
5820 }
5821 #[no_mangle]
5822 /// Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
5823 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ {
5824         CResult_NodeAliasDecodeErrorZ {
5825                 contents: CResult_NodeAliasDecodeErrorZPtr {
5826                         result: Box::into_raw(Box::new(o)),
5827                 },
5828                 result_ok: true,
5829         }
5830 }
5831 #[no_mangle]
5832 /// Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
5833 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ {
5834         CResult_NodeAliasDecodeErrorZ {
5835                 contents: CResult_NodeAliasDecodeErrorZPtr {
5836                         err: Box::into_raw(Box::new(e)),
5837                 },
5838                 result_ok: false,
5839         }
5840 }
5841 /// Checks if the given object is currently in the success state
5842 #[no_mangle]
5843 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool {
5844         o.result_ok
5845 }
5846 #[no_mangle]
5847 /// Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
5848 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { }
5849 impl Drop for CResult_NodeAliasDecodeErrorZ {
5850         fn drop(&mut self) {
5851                 if self.result_ok {
5852                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5853                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5854                         }
5855                 } else {
5856                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5857                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5858                         }
5859                 }
5860         }
5861 }
5862 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAliasDecodeErrorZ {
5863         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeAlias, crate::lightning::ln::msgs::DecodeError>) -> Self {
5864                 let contents = if o.result_ok {
5865                         let result = unsafe { o.contents.result };
5866                         unsafe { o.contents.result = core::ptr::null_mut() };
5867                         CResult_NodeAliasDecodeErrorZPtr { result }
5868                 } else {
5869                         let err = unsafe { o.contents.err };
5870                         unsafe { o.contents.err = core::ptr::null_mut(); }
5871                         CResult_NodeAliasDecodeErrorZPtr { err }
5872                 };
5873                 Self {
5874                         contents,
5875                         result_ok: o.result_ok,
5876                 }
5877         }
5878 }
5879 impl Clone for CResult_NodeAliasDecodeErrorZ {
5880         fn clone(&self) -> Self {
5881                 if self.result_ok {
5882                         Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr {
5883                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeAlias>::clone(unsafe { &*self.contents.result })))
5884                         } }
5885                 } else {
5886                         Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr {
5887                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5888                         } }
5889                 }
5890         }
5891 }
5892 #[no_mangle]
5893 /// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
5894 /// but with all dynamically-allocated buffers duplicated in new buffers.
5895 pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) }
5896 #[repr(C)]
5897 /// The contents of CResult_NodeInfoDecodeErrorZ
5898 pub union CResult_NodeInfoDecodeErrorZPtr {
5899         /// A pointer to the contents in the success state.
5900         /// Reading from this pointer when `result_ok` is not set is undefined.
5901         pub result: *mut crate::lightning::routing::gossip::NodeInfo,
5902         /// A pointer to the contents in the error state.
5903         /// Reading from this pointer when `result_ok` is set is undefined.
5904         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5905 }
5906 #[repr(C)]
5907 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5908 /// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5910 pub struct CResult_NodeInfoDecodeErrorZ {
5911         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5912         /// `err` or `result` depending on the state of `result_ok`.
5913         pub contents: CResult_NodeInfoDecodeErrorZPtr,
5914         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5915         pub result_ok: bool,
5916 }
5917 #[no_mangle]
5918 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
5919 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
5920         CResult_NodeInfoDecodeErrorZ {
5921                 contents: CResult_NodeInfoDecodeErrorZPtr {
5922                         result: Box::into_raw(Box::new(o)),
5923                 },
5924                 result_ok: true,
5925         }
5926 }
5927 #[no_mangle]
5928 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
5929 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
5930         CResult_NodeInfoDecodeErrorZ {
5931                 contents: CResult_NodeInfoDecodeErrorZPtr {
5932                         err: Box::into_raw(Box::new(e)),
5933                 },
5934                 result_ok: false,
5935         }
5936 }
5937 /// Checks if the given object is currently in the success state
5938 #[no_mangle]
5939 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
5940         o.result_ok
5941 }
5942 #[no_mangle]
5943 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
5944 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
5945 impl Drop for CResult_NodeInfoDecodeErrorZ {
5946         fn drop(&mut self) {
5947                 if self.result_ok {
5948                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5949                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5950                         }
5951                 } else {
5952                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5953                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5954                         }
5955                 }
5956         }
5957 }
5958 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
5959         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
5960                 let contents = if o.result_ok {
5961                         let result = unsafe { o.contents.result };
5962                         unsafe { o.contents.result = core::ptr::null_mut() };
5963                         CResult_NodeInfoDecodeErrorZPtr { result }
5964                 } else {
5965                         let err = unsafe { o.contents.err };
5966                         unsafe { o.contents.err = core::ptr::null_mut(); }
5967                         CResult_NodeInfoDecodeErrorZPtr { err }
5968                 };
5969                 Self {
5970                         contents,
5971                         result_ok: o.result_ok,
5972                 }
5973         }
5974 }
5975 impl Clone for CResult_NodeInfoDecodeErrorZ {
5976         fn clone(&self) -> Self {
5977                 if self.result_ok {
5978                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
5979                                 result: Box::into_raw(Box::new(<crate::lightning::routing::gossip::NodeInfo>::clone(unsafe { &*self.contents.result })))
5980                         } }
5981                 } else {
5982                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
5983                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5984                         } }
5985                 }
5986         }
5987 }
5988 #[no_mangle]
5989 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
5990 /// but with all dynamically-allocated buffers duplicated in new buffers.
5991 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
5992 #[repr(C)]
5993 /// The contents of CResult_NetworkGraphDecodeErrorZ
5994 pub union CResult_NetworkGraphDecodeErrorZPtr {
5995         /// A pointer to the contents in the success state.
5996         /// Reading from this pointer when `result_ok` is not set is undefined.
5997         pub result: *mut crate::lightning::routing::gossip::NetworkGraph,
5998         /// A pointer to the contents in the error state.
5999         /// Reading from this pointer when `result_ok` is set is undefined.
6000         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6001 }
6002 #[repr(C)]
6003 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6004 /// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6006 pub struct CResult_NetworkGraphDecodeErrorZ {
6007         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6008         /// `err` or `result` depending on the state of `result_ok`.
6009         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
6010         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6011         pub result_ok: bool,
6012 }
6013 #[no_mangle]
6014 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
6015 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
6016         CResult_NetworkGraphDecodeErrorZ {
6017                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6018                         result: Box::into_raw(Box::new(o)),
6019                 },
6020                 result_ok: true,
6021         }
6022 }
6023 #[no_mangle]
6024 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
6025 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
6026         CResult_NetworkGraphDecodeErrorZ {
6027                 contents: CResult_NetworkGraphDecodeErrorZPtr {
6028                         err: Box::into_raw(Box::new(e)),
6029                 },
6030                 result_ok: false,
6031         }
6032 }
6033 /// Checks if the given object is currently in the success state
6034 #[no_mangle]
6035 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
6036         o.result_ok
6037 }
6038 #[no_mangle]
6039 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
6040 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
6041 impl Drop for CResult_NetworkGraphDecodeErrorZ {
6042         fn drop(&mut self) {
6043                 if self.result_ok {
6044                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6045                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6046                         }
6047                 } else {
6048                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6049                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6050                         }
6051                 }
6052         }
6053 }
6054 impl From<crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
6055         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::gossip::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
6056                 let contents = if o.result_ok {
6057                         let result = unsafe { o.contents.result };
6058                         unsafe { o.contents.result = core::ptr::null_mut() };
6059                         CResult_NetworkGraphDecodeErrorZPtr { result }
6060                 } else {
6061                         let err = unsafe { o.contents.err };
6062                         unsafe { o.contents.err = core::ptr::null_mut(); }
6063                         CResult_NetworkGraphDecodeErrorZPtr { err }
6064                 };
6065                 Self {
6066                         contents,
6067                         result_ok: o.result_ok,
6068                 }
6069         }
6070 }
6071 #[repr(C)]
6072 #[derive(Clone)]
6073 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
6074 pub enum COption_CVec_NetAddressZZ {
6075         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
6076         Some(crate::c_types::derived::CVec_NetAddressZ),
6077         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
6078         None
6079 }
6080 impl COption_CVec_NetAddressZZ {
6081         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6082                 if let Self::None = self { false } else { true }
6083         }
6084         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6085                 !self.is_some()
6086         }
6087         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
6088                 if let Self::Some(v) = self { v } else { unreachable!() }
6089         }
6090 }
6091 #[no_mangle]
6092 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
6093 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
6094         COption_CVec_NetAddressZZ::Some(o)
6095 }
6096 #[no_mangle]
6097 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
6098 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
6099         COption_CVec_NetAddressZZ::None
6100 }
6101 #[no_mangle]
6102 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
6103 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
6104 #[no_mangle]
6105 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
6106 /// but with all dynamically-allocated buffers duplicated in new buffers.
6107 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
6108 #[repr(C)]
6109 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
6110 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6111         /// A pointer to the contents in the success state.
6112         /// Reading from this pointer when `result_ok` is not set is undefined.
6113         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
6114         /// A pointer to the contents in the error state.
6115         /// Reading from this pointer when `result_ok` is set is undefined.
6116         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6117 }
6118 #[repr(C)]
6119 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6120 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6121 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6122 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6123         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
6124         /// `err` or `result` depending on the state of `result_ok`.
6125         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
6126         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
6127         pub result_ok: bool,
6128 }
6129 #[no_mangle]
6130 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
6131 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6132         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6133                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6134                         result: Box::into_raw(Box::new(o)),
6135                 },
6136                 result_ok: true,
6137         }
6138 }
6139 #[no_mangle]
6140 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
6141 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6142         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6143                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6144                         err: Box::into_raw(Box::new(e)),
6145                 },
6146                 result_ok: false,
6147         }
6148 }
6149 /// Checks if the given object is currently in the success state
6150 #[no_mangle]
6151 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
6152         o.result_ok
6153 }
6154 #[no_mangle]
6155 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
6156 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
6157 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6158         fn drop(&mut self) {
6159                 if self.result_ok {
6160                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6161                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6162                         }
6163                 } else {
6164                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6165                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6166                         }
6167                 }
6168         }
6169 }
6170 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6171         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6172                 let contents = if o.result_ok {
6173                         let result = unsafe { o.contents.result };
6174                         unsafe { o.contents.result = core::ptr::null_mut() };
6175                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
6176                 } else {
6177                         let err = unsafe { o.contents.err };
6178                         unsafe { o.contents.err = core::ptr::null_mut(); }
6179                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
6180                 };
6181                 Self {
6182                         contents,
6183                         result_ok: o.result_ok,
6184                 }
6185         }
6186 }
6187 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
6188         fn clone(&self) -> Self {
6189                 if self.result_ok {
6190                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6191                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6192                         } }
6193                 } else {
6194                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
6195                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6196                         } }
6197                 }
6198         }
6199 }
6200 #[no_mangle]
6201 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6202 /// but with all dynamically-allocated buffers duplicated in new buffers.
6203 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6204 #[repr(C)]
6205 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
6206 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6207         /// A pointer to the contents in the success state.
6208         /// Reading from this pointer when `result_ok` is not set is undefined.
6209         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
6210         /// A pointer to the contents in the error state.
6211         /// Reading from this pointer when `result_ok` is set is undefined.
6212         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6213 }
6214 #[repr(C)]
6215 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6216 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6217 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6218 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6219         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
6220         /// `err` or `result` depending on the state of `result_ok`.
6221         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
6222         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
6223         pub result_ok: bool,
6224 }
6225 #[no_mangle]
6226 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
6227 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6228         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6229                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6230                         result: Box::into_raw(Box::new(o)),
6231                 },
6232                 result_ok: true,
6233         }
6234 }
6235 #[no_mangle]
6236 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
6237 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6238         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6239                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6240                         err: Box::into_raw(Box::new(e)),
6241                 },
6242                 result_ok: false,
6243         }
6244 }
6245 /// Checks if the given object is currently in the success state
6246 #[no_mangle]
6247 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
6248         o.result_ok
6249 }
6250 #[no_mangle]
6251 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
6252 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
6253 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6254         fn drop(&mut self) {
6255                 if self.result_ok {
6256                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6257                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6258                         }
6259                 } else {
6260                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6261                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6262                         }
6263                 }
6264         }
6265 }
6266 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6267         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6268                 let contents = if o.result_ok {
6269                         let result = unsafe { o.contents.result };
6270                         unsafe { o.contents.result = core::ptr::null_mut() };
6271                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
6272                 } else {
6273                         let err = unsafe { o.contents.err };
6274                         unsafe { o.contents.err = core::ptr::null_mut(); }
6275                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
6276                 };
6277                 Self {
6278                         contents,
6279                         result_ok: o.result_ok,
6280                 }
6281         }
6282 }
6283 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
6284         fn clone(&self) -> Self {
6285                 if self.result_ok {
6286                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6287                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6288                         } }
6289                 } else {
6290                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
6291                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6292                         } }
6293                 }
6294         }
6295 }
6296 #[no_mangle]
6297 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
6298 /// but with all dynamically-allocated buffers duplicated in new buffers.
6299 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6300 #[repr(C)]
6301 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
6302 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6303         /// A pointer to the contents in the success state.
6304         /// Reading from this pointer when `result_ok` is not set is undefined.
6305         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
6306         /// A pointer to the contents in the error state.
6307         /// Reading from this pointer when `result_ok` is set is undefined.
6308         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6309 }
6310 #[repr(C)]
6311 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
6312 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
6313 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6314 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
6315         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
6316         /// `err` or `result` depending on the state of `result_ok`.
6317         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
6318         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
6319         pub result_ok: bool,
6320 }
6321 #[no_mangle]
6322 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
6323 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6324         CResult_SpendableOutputDescriptorDecodeErrorZ {
6325                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6326                         result: Box::into_raw(Box::new(o)),
6327                 },
6328                 result_ok: true,
6329         }
6330 }
6331 #[no_mangle]
6332 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
6333 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
6334         CResult_SpendableOutputDescriptorDecodeErrorZ {
6335                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6336                         err: Box::into_raw(Box::new(e)),
6337                 },
6338                 result_ok: false,
6339         }
6340 }
6341 /// Checks if the given object is currently in the success state
6342 #[no_mangle]
6343 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
6344         o.result_ok
6345 }
6346 #[no_mangle]
6347 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
6348 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
6349 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
6350         fn drop(&mut self) {
6351                 if self.result_ok {
6352                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6353                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6354                         }
6355                 } else {
6356                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6357                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6358                         }
6359                 }
6360         }
6361 }
6362 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
6363         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
6364                 let contents = if o.result_ok {
6365                         let result = unsafe { o.contents.result };
6366                         unsafe { o.contents.result = core::ptr::null_mut() };
6367                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
6368                 } else {
6369                         let err = unsafe { o.contents.err };
6370                         unsafe { o.contents.err = core::ptr::null_mut(); }
6371                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
6372                 };
6373                 Self {
6374                         contents,
6375                         result_ok: o.result_ok,
6376                 }
6377         }
6378 }
6379 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
6380         fn clone(&self) -> Self {
6381                 if self.result_ok {
6382                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6383                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
6384                         } }
6385                 } else {
6386                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
6387                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6388                         } }
6389                 }
6390         }
6391 }
6392 #[no_mangle]
6393 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
6394 /// but with all dynamically-allocated buffers duplicated in new buffers.
6395 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
6396 #[repr(C)]
6397 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6398 /// This corresponds to std::vector in C++
6399 pub struct CVec_PaymentPreimageZ {
6400         /// The elements in the array.
6401         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6402         pub data: *mut crate::c_types::ThirtyTwoBytes,
6403         /// The number of elements pointed to by `data`.
6404         pub datalen: usize
6405 }
6406 impl CVec_PaymentPreimageZ {
6407         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
6408                 if self.datalen == 0 { return Vec::new(); }
6409                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6410                 self.data = core::ptr::null_mut();
6411                 self.datalen = 0;
6412                 ret
6413         }
6414         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
6415                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6416         }
6417 }
6418 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
6419         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
6420                 let datalen = v.len();
6421                 let data = Box::into_raw(v.into_boxed_slice());
6422                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6423         }
6424 }
6425 #[no_mangle]
6426 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6427 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
6428 impl Drop for CVec_PaymentPreimageZ {
6429         fn drop(&mut self) {
6430                 if self.datalen == 0 { return; }
6431                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6432         }
6433 }
6434 impl Clone for CVec_PaymentPreimageZ {
6435         fn clone(&self) -> Self {
6436                 let mut res = Vec::new();
6437                 if self.datalen == 0 { return Self::from(res); }
6438                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6439                 Self::from(res)
6440         }
6441 }
6442 #[repr(C)]
6443 /// A tuple of 2 elements. See the individual fields for the types contained.
6444 pub struct C2Tuple_SignatureCVec_SignatureZZ {
6445         /// The element at position 0
6446         pub a: crate::c_types::Signature,
6447         /// The element at position 1
6448         pub b: crate::c_types::derived::CVec_SignatureZ,
6449 }
6450 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
6451         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
6452                 Self {
6453                         a: tup.0,
6454                         b: tup.1,
6455                 }
6456         }
6457 }
6458 impl C2Tuple_SignatureCVec_SignatureZZ {
6459         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
6460                 (self.a, self.b)
6461         }
6462 }
6463 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
6464         fn clone(&self) -> Self {
6465                 Self {
6466                         a: Clone::clone(&self.a),
6467                         b: Clone::clone(&self.b),
6468                 }
6469         }
6470 }
6471 #[no_mangle]
6472 /// Creates a new tuple which has the same data as `orig`
6473 /// but with all dynamically-allocated buffers duplicated in new buffers.
6474 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
6475 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
6476 #[no_mangle]
6477 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
6478         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
6479 }
6480
6481 #[no_mangle]
6482 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
6483 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
6484 #[repr(C)]
6485 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6486 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6487         /// A pointer to the contents in the success state.
6488         /// Reading from this pointer when `result_ok` is not set is undefined.
6489         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
6490         /// Note that this value is always NULL, as there are no contents in the Err variant
6491         pub err: *mut core::ffi::c_void,
6492 }
6493 #[repr(C)]
6494 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6495 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6497 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6498         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6499         /// `err` or `result` depending on the state of `result_ok`.
6500         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
6501         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6502         pub result_ok: bool,
6503 }
6504 #[no_mangle]
6505 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
6506 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6507         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6508                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6509                         result: Box::into_raw(Box::new(o)),
6510                 },
6511                 result_ok: true,
6512         }
6513 }
6514 #[no_mangle]
6515 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
6516 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6517         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6518                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6519                         err: core::ptr::null_mut(),
6520                 },
6521                 result_ok: false,
6522         }
6523 }
6524 /// Checks if the given object is currently in the success state
6525 #[no_mangle]
6526 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
6527         o.result_ok
6528 }
6529 #[no_mangle]
6530 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
6531 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
6532 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6533         fn drop(&mut self) {
6534                 if self.result_ok {
6535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6537                         }
6538                 } else {
6539                 }
6540         }
6541 }
6542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6543         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
6544                 let contents = if o.result_ok {
6545                         let result = unsafe { o.contents.result };
6546                         unsafe { o.contents.result = core::ptr::null_mut() };
6547                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
6548                 } else {
6549                         let _ = unsafe { Box::from_raw(o.contents.err) };
6550                         o.contents.err = core::ptr::null_mut();
6551                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
6552                 };
6553                 Self {
6554                         contents,
6555                         result_ok: o.result_ok,
6556                 }
6557         }
6558 }
6559 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6560         fn clone(&self) -> Self {
6561                 if self.result_ok {
6562                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6563                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
6564                         } }
6565                 } else {
6566                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6567                                 err: core::ptr::null_mut()
6568                         } }
6569                 }
6570         }
6571 }
6572 #[no_mangle]
6573 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
6574 /// but with all dynamically-allocated buffers duplicated in new buffers.
6575 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
6576 #[repr(C)]
6577 /// The contents of CResult_SignatureNoneZ
6578 pub union CResult_SignatureNoneZPtr {
6579         /// A pointer to the contents in the success state.
6580         /// Reading from this pointer when `result_ok` is not set is undefined.
6581         pub result: *mut crate::c_types::Signature,
6582         /// Note that this value is always NULL, as there are no contents in the Err variant
6583         pub err: *mut core::ffi::c_void,
6584 }
6585 #[repr(C)]
6586 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
6587 /// containing a crate::c_types::Signature on success and a () on failure.
6588 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6589 pub struct CResult_SignatureNoneZ {
6590         /// The contents of this CResult_SignatureNoneZ, accessible via either
6591         /// `err` or `result` depending on the state of `result_ok`.
6592         pub contents: CResult_SignatureNoneZPtr,
6593         /// Whether this CResult_SignatureNoneZ represents a success state.
6594         pub result_ok: bool,
6595 }
6596 #[no_mangle]
6597 /// Creates a new CResult_SignatureNoneZ in the success state.
6598 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
6599         CResult_SignatureNoneZ {
6600                 contents: CResult_SignatureNoneZPtr {
6601                         result: Box::into_raw(Box::new(o)),
6602                 },
6603                 result_ok: true,
6604         }
6605 }
6606 #[no_mangle]
6607 /// Creates a new CResult_SignatureNoneZ in the error state.
6608 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
6609         CResult_SignatureNoneZ {
6610                 contents: CResult_SignatureNoneZPtr {
6611                         err: core::ptr::null_mut(),
6612                 },
6613                 result_ok: false,
6614         }
6615 }
6616 /// Checks if the given object is currently in the success state
6617 #[no_mangle]
6618 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
6619         o.result_ok
6620 }
6621 #[no_mangle]
6622 /// Frees any resources used by the CResult_SignatureNoneZ.
6623 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
6624 impl Drop for CResult_SignatureNoneZ {
6625         fn drop(&mut self) {
6626                 if self.result_ok {
6627                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6628                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6629                         }
6630                 } else {
6631                 }
6632         }
6633 }
6634 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
6635         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
6636                 let contents = if o.result_ok {
6637                         let result = unsafe { o.contents.result };
6638                         unsafe { o.contents.result = core::ptr::null_mut() };
6639                         CResult_SignatureNoneZPtr { result }
6640                 } else {
6641                         let _ = unsafe { Box::from_raw(o.contents.err) };
6642                         o.contents.err = core::ptr::null_mut();
6643                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
6644                 };
6645                 Self {
6646                         contents,
6647                         result_ok: o.result_ok,
6648                 }
6649         }
6650 }
6651 impl Clone for CResult_SignatureNoneZ {
6652         fn clone(&self) -> Self {
6653                 if self.result_ok {
6654                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
6655                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
6656                         } }
6657                 } else {
6658                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
6659                                 err: core::ptr::null_mut()
6660                         } }
6661                 }
6662         }
6663 }
6664 #[no_mangle]
6665 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
6666 /// but with all dynamically-allocated buffers duplicated in new buffers.
6667 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
6668 #[repr(C)]
6669 /// A tuple of 2 elements. See the individual fields for the types contained.
6670 pub struct C2Tuple_SignatureSignatureZ {
6671         /// The element at position 0
6672         pub a: crate::c_types::Signature,
6673         /// The element at position 1
6674         pub b: crate::c_types::Signature,
6675 }
6676 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
6677         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
6678                 Self {
6679                         a: tup.0,
6680                         b: tup.1,
6681                 }
6682         }
6683 }
6684 impl C2Tuple_SignatureSignatureZ {
6685         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
6686                 (self.a, self.b)
6687         }
6688 }
6689 impl Clone for C2Tuple_SignatureSignatureZ {
6690         fn clone(&self) -> Self {
6691                 Self {
6692                         a: Clone::clone(&self.a),
6693                         b: Clone::clone(&self.b),
6694                 }
6695         }
6696 }
6697 #[no_mangle]
6698 /// Creates a new tuple which has the same data as `orig`
6699 /// but with all dynamically-allocated buffers duplicated in new buffers.
6700 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
6701 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
6702 #[no_mangle]
6703 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
6704         C2Tuple_SignatureSignatureZ { a, b, }
6705 }
6706
6707 #[no_mangle]
6708 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
6709 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
6710 #[repr(C)]
6711 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6712 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6713         /// A pointer to the contents in the success state.
6714         /// Reading from this pointer when `result_ok` is not set is undefined.
6715         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
6716         /// Note that this value is always NULL, as there are no contents in the Err variant
6717         pub err: *mut core::ffi::c_void,
6718 }
6719 #[repr(C)]
6720 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6721 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6723 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
6724         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6725         /// `err` or `result` depending on the state of `result_ok`.
6726         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
6727         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6728         pub result_ok: bool,
6729 }
6730 #[no_mangle]
6731 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
6732 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6733         CResult_C2Tuple_SignatureSignatureZNoneZ {
6734                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6735                         result: Box::into_raw(Box::new(o)),
6736                 },
6737                 result_ok: true,
6738         }
6739 }
6740 #[no_mangle]
6741 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
6742 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
6743         CResult_C2Tuple_SignatureSignatureZNoneZ {
6744                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6745                         err: core::ptr::null_mut(),
6746                 },
6747                 result_ok: false,
6748         }
6749 }
6750 /// Checks if the given object is currently in the success state
6751 #[no_mangle]
6752 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
6753         o.result_ok
6754 }
6755 #[no_mangle]
6756 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
6757 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
6758 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
6759         fn drop(&mut self) {
6760                 if self.result_ok {
6761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6763                         }
6764                 } else {
6765                 }
6766         }
6767 }
6768 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
6769         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
6770                 let contents = if o.result_ok {
6771                         let result = unsafe { o.contents.result };
6772                         unsafe { o.contents.result = core::ptr::null_mut() };
6773                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
6774                 } else {
6775                         let _ = unsafe { Box::from_raw(o.contents.err) };
6776                         o.contents.err = core::ptr::null_mut();
6777                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
6778                 };
6779                 Self {
6780                         contents,
6781                         result_ok: o.result_ok,
6782                 }
6783         }
6784 }
6785 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
6786         fn clone(&self) -> Self {
6787                 if self.result_ok {
6788                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6789                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
6790                         } }
6791                 } else {
6792                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
6793                                 err: core::ptr::null_mut()
6794                         } }
6795                 }
6796         }
6797 }
6798 #[no_mangle]
6799 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
6800 /// but with all dynamically-allocated buffers duplicated in new buffers.
6801 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
6802 #[repr(C)]
6803 /// The contents of CResult_SecretKeyNoneZ
6804 pub union CResult_SecretKeyNoneZPtr {
6805         /// A pointer to the contents in the success state.
6806         /// Reading from this pointer when `result_ok` is not set is undefined.
6807         pub result: *mut crate::c_types::SecretKey,
6808         /// Note that this value is always NULL, as there are no contents in the Err variant
6809         pub err: *mut core::ffi::c_void,
6810 }
6811 #[repr(C)]
6812 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6813 /// containing a crate::c_types::SecretKey on success and a () on failure.
6814 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6815 pub struct CResult_SecretKeyNoneZ {
6816         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
6817         /// `err` or `result` depending on the state of `result_ok`.
6818         pub contents: CResult_SecretKeyNoneZPtr,
6819         /// Whether this CResult_SecretKeyNoneZ represents a success state.
6820         pub result_ok: bool,
6821 }
6822 #[no_mangle]
6823 /// Creates a new CResult_SecretKeyNoneZ in the success state.
6824 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
6825         CResult_SecretKeyNoneZ {
6826                 contents: CResult_SecretKeyNoneZPtr {
6827                         result: Box::into_raw(Box::new(o)),
6828                 },
6829                 result_ok: true,
6830         }
6831 }
6832 #[no_mangle]
6833 /// Creates a new CResult_SecretKeyNoneZ in the error state.
6834 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
6835         CResult_SecretKeyNoneZ {
6836                 contents: CResult_SecretKeyNoneZPtr {
6837                         err: core::ptr::null_mut(),
6838                 },
6839                 result_ok: false,
6840         }
6841 }
6842 /// Checks if the given object is currently in the success state
6843 #[no_mangle]
6844 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
6845         o.result_ok
6846 }
6847 #[no_mangle]
6848 /// Frees any resources used by the CResult_SecretKeyNoneZ.
6849 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
6850 impl Drop for CResult_SecretKeyNoneZ {
6851         fn drop(&mut self) {
6852                 if self.result_ok {
6853                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6854                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6855                         }
6856                 } else {
6857                 }
6858         }
6859 }
6860 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
6861         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
6862                 let contents = if o.result_ok {
6863                         let result = unsafe { o.contents.result };
6864                         unsafe { o.contents.result = core::ptr::null_mut() };
6865                         CResult_SecretKeyNoneZPtr { result }
6866                 } else {
6867                         let _ = unsafe { Box::from_raw(o.contents.err) };
6868                         o.contents.err = core::ptr::null_mut();
6869                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
6870                 };
6871                 Self {
6872                         contents,
6873                         result_ok: o.result_ok,
6874                 }
6875         }
6876 }
6877 impl Clone for CResult_SecretKeyNoneZ {
6878         fn clone(&self) -> Self {
6879                 if self.result_ok {
6880                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
6881                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
6882                         } }
6883                 } else {
6884                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
6885                                 err: core::ptr::null_mut()
6886                         } }
6887                 }
6888         }
6889 }
6890 #[no_mangle]
6891 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
6892 /// but with all dynamically-allocated buffers duplicated in new buffers.
6893 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
6894 #[repr(C)]
6895 /// The contents of CResult_SignDecodeErrorZ
6896 pub union CResult_SignDecodeErrorZPtr {
6897         /// A pointer to the contents in the success state.
6898         /// Reading from this pointer when `result_ok` is not set is undefined.
6899         pub result: *mut crate::lightning::chain::keysinterface::Sign,
6900         /// A pointer to the contents in the error state.
6901         /// Reading from this pointer when `result_ok` is set is undefined.
6902         pub err: *mut crate::lightning::ln::msgs::DecodeError,
6903 }
6904 #[repr(C)]
6905 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6906 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6907 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6908 pub struct CResult_SignDecodeErrorZ {
6909         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
6910         /// `err` or `result` depending on the state of `result_ok`.
6911         pub contents: CResult_SignDecodeErrorZPtr,
6912         /// Whether this CResult_SignDecodeErrorZ represents a success state.
6913         pub result_ok: bool,
6914 }
6915 #[no_mangle]
6916 /// Creates a new CResult_SignDecodeErrorZ in the success state.
6917 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
6918         CResult_SignDecodeErrorZ {
6919                 contents: CResult_SignDecodeErrorZPtr {
6920                         result: Box::into_raw(Box::new(o)),
6921                 },
6922                 result_ok: true,
6923         }
6924 }
6925 #[no_mangle]
6926 /// Creates a new CResult_SignDecodeErrorZ in the error state.
6927 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
6928         CResult_SignDecodeErrorZ {
6929                 contents: CResult_SignDecodeErrorZPtr {
6930                         err: Box::into_raw(Box::new(e)),
6931                 },
6932                 result_ok: false,
6933         }
6934 }
6935 /// Checks if the given object is currently in the success state
6936 #[no_mangle]
6937 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
6938         o.result_ok
6939 }
6940 #[no_mangle]
6941 /// Frees any resources used by the CResult_SignDecodeErrorZ.
6942 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
6943 impl Drop for CResult_SignDecodeErrorZ {
6944         fn drop(&mut self) {
6945                 if self.result_ok {
6946                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6947                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6948                         }
6949                 } else {
6950                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6951                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6952                         }
6953                 }
6954         }
6955 }
6956 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
6957         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
6958                 let contents = if o.result_ok {
6959                         let result = unsafe { o.contents.result };
6960                         unsafe { o.contents.result = core::ptr::null_mut() };
6961                         CResult_SignDecodeErrorZPtr { result }
6962                 } else {
6963                         let err = unsafe { o.contents.err };
6964                         unsafe { o.contents.err = core::ptr::null_mut(); }
6965                         CResult_SignDecodeErrorZPtr { err }
6966                 };
6967                 Self {
6968                         contents,
6969                         result_ok: o.result_ok,
6970                 }
6971         }
6972 }
6973 impl Clone for CResult_SignDecodeErrorZ {
6974         fn clone(&self) -> Self {
6975                 if self.result_ok {
6976                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
6977                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
6978                         } }
6979                 } else {
6980                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
6981                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6982                         } }
6983                 }
6984         }
6985 }
6986 #[no_mangle]
6987 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
6988 /// but with all dynamically-allocated buffers duplicated in new buffers.
6989 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
6990 #[repr(C)]
6991 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6992 /// This corresponds to std::vector in C++
6993 pub struct CVec_u5Z {
6994         /// The elements in the array.
6995         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6996         pub data: *mut crate::c_types::u5,
6997         /// The number of elements pointed to by `data`.
6998         pub datalen: usize
6999 }
7000 impl CVec_u5Z {
7001         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
7002                 if self.datalen == 0 { return Vec::new(); }
7003                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7004                 self.data = core::ptr::null_mut();
7005                 self.datalen = 0;
7006                 ret
7007         }
7008         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
7009                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7010         }
7011 }
7012 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
7013         fn from(v: Vec<crate::c_types::u5>) -> Self {
7014                 let datalen = v.len();
7015                 let data = Box::into_raw(v.into_boxed_slice());
7016                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7017         }
7018 }
7019 #[no_mangle]
7020 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7021 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
7022 impl Drop for CVec_u5Z {
7023         fn drop(&mut self) {
7024                 if self.datalen == 0 { return; }
7025                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7026         }
7027 }
7028 impl Clone for CVec_u5Z {
7029         fn clone(&self) -> Self {
7030                 let mut res = Vec::new();
7031                 if self.datalen == 0 { return Self::from(res); }
7032                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7033                 Self::from(res)
7034         }
7035 }
7036 #[repr(C)]
7037 /// The contents of CResult_RecoverableSignatureNoneZ
7038 pub union CResult_RecoverableSignatureNoneZPtr {
7039         /// A pointer to the contents in the success state.
7040         /// Reading from this pointer when `result_ok` is not set is undefined.
7041         pub result: *mut crate::c_types::RecoverableSignature,
7042         /// Note that this value is always NULL, as there are no contents in the Err variant
7043         pub err: *mut core::ffi::c_void,
7044 }
7045 #[repr(C)]
7046 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
7047 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
7048 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7049 pub struct CResult_RecoverableSignatureNoneZ {
7050         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
7051         /// `err` or `result` depending on the state of `result_ok`.
7052         pub contents: CResult_RecoverableSignatureNoneZPtr,
7053         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
7054         pub result_ok: bool,
7055 }
7056 #[no_mangle]
7057 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
7058 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
7059         CResult_RecoverableSignatureNoneZ {
7060                 contents: CResult_RecoverableSignatureNoneZPtr {
7061                         result: Box::into_raw(Box::new(o)),
7062                 },
7063                 result_ok: true,
7064         }
7065 }
7066 #[no_mangle]
7067 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
7068 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
7069         CResult_RecoverableSignatureNoneZ {
7070                 contents: CResult_RecoverableSignatureNoneZPtr {
7071                         err: core::ptr::null_mut(),
7072                 },
7073                 result_ok: false,
7074         }
7075 }
7076 /// Checks if the given object is currently in the success state
7077 #[no_mangle]
7078 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
7079         o.result_ok
7080 }
7081 #[no_mangle]
7082 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
7083 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
7084 impl Drop for CResult_RecoverableSignatureNoneZ {
7085         fn drop(&mut self) {
7086                 if self.result_ok {
7087                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7088                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7089                         }
7090                 } else {
7091                 }
7092         }
7093 }
7094 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
7095         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
7096                 let contents = if o.result_ok {
7097                         let result = unsafe { o.contents.result };
7098                         unsafe { o.contents.result = core::ptr::null_mut() };
7099                         CResult_RecoverableSignatureNoneZPtr { result }
7100                 } else {
7101                         let _ = unsafe { Box::from_raw(o.contents.err) };
7102                         o.contents.err = core::ptr::null_mut();
7103                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
7104                 };
7105                 Self {
7106                         contents,
7107                         result_ok: o.result_ok,
7108                 }
7109         }
7110 }
7111 impl Clone for CResult_RecoverableSignatureNoneZ {
7112         fn clone(&self) -> Self {
7113                 if self.result_ok {
7114                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
7115                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
7116                         } }
7117                 } else {
7118                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
7119                                 err: core::ptr::null_mut()
7120                         } }
7121                 }
7122         }
7123 }
7124 #[no_mangle]
7125 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
7126 /// but with all dynamically-allocated buffers duplicated in new buffers.
7127 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
7128 #[repr(C)]
7129 /// A dynamically-allocated array of u8s of arbitrary size.
7130 /// This corresponds to std::vector in C++
7131 pub struct CVec_u8Z {
7132         /// The elements in the array.
7133         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7134         pub data: *mut u8,
7135         /// The number of elements pointed to by `data`.
7136         pub datalen: usize
7137 }
7138 impl CVec_u8Z {
7139         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
7140                 if self.datalen == 0 { return Vec::new(); }
7141                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7142                 self.data = core::ptr::null_mut();
7143                 self.datalen = 0;
7144                 ret
7145         }
7146         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
7147                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7148         }
7149 }
7150 impl From<Vec<u8>> for CVec_u8Z {
7151         fn from(v: Vec<u8>) -> Self {
7152                 let datalen = v.len();
7153                 let data = Box::into_raw(v.into_boxed_slice());
7154                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7155         }
7156 }
7157 #[no_mangle]
7158 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7159 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
7160 impl Drop for CVec_u8Z {
7161         fn drop(&mut self) {
7162                 if self.datalen == 0 { return; }
7163                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7164         }
7165 }
7166 impl Clone for CVec_u8Z {
7167         fn clone(&self) -> Self {
7168                 let mut res = Vec::new();
7169                 if self.datalen == 0 { return Self::from(res); }
7170                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7171                 Self::from(res)
7172         }
7173 }
7174 #[repr(C)]
7175 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
7176 /// This corresponds to std::vector in C++
7177 pub struct CVec_CVec_u8ZZ {
7178         /// The elements in the array.
7179         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7180         pub data: *mut crate::c_types::derived::CVec_u8Z,
7181         /// The number of elements pointed to by `data`.
7182         pub datalen: usize
7183 }
7184 impl CVec_CVec_u8ZZ {
7185         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
7186                 if self.datalen == 0 { return Vec::new(); }
7187                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7188                 self.data = core::ptr::null_mut();
7189                 self.datalen = 0;
7190                 ret
7191         }
7192         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
7193                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7194         }
7195 }
7196 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
7197         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
7198                 let datalen = v.len();
7199                 let data = Box::into_raw(v.into_boxed_slice());
7200                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7201         }
7202 }
7203 #[no_mangle]
7204 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7205 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
7206 impl Drop for CVec_CVec_u8ZZ {
7207         fn drop(&mut self) {
7208                 if self.datalen == 0 { return; }
7209                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7210         }
7211 }
7212 impl Clone for CVec_CVec_u8ZZ {
7213         fn clone(&self) -> Self {
7214                 let mut res = Vec::new();
7215                 if self.datalen == 0 { return Self::from(res); }
7216                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7217                 Self::from(res)
7218         }
7219 }
7220 #[repr(C)]
7221 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
7222 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
7223         /// A pointer to the contents in the success state.
7224         /// Reading from this pointer when `result_ok` is not set is undefined.
7225         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
7226         /// Note that this value is always NULL, as there are no contents in the Err variant
7227         pub err: *mut core::ffi::c_void,
7228 }
7229 #[repr(C)]
7230 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
7231 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
7232 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7233 pub struct CResult_CVec_CVec_u8ZZNoneZ {
7234         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
7235         /// `err` or `result` depending on the state of `result_ok`.
7236         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
7237         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
7238         pub result_ok: bool,
7239 }
7240 #[no_mangle]
7241 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
7242 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
7243         CResult_CVec_CVec_u8ZZNoneZ {
7244                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7245                         result: Box::into_raw(Box::new(o)),
7246                 },
7247                 result_ok: true,
7248         }
7249 }
7250 #[no_mangle]
7251 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
7252 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
7253         CResult_CVec_CVec_u8ZZNoneZ {
7254                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7255                         err: core::ptr::null_mut(),
7256                 },
7257                 result_ok: false,
7258         }
7259 }
7260 /// Checks if the given object is currently in the success state
7261 #[no_mangle]
7262 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
7263         o.result_ok
7264 }
7265 #[no_mangle]
7266 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
7267 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
7268 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
7269         fn drop(&mut self) {
7270                 if self.result_ok {
7271                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7272                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7273                         }
7274                 } else {
7275                 }
7276         }
7277 }
7278 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
7279         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
7280                 let contents = if o.result_ok {
7281                         let result = unsafe { o.contents.result };
7282                         unsafe { o.contents.result = core::ptr::null_mut() };
7283                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
7284                 } else {
7285                         let _ = unsafe { Box::from_raw(o.contents.err) };
7286                         o.contents.err = core::ptr::null_mut();
7287                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
7288                 };
7289                 Self {
7290                         contents,
7291                         result_ok: o.result_ok,
7292                 }
7293         }
7294 }
7295 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
7296         fn clone(&self) -> Self {
7297                 if self.result_ok {
7298                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7299                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
7300                         } }
7301                 } else {
7302                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
7303                                 err: core::ptr::null_mut()
7304                         } }
7305                 }
7306         }
7307 }
7308 #[no_mangle]
7309 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
7310 /// but with all dynamically-allocated buffers duplicated in new buffers.
7311 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
7312 #[repr(C)]
7313 /// The contents of CResult_InMemorySignerDecodeErrorZ
7314 pub union CResult_InMemorySignerDecodeErrorZPtr {
7315         /// A pointer to the contents in the success state.
7316         /// Reading from this pointer when `result_ok` is not set is undefined.
7317         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
7318         /// A pointer to the contents in the error state.
7319         /// Reading from this pointer when `result_ok` is set is undefined.
7320         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7321 }
7322 #[repr(C)]
7323 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
7324 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
7325 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7326 pub struct CResult_InMemorySignerDecodeErrorZ {
7327         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
7328         /// `err` or `result` depending on the state of `result_ok`.
7329         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
7330         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
7331         pub result_ok: bool,
7332 }
7333 #[no_mangle]
7334 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
7335 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
7336         CResult_InMemorySignerDecodeErrorZ {
7337                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7338                         result: Box::into_raw(Box::new(o)),
7339                 },
7340                 result_ok: true,
7341         }
7342 }
7343 #[no_mangle]
7344 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
7345 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
7346         CResult_InMemorySignerDecodeErrorZ {
7347                 contents: CResult_InMemorySignerDecodeErrorZPtr {
7348                         err: Box::into_raw(Box::new(e)),
7349                 },
7350                 result_ok: false,
7351         }
7352 }
7353 /// Checks if the given object is currently in the success state
7354 #[no_mangle]
7355 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
7356         o.result_ok
7357 }
7358 #[no_mangle]
7359 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
7360 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
7361 impl Drop for CResult_InMemorySignerDecodeErrorZ {
7362         fn drop(&mut self) {
7363                 if self.result_ok {
7364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7366                         }
7367                 } else {
7368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7370                         }
7371                 }
7372         }
7373 }
7374 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
7375         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
7376                 let contents = if o.result_ok {
7377                         let result = unsafe { o.contents.result };
7378                         unsafe { o.contents.result = core::ptr::null_mut() };
7379                         CResult_InMemorySignerDecodeErrorZPtr { result }
7380                 } else {
7381                         let err = unsafe { o.contents.err };
7382                         unsafe { o.contents.err = core::ptr::null_mut(); }
7383                         CResult_InMemorySignerDecodeErrorZPtr { err }
7384                 };
7385                 Self {
7386                         contents,
7387                         result_ok: o.result_ok,
7388                 }
7389         }
7390 }
7391 impl Clone for CResult_InMemorySignerDecodeErrorZ {
7392         fn clone(&self) -> Self {
7393                 if self.result_ok {
7394                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
7395                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
7396                         } }
7397                 } else {
7398                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
7399                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7400                         } }
7401                 }
7402         }
7403 }
7404 #[no_mangle]
7405 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
7406 /// but with all dynamically-allocated buffers duplicated in new buffers.
7407 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
7408 #[repr(C)]
7409 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
7410 /// This corresponds to std::vector in C++
7411 pub struct CVec_TxOutZ {
7412         /// The elements in the array.
7413         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7414         pub data: *mut crate::c_types::TxOut,
7415         /// The number of elements pointed to by `data`.
7416         pub datalen: usize
7417 }
7418 impl CVec_TxOutZ {
7419         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
7420                 if self.datalen == 0 { return Vec::new(); }
7421                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7422                 self.data = core::ptr::null_mut();
7423                 self.datalen = 0;
7424                 ret
7425         }
7426         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
7427                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7428         }
7429 }
7430 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
7431         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
7432                 let datalen = v.len();
7433                 let data = Box::into_raw(v.into_boxed_slice());
7434                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7435         }
7436 }
7437 #[no_mangle]
7438 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7439 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
7440 impl Drop for CVec_TxOutZ {
7441         fn drop(&mut self) {
7442                 if self.datalen == 0 { return; }
7443                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7444         }
7445 }
7446 impl Clone for CVec_TxOutZ {
7447         fn clone(&self) -> Self {
7448                 let mut res = Vec::new();
7449                 if self.datalen == 0 { return Self::from(res); }
7450                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7451                 Self::from(res)
7452         }
7453 }
7454 #[repr(C)]
7455 /// The contents of CResult_TransactionNoneZ
7456 pub union CResult_TransactionNoneZPtr {
7457         /// A pointer to the contents in the success state.
7458         /// Reading from this pointer when `result_ok` is not set is undefined.
7459         pub result: *mut crate::c_types::Transaction,
7460         /// Note that this value is always NULL, as there are no contents in the Err variant
7461         pub err: *mut core::ffi::c_void,
7462 }
7463 #[repr(C)]
7464 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
7465 /// containing a crate::c_types::Transaction on success and a () on failure.
7466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7467 pub struct CResult_TransactionNoneZ {
7468         /// The contents of this CResult_TransactionNoneZ, accessible via either
7469         /// `err` or `result` depending on the state of `result_ok`.
7470         pub contents: CResult_TransactionNoneZPtr,
7471         /// Whether this CResult_TransactionNoneZ represents a success state.
7472         pub result_ok: bool,
7473 }
7474 #[no_mangle]
7475 /// Creates a new CResult_TransactionNoneZ in the success state.
7476 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
7477         CResult_TransactionNoneZ {
7478                 contents: CResult_TransactionNoneZPtr {
7479                         result: Box::into_raw(Box::new(o)),
7480                 },
7481                 result_ok: true,
7482         }
7483 }
7484 #[no_mangle]
7485 /// Creates a new CResult_TransactionNoneZ in the error state.
7486 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
7487         CResult_TransactionNoneZ {
7488                 contents: CResult_TransactionNoneZPtr {
7489                         err: core::ptr::null_mut(),
7490                 },
7491                 result_ok: false,
7492         }
7493 }
7494 /// Checks if the given object is currently in the success state
7495 #[no_mangle]
7496 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
7497         o.result_ok
7498 }
7499 #[no_mangle]
7500 /// Frees any resources used by the CResult_TransactionNoneZ.
7501 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
7502 impl Drop for CResult_TransactionNoneZ {
7503         fn drop(&mut self) {
7504                 if self.result_ok {
7505                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7506                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7507                         }
7508                 } else {
7509                 }
7510         }
7511 }
7512 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
7513         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
7514                 let contents = if o.result_ok {
7515                         let result = unsafe { o.contents.result };
7516                         unsafe { o.contents.result = core::ptr::null_mut() };
7517                         CResult_TransactionNoneZPtr { result }
7518                 } else {
7519                         let _ = unsafe { Box::from_raw(o.contents.err) };
7520                         o.contents.err = core::ptr::null_mut();
7521                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
7522                 };
7523                 Self {
7524                         contents,
7525                         result_ok: o.result_ok,
7526                 }
7527         }
7528 }
7529 impl Clone for CResult_TransactionNoneZ {
7530         fn clone(&self) -> Self {
7531                 if self.result_ok {
7532                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
7533                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
7534                         } }
7535                 } else {
7536                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
7537                                 err: core::ptr::null_mut()
7538                         } }
7539                 }
7540         }
7541 }
7542 #[no_mangle]
7543 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
7544 /// but with all dynamically-allocated buffers duplicated in new buffers.
7545 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
7546 #[repr(C)]
7547 /// A tuple of 2 elements. See the individual fields for the types contained.
7548 pub struct C2Tuple_BlockHashChannelMonitorZ {
7549         /// The element at position 0
7550         pub a: crate::c_types::ThirtyTwoBytes,
7551         /// The element at position 1
7552         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
7553 }
7554 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
7555         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
7556                 Self {
7557                         a: tup.0,
7558                         b: tup.1,
7559                 }
7560         }
7561 }
7562 impl C2Tuple_BlockHashChannelMonitorZ {
7563         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
7564                 (self.a, self.b)
7565         }
7566 }
7567 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
7568 #[no_mangle]
7569 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
7570         C2Tuple_BlockHashChannelMonitorZ { a, b, }
7571 }
7572
7573 #[no_mangle]
7574 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
7575 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
7576 #[repr(C)]
7577 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
7578 /// This corresponds to std::vector in C++
7579 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
7580         /// The elements in the array.
7581         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7582         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
7583         /// The number of elements pointed to by `data`.
7584         pub datalen: usize
7585 }
7586 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
7587         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
7588                 if self.datalen == 0 { return Vec::new(); }
7589                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7590                 self.data = core::ptr::null_mut();
7591                 self.datalen = 0;
7592                 ret
7593         }
7594         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
7595                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7596         }
7597 }
7598 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7599         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
7600                 let datalen = v.len();
7601                 let data = Box::into_raw(v.into_boxed_slice());
7602                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7603         }
7604 }
7605 #[no_mangle]
7606 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7607 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
7608 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
7609         fn drop(&mut self) {
7610                 if self.datalen == 0 { return; }
7611                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7612         }
7613 }
7614 #[repr(C)]
7615 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
7616 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7617         /// A pointer to the contents in the success state.
7618         /// Reading from this pointer when `result_ok` is not set is undefined.
7619         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
7620         /// A pointer to the contents in the error state.
7621         /// Reading from this pointer when `result_ok` is set is undefined.
7622         pub err: *mut crate::c_types::IOError,
7623 }
7624 #[repr(C)]
7625 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
7626 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
7627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7628 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7629         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
7630         /// `err` or `result` depending on the state of `result_ok`.
7631         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
7632         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
7633         pub result_ok: bool,
7634 }
7635 #[no_mangle]
7636 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
7637 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7638         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7639                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7640                         result: Box::into_raw(Box::new(o)),
7641                 },
7642                 result_ok: true,
7643         }
7644 }
7645 #[no_mangle]
7646 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
7647 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7648         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7649                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
7650                         err: Box::into_raw(Box::new(e)),
7651                 },
7652                 result_ok: false,
7653         }
7654 }
7655 /// Checks if the given object is currently in the success state
7656 #[no_mangle]
7657 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
7658         o.result_ok
7659 }
7660 #[no_mangle]
7661 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
7662 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
7663 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7664         fn drop(&mut self) {
7665                 if self.result_ok {
7666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7668                         }
7669                 } else {
7670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7672                         }
7673                 }
7674         }
7675 }
7676 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
7677         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
7678                 let contents = if o.result_ok {
7679                         let result = unsafe { o.contents.result };
7680                         unsafe { o.contents.result = core::ptr::null_mut() };
7681                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
7682                 } else {
7683                         let err = unsafe { o.contents.err };
7684                         unsafe { o.contents.err = core::ptr::null_mut(); }
7685                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
7686                 };
7687                 Self {
7688                         contents,
7689                         result_ok: o.result_ok,
7690                 }
7691         }
7692 }
7693 #[repr(C)]
7694 #[derive(Clone)]
7695 /// An enum which can either contain a u16 or not
7696 pub enum COption_u16Z {
7697         /// When we're in this state, this COption_u16Z contains a u16
7698         Some(u16),
7699         /// When we're in this state, this COption_u16Z contains nothing
7700         None
7701 }
7702 impl COption_u16Z {
7703         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7704                 if let Self::None = self { false } else { true }
7705         }
7706         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7707                 !self.is_some()
7708         }
7709         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
7710                 if let Self::Some(v) = self { v } else { unreachable!() }
7711         }
7712 }
7713 #[no_mangle]
7714 /// Constructs a new COption_u16Z containing a u16
7715 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
7716         COption_u16Z::Some(o)
7717 }
7718 #[no_mangle]
7719 /// Constructs a new COption_u16Z containing nothing
7720 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
7721         COption_u16Z::None
7722 }
7723 #[no_mangle]
7724 /// Frees any resources associated with the u16, if we are in the Some state
7725 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
7726 #[no_mangle]
7727 /// Creates a new COption_u16Z which has the same data as `orig`
7728 /// but with all dynamically-allocated buffers duplicated in new buffers.
7729 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
7730 #[repr(C)]
7731 /// The contents of CResult_NoneAPIErrorZ
7732 pub union CResult_NoneAPIErrorZPtr {
7733         /// Note that this value is always NULL, as there are no contents in the OK variant
7734         pub result: *mut core::ffi::c_void,
7735         /// A pointer to the contents in the error state.
7736         /// Reading from this pointer when `result_ok` is set is undefined.
7737         pub err: *mut crate::lightning::util::errors::APIError,
7738 }
7739 #[repr(C)]
7740 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
7741 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
7742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7743 pub struct CResult_NoneAPIErrorZ {
7744         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
7745         /// `err` or `result` depending on the state of `result_ok`.
7746         pub contents: CResult_NoneAPIErrorZPtr,
7747         /// Whether this CResult_NoneAPIErrorZ represents a success state.
7748         pub result_ok: bool,
7749 }
7750 #[no_mangle]
7751 /// Creates a new CResult_NoneAPIErrorZ in the success state.
7752 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
7753         CResult_NoneAPIErrorZ {
7754                 contents: CResult_NoneAPIErrorZPtr {
7755                         result: core::ptr::null_mut(),
7756                 },
7757                 result_ok: true,
7758         }
7759 }
7760 #[no_mangle]
7761 /// Creates a new CResult_NoneAPIErrorZ in the error state.
7762 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
7763         CResult_NoneAPIErrorZ {
7764                 contents: CResult_NoneAPIErrorZPtr {
7765                         err: Box::into_raw(Box::new(e)),
7766                 },
7767                 result_ok: false,
7768         }
7769 }
7770 /// Checks if the given object is currently in the success state
7771 #[no_mangle]
7772 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
7773         o.result_ok
7774 }
7775 #[no_mangle]
7776 /// Frees any resources used by the CResult_NoneAPIErrorZ.
7777 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
7778 impl Drop for CResult_NoneAPIErrorZ {
7779         fn drop(&mut self) {
7780                 if self.result_ok {
7781                 } else {
7782                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7783                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7784                         }
7785                 }
7786         }
7787 }
7788 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
7789         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
7790                 let contents = if o.result_ok {
7791                         let _ = unsafe { Box::from_raw(o.contents.result) };
7792                         o.contents.result = core::ptr::null_mut();
7793                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
7794                 } else {
7795                         let err = unsafe { o.contents.err };
7796                         unsafe { o.contents.err = core::ptr::null_mut(); }
7797                         CResult_NoneAPIErrorZPtr { err }
7798                 };
7799                 Self {
7800                         contents,
7801                         result_ok: o.result_ok,
7802                 }
7803         }
7804 }
7805 impl Clone for CResult_NoneAPIErrorZ {
7806         fn clone(&self) -> Self {
7807                 if self.result_ok {
7808                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
7809                                 result: core::ptr::null_mut()
7810                         } }
7811                 } else {
7812                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
7813                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7814                         } }
7815                 }
7816         }
7817 }
7818 #[no_mangle]
7819 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
7820 /// but with all dynamically-allocated buffers duplicated in new buffers.
7821 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
7822 #[repr(C)]
7823 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
7824 /// This corresponds to std::vector in C++
7825 pub struct CVec_CResult_NoneAPIErrorZZ {
7826         /// The elements in the array.
7827         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7828         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
7829         /// The number of elements pointed to by `data`.
7830         pub datalen: usize
7831 }
7832 impl CVec_CResult_NoneAPIErrorZZ {
7833         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
7834                 if self.datalen == 0 { return Vec::new(); }
7835                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7836                 self.data = core::ptr::null_mut();
7837                 self.datalen = 0;
7838                 ret
7839         }
7840         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
7841                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7842         }
7843 }
7844 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
7845         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
7846                 let datalen = v.len();
7847                 let data = Box::into_raw(v.into_boxed_slice());
7848                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7849         }
7850 }
7851 #[no_mangle]
7852 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7853 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
7854 impl Drop for CVec_CResult_NoneAPIErrorZZ {
7855         fn drop(&mut self) {
7856                 if self.datalen == 0 { return; }
7857                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7858         }
7859 }
7860 impl Clone for CVec_CResult_NoneAPIErrorZZ {
7861         fn clone(&self) -> Self {
7862                 let mut res = Vec::new();
7863                 if self.datalen == 0 { return Self::from(res); }
7864                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7865                 Self::from(res)
7866         }
7867 }
7868 #[repr(C)]
7869 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
7870 /// This corresponds to std::vector in C++
7871 pub struct CVec_APIErrorZ {
7872         /// The elements in the array.
7873         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7874         pub data: *mut crate::lightning::util::errors::APIError,
7875         /// The number of elements pointed to by `data`.
7876         pub datalen: usize
7877 }
7878 impl CVec_APIErrorZ {
7879         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
7880                 if self.datalen == 0 { return Vec::new(); }
7881                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7882                 self.data = core::ptr::null_mut();
7883                 self.datalen = 0;
7884                 ret
7885         }
7886         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
7887                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7888         }
7889 }
7890 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
7891         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
7892                 let datalen = v.len();
7893                 let data = Box::into_raw(v.into_boxed_slice());
7894                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7895         }
7896 }
7897 #[no_mangle]
7898 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7899 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
7900 impl Drop for CVec_APIErrorZ {
7901         fn drop(&mut self) {
7902                 if self.datalen == 0 { return; }
7903                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7904         }
7905 }
7906 impl Clone for CVec_APIErrorZ {
7907         fn clone(&self) -> Self {
7908                 let mut res = Vec::new();
7909                 if self.datalen == 0 { return Self::from(res); }
7910                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
7911                 Self::from(res)
7912         }
7913 }
7914 #[repr(C)]
7915 /// The contents of CResult__u832APIErrorZ
7916 pub union CResult__u832APIErrorZPtr {
7917         /// A pointer to the contents in the success state.
7918         /// Reading from this pointer when `result_ok` is not set is undefined.
7919         pub result: *mut crate::c_types::ThirtyTwoBytes,
7920         /// A pointer to the contents in the error state.
7921         /// Reading from this pointer when `result_ok` is set is undefined.
7922         pub err: *mut crate::lightning::util::errors::APIError,
7923 }
7924 #[repr(C)]
7925 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
7926 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7928 pub struct CResult__u832APIErrorZ {
7929         /// The contents of this CResult__u832APIErrorZ, accessible via either
7930         /// `err` or `result` depending on the state of `result_ok`.
7931         pub contents: CResult__u832APIErrorZPtr,
7932         /// Whether this CResult__u832APIErrorZ represents a success state.
7933         pub result_ok: bool,
7934 }
7935 #[no_mangle]
7936 /// Creates a new CResult__u832APIErrorZ in the success state.
7937 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
7938         CResult__u832APIErrorZ {
7939                 contents: CResult__u832APIErrorZPtr {
7940                         result: Box::into_raw(Box::new(o)),
7941                 },
7942                 result_ok: true,
7943         }
7944 }
7945 #[no_mangle]
7946 /// Creates a new CResult__u832APIErrorZ in the error state.
7947 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
7948         CResult__u832APIErrorZ {
7949                 contents: CResult__u832APIErrorZPtr {
7950                         err: Box::into_raw(Box::new(e)),
7951                 },
7952                 result_ok: false,
7953         }
7954 }
7955 /// Checks if the given object is currently in the success state
7956 #[no_mangle]
7957 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
7958         o.result_ok
7959 }
7960 #[no_mangle]
7961 /// Frees any resources used by the CResult__u832APIErrorZ.
7962 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
7963 impl Drop for CResult__u832APIErrorZ {
7964         fn drop(&mut self) {
7965                 if self.result_ok {
7966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7968                         }
7969                 } else {
7970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7972                         }
7973                 }
7974         }
7975 }
7976 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
7977         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7978                 let contents = if o.result_ok {
7979                         let result = unsafe { o.contents.result };
7980                         unsafe { o.contents.result = core::ptr::null_mut() };
7981                         CResult__u832APIErrorZPtr { result }
7982                 } else {
7983                         let err = unsafe { o.contents.err };
7984                         unsafe { o.contents.err = core::ptr::null_mut(); }
7985                         CResult__u832APIErrorZPtr { err }
7986                 };
7987                 Self {
7988                         contents,
7989                         result_ok: o.result_ok,
7990                 }
7991         }
7992 }
7993 impl Clone for CResult__u832APIErrorZ {
7994         fn clone(&self) -> Self {
7995                 if self.result_ok {
7996                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
7997                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7998                         } }
7999                 } else {
8000                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
8001                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8002                         } }
8003                 }
8004         }
8005 }
8006 #[no_mangle]
8007 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
8008 /// but with all dynamically-allocated buffers duplicated in new buffers.
8009 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
8010 #[repr(C)]
8011 /// The contents of CResult_PaymentIdPaymentSendFailureZ
8012 pub union CResult_PaymentIdPaymentSendFailureZPtr {
8013         /// A pointer to the contents in the success state.
8014         /// Reading from this pointer when `result_ok` is not set is undefined.
8015         pub result: *mut crate::c_types::ThirtyTwoBytes,
8016         /// A pointer to the contents in the error state.
8017         /// Reading from this pointer when `result_ok` is set is undefined.
8018         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8019 }
8020 #[repr(C)]
8021 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
8022 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8024 pub struct CResult_PaymentIdPaymentSendFailureZ {
8025         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
8026         /// `err` or `result` depending on the state of `result_ok`.
8027         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
8028         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
8029         pub result_ok: bool,
8030 }
8031 #[no_mangle]
8032 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
8033 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
8034         CResult_PaymentIdPaymentSendFailureZ {
8035                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8036                         result: Box::into_raw(Box::new(o)),
8037                 },
8038                 result_ok: true,
8039         }
8040 }
8041 #[no_mangle]
8042 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
8043 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
8044         CResult_PaymentIdPaymentSendFailureZ {
8045                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
8046                         err: Box::into_raw(Box::new(e)),
8047                 },
8048                 result_ok: false,
8049         }
8050 }
8051 /// Checks if the given object is currently in the success state
8052 #[no_mangle]
8053 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
8054         o.result_ok
8055 }
8056 #[no_mangle]
8057 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
8058 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
8059 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
8060         fn drop(&mut self) {
8061                 if self.result_ok {
8062                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8063                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8064                         }
8065                 } else {
8066                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8067                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8068                         }
8069                 }
8070         }
8071 }
8072 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
8073         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8074                 let contents = if o.result_ok {
8075                         let result = unsafe { o.contents.result };
8076                         unsafe { o.contents.result = core::ptr::null_mut() };
8077                         CResult_PaymentIdPaymentSendFailureZPtr { result }
8078                 } else {
8079                         let err = unsafe { o.contents.err };
8080                         unsafe { o.contents.err = core::ptr::null_mut(); }
8081                         CResult_PaymentIdPaymentSendFailureZPtr { err }
8082                 };
8083                 Self {
8084                         contents,
8085                         result_ok: o.result_ok,
8086                 }
8087         }
8088 }
8089 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
8090         fn clone(&self) -> Self {
8091                 if self.result_ok {
8092                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8093                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8094                         } }
8095                 } else {
8096                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
8097                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8098                         } }
8099                 }
8100         }
8101 }
8102 #[no_mangle]
8103 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
8104 /// but with all dynamically-allocated buffers duplicated in new buffers.
8105 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
8106 #[repr(C)]
8107 /// The contents of CResult_NonePaymentSendFailureZ
8108 pub union CResult_NonePaymentSendFailureZPtr {
8109         /// Note that this value is always NULL, as there are no contents in the OK variant
8110         pub result: *mut core::ffi::c_void,
8111         /// A pointer to the contents in the error state.
8112         /// Reading from this pointer when `result_ok` is set is undefined.
8113         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8114 }
8115 #[repr(C)]
8116 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
8117 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8118 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8119 pub struct CResult_NonePaymentSendFailureZ {
8120         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
8121         /// `err` or `result` depending on the state of `result_ok`.
8122         pub contents: CResult_NonePaymentSendFailureZPtr,
8123         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
8124         pub result_ok: bool,
8125 }
8126 #[no_mangle]
8127 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
8128 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
8129         CResult_NonePaymentSendFailureZ {
8130                 contents: CResult_NonePaymentSendFailureZPtr {
8131                         result: core::ptr::null_mut(),
8132                 },
8133                 result_ok: true,
8134         }
8135 }
8136 #[no_mangle]
8137 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
8138 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
8139         CResult_NonePaymentSendFailureZ {
8140                 contents: CResult_NonePaymentSendFailureZPtr {
8141                         err: Box::into_raw(Box::new(e)),
8142                 },
8143                 result_ok: false,
8144         }
8145 }
8146 /// Checks if the given object is currently in the success state
8147 #[no_mangle]
8148 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
8149         o.result_ok
8150 }
8151 #[no_mangle]
8152 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
8153 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
8154 impl Drop for CResult_NonePaymentSendFailureZ {
8155         fn drop(&mut self) {
8156                 if self.result_ok {
8157                 } else {
8158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8160                         }
8161                 }
8162         }
8163 }
8164 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
8165         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8166                 let contents = if o.result_ok {
8167                         let _ = unsafe { Box::from_raw(o.contents.result) };
8168                         o.contents.result = core::ptr::null_mut();
8169                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
8170                 } else {
8171                         let err = unsafe { o.contents.err };
8172                         unsafe { o.contents.err = core::ptr::null_mut(); }
8173                         CResult_NonePaymentSendFailureZPtr { err }
8174                 };
8175                 Self {
8176                         contents,
8177                         result_ok: o.result_ok,
8178                 }
8179         }
8180 }
8181 impl Clone for CResult_NonePaymentSendFailureZ {
8182         fn clone(&self) -> Self {
8183                 if self.result_ok {
8184                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
8185                                 result: core::ptr::null_mut()
8186                         } }
8187                 } else {
8188                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
8189                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8190                         } }
8191                 }
8192         }
8193 }
8194 #[no_mangle]
8195 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
8196 /// but with all dynamically-allocated buffers duplicated in new buffers.
8197 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
8198 #[repr(C)]
8199 /// A tuple of 2 elements. See the individual fields for the types contained.
8200 pub struct C2Tuple_PaymentHashPaymentIdZ {
8201         /// The element at position 0
8202         pub a: crate::c_types::ThirtyTwoBytes,
8203         /// The element at position 1
8204         pub b: crate::c_types::ThirtyTwoBytes,
8205 }
8206 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
8207         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8208                 Self {
8209                         a: tup.0,
8210                         b: tup.1,
8211                 }
8212         }
8213 }
8214 impl C2Tuple_PaymentHashPaymentIdZ {
8215         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8216                 (self.a, self.b)
8217         }
8218 }
8219 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
8220         fn clone(&self) -> Self {
8221                 Self {
8222                         a: Clone::clone(&self.a),
8223                         b: Clone::clone(&self.b),
8224                 }
8225         }
8226 }
8227 #[no_mangle]
8228 /// Creates a new tuple which has the same data as `orig`
8229 /// but with all dynamically-allocated buffers duplicated in new buffers.
8230 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
8231 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
8232 #[no_mangle]
8233 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
8234         C2Tuple_PaymentHashPaymentIdZ { a, b, }
8235 }
8236
8237 #[no_mangle]
8238 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
8239 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
8240 #[repr(C)]
8241 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
8242 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8243         /// A pointer to the contents in the success state.
8244         /// Reading from this pointer when `result_ok` is not set is undefined.
8245         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
8246         /// A pointer to the contents in the error state.
8247         /// Reading from this pointer when `result_ok` is set is undefined.
8248         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
8249 }
8250 #[repr(C)]
8251 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
8252 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
8253 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8254 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8255         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
8256         /// `err` or `result` depending on the state of `result_ok`.
8257         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
8258         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
8259         pub result_ok: bool,
8260 }
8261 #[no_mangle]
8262 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
8263 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8264         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8265                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8266                         result: Box::into_raw(Box::new(o)),
8267                 },
8268                 result_ok: true,
8269         }
8270 }
8271 #[no_mangle]
8272 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
8273 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8274         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8275                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8276                         err: Box::into_raw(Box::new(e)),
8277                 },
8278                 result_ok: false,
8279         }
8280 }
8281 /// Checks if the given object is currently in the success state
8282 #[no_mangle]
8283 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
8284         o.result_ok
8285 }
8286 #[no_mangle]
8287 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
8288 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
8289 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8290         fn drop(&mut self) {
8291                 if self.result_ok {
8292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8294                         }
8295                 } else {
8296                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8297                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8298                         }
8299                 }
8300         }
8301 }
8302 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8303         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
8304                 let contents = if o.result_ok {
8305                         let result = unsafe { o.contents.result };
8306                         unsafe { o.contents.result = core::ptr::null_mut() };
8307                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
8308                 } else {
8309                         let err = unsafe { o.contents.err };
8310                         unsafe { o.contents.err = core::ptr::null_mut(); }
8311                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
8312                 };
8313                 Self {
8314                         contents,
8315                         result_ok: o.result_ok,
8316                 }
8317         }
8318 }
8319 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
8320         fn clone(&self) -> Self {
8321                 if self.result_ok {
8322                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8323                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
8324                         } }
8325                 } else {
8326                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
8327                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
8328                         } }
8329                 }
8330         }
8331 }
8332 #[no_mangle]
8333 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
8334 /// but with all dynamically-allocated buffers duplicated in new buffers.
8335 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
8336 #[repr(C)]
8337 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
8338 /// This corresponds to std::vector in C++
8339 pub struct CVec_ThirtyTwoBytesZ {
8340         /// The elements in the array.
8341         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8342         pub data: *mut crate::c_types::ThirtyTwoBytes,
8343         /// The number of elements pointed to by `data`.
8344         pub datalen: usize
8345 }
8346 impl CVec_ThirtyTwoBytesZ {
8347         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
8348                 if self.datalen == 0 { return Vec::new(); }
8349                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8350                 self.data = core::ptr::null_mut();
8351                 self.datalen = 0;
8352                 ret
8353         }
8354         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
8355                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8356         }
8357 }
8358 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_ThirtyTwoBytesZ {
8359         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
8360                 let datalen = v.len();
8361                 let data = Box::into_raw(v.into_boxed_slice());
8362                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8363         }
8364 }
8365 #[no_mangle]
8366 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8367 pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { }
8368 impl Drop for CVec_ThirtyTwoBytesZ {
8369         fn drop(&mut self) {
8370                 if self.datalen == 0 { return; }
8371                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8372         }
8373 }
8374 impl Clone for CVec_ThirtyTwoBytesZ {
8375         fn clone(&self) -> Self {
8376                 let mut res = Vec::new();
8377                 if self.datalen == 0 { return Self::from(res); }
8378                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8379                 Self::from(res)
8380         }
8381 }
8382 #[repr(C)]
8383 /// A tuple of 2 elements. See the individual fields for the types contained.
8384 pub struct C2Tuple_PaymentHashPaymentSecretZ {
8385         /// The element at position 0
8386         pub a: crate::c_types::ThirtyTwoBytes,
8387         /// The element at position 1
8388         pub b: crate::c_types::ThirtyTwoBytes,
8389 }
8390 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
8391         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
8392                 Self {
8393                         a: tup.0,
8394                         b: tup.1,
8395                 }
8396         }
8397 }
8398 impl C2Tuple_PaymentHashPaymentSecretZ {
8399         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
8400                 (self.a, self.b)
8401         }
8402 }
8403 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
8404         fn clone(&self) -> Self {
8405                 Self {
8406                         a: Clone::clone(&self.a),
8407                         b: Clone::clone(&self.b),
8408                 }
8409         }
8410 }
8411 #[no_mangle]
8412 /// Creates a new tuple which has the same data as `orig`
8413 /// but with all dynamically-allocated buffers duplicated in new buffers.
8414 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
8415 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
8416 #[no_mangle]
8417 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
8418         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
8419 }
8420
8421 #[no_mangle]
8422 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
8423 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
8424 #[repr(C)]
8425 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
8426 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8427         /// A pointer to the contents in the success state.
8428         /// Reading from this pointer when `result_ok` is not set is undefined.
8429         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8430         /// Note that this value is always NULL, as there are no contents in the Err variant
8431         pub err: *mut core::ffi::c_void,
8432 }
8433 #[repr(C)]
8434 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
8435 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
8436 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8437 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8438         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
8439         /// `err` or `result` depending on the state of `result_ok`.
8440         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
8441         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
8442         pub result_ok: bool,
8443 }
8444 #[no_mangle]
8445 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
8446 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8447         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8448                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8449                         result: Box::into_raw(Box::new(o)),
8450                 },
8451                 result_ok: true,
8452         }
8453 }
8454 #[no_mangle]
8455 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
8456 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8457         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8458                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8459                         err: core::ptr::null_mut(),
8460                 },
8461                 result_ok: false,
8462         }
8463 }
8464 /// Checks if the given object is currently in the success state
8465 #[no_mangle]
8466 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
8467         o.result_ok
8468 }
8469 #[no_mangle]
8470 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
8471 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
8472 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8473         fn drop(&mut self) {
8474                 if self.result_ok {
8475                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8476                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8477                         }
8478                 } else {
8479                 }
8480         }
8481 }
8482 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8483         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
8484                 let contents = if o.result_ok {
8485                         let result = unsafe { o.contents.result };
8486                         unsafe { o.contents.result = core::ptr::null_mut() };
8487                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
8488                 } else {
8489                         let _ = unsafe { Box::from_raw(o.contents.err) };
8490                         o.contents.err = core::ptr::null_mut();
8491                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
8492                 };
8493                 Self {
8494                         contents,
8495                         result_ok: o.result_ok,
8496                 }
8497         }
8498 }
8499 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
8500         fn clone(&self) -> Self {
8501                 if self.result_ok {
8502                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8503                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8504                         } }
8505                 } else {
8506                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
8507                                 err: core::ptr::null_mut()
8508                         } }
8509                 }
8510         }
8511 }
8512 #[no_mangle]
8513 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
8514 /// but with all dynamically-allocated buffers duplicated in new buffers.
8515 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
8516 #[repr(C)]
8517 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
8518 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8519         /// A pointer to the contents in the success state.
8520         /// Reading from this pointer when `result_ok` is not set is undefined.
8521         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
8522         /// A pointer to the contents in the error state.
8523         /// Reading from this pointer when `result_ok` is set is undefined.
8524         pub err: *mut crate::lightning::util::errors::APIError,
8525 }
8526 #[repr(C)]
8527 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
8528 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
8529 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8530 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8531         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
8532         /// `err` or `result` depending on the state of `result_ok`.
8533         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
8534         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
8535         pub result_ok: bool,
8536 }
8537 #[no_mangle]
8538 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
8539 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8540         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8541                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8542                         result: Box::into_raw(Box::new(o)),
8543                 },
8544                 result_ok: true,
8545         }
8546 }
8547 #[no_mangle]
8548 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
8549 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8550         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8551                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8552                         err: Box::into_raw(Box::new(e)),
8553                 },
8554                 result_ok: false,
8555         }
8556 }
8557 /// Checks if the given object is currently in the success state
8558 #[no_mangle]
8559 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
8560         o.result_ok
8561 }
8562 #[no_mangle]
8563 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
8564 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
8565 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8566         fn drop(&mut self) {
8567                 if self.result_ok {
8568                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8569                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8570                         }
8571                 } else {
8572                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8573                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8574                         }
8575                 }
8576         }
8577 }
8578 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8579         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
8580                 let contents = if o.result_ok {
8581                         let result = unsafe { o.contents.result };
8582                         unsafe { o.contents.result = core::ptr::null_mut() };
8583                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
8584                 } else {
8585                         let err = unsafe { o.contents.err };
8586                         unsafe { o.contents.err = core::ptr::null_mut(); }
8587                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
8588                 };
8589                 Self {
8590                         contents,
8591                         result_ok: o.result_ok,
8592                 }
8593         }
8594 }
8595 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
8596         fn clone(&self) -> Self {
8597                 if self.result_ok {
8598                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8599                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
8600                         } }
8601                 } else {
8602                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
8603                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8604                         } }
8605                 }
8606         }
8607 }
8608 #[no_mangle]
8609 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
8610 /// but with all dynamically-allocated buffers duplicated in new buffers.
8611 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
8612 #[repr(C)]
8613 /// The contents of CResult_PaymentSecretNoneZ
8614 pub union CResult_PaymentSecretNoneZPtr {
8615         /// A pointer to the contents in the success state.
8616         /// Reading from this pointer when `result_ok` is not set is undefined.
8617         pub result: *mut crate::c_types::ThirtyTwoBytes,
8618         /// Note that this value is always NULL, as there are no contents in the Err variant
8619         pub err: *mut core::ffi::c_void,
8620 }
8621 #[repr(C)]
8622 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
8623 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
8624 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8625 pub struct CResult_PaymentSecretNoneZ {
8626         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
8627         /// `err` or `result` depending on the state of `result_ok`.
8628         pub contents: CResult_PaymentSecretNoneZPtr,
8629         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
8630         pub result_ok: bool,
8631 }
8632 #[no_mangle]
8633 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
8634 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
8635         CResult_PaymentSecretNoneZ {
8636                 contents: CResult_PaymentSecretNoneZPtr {
8637                         result: Box::into_raw(Box::new(o)),
8638                 },
8639                 result_ok: true,
8640         }
8641 }
8642 #[no_mangle]
8643 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
8644 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
8645         CResult_PaymentSecretNoneZ {
8646                 contents: CResult_PaymentSecretNoneZPtr {
8647                         err: core::ptr::null_mut(),
8648                 },
8649                 result_ok: false,
8650         }
8651 }
8652 /// Checks if the given object is currently in the success state
8653 #[no_mangle]
8654 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
8655         o.result_ok
8656 }
8657 #[no_mangle]
8658 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
8659 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
8660 impl Drop for CResult_PaymentSecretNoneZ {
8661         fn drop(&mut self) {
8662                 if self.result_ok {
8663                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8664                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8665                         }
8666                 } else {
8667                 }
8668         }
8669 }
8670 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
8671         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
8672                 let contents = if o.result_ok {
8673                         let result = unsafe { o.contents.result };
8674                         unsafe { o.contents.result = core::ptr::null_mut() };
8675                         CResult_PaymentSecretNoneZPtr { result }
8676                 } else {
8677                         let _ = unsafe { Box::from_raw(o.contents.err) };
8678                         o.contents.err = core::ptr::null_mut();
8679                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
8680                 };
8681                 Self {
8682                         contents,
8683                         result_ok: o.result_ok,
8684                 }
8685         }
8686 }
8687 impl Clone for CResult_PaymentSecretNoneZ {
8688         fn clone(&self) -> Self {
8689                 if self.result_ok {
8690                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
8691                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8692                         } }
8693                 } else {
8694                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
8695                                 err: core::ptr::null_mut()
8696                         } }
8697                 }
8698         }
8699 }
8700 #[no_mangle]
8701 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
8702 /// but with all dynamically-allocated buffers duplicated in new buffers.
8703 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
8704 #[repr(C)]
8705 /// The contents of CResult_PaymentSecretAPIErrorZ
8706 pub union CResult_PaymentSecretAPIErrorZPtr {
8707         /// A pointer to the contents in the success state.
8708         /// Reading from this pointer when `result_ok` is not set is undefined.
8709         pub result: *mut crate::c_types::ThirtyTwoBytes,
8710         /// A pointer to the contents in the error state.
8711         /// Reading from this pointer when `result_ok` is set is undefined.
8712         pub err: *mut crate::lightning::util::errors::APIError,
8713 }
8714 #[repr(C)]
8715 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
8716 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8717 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8718 pub struct CResult_PaymentSecretAPIErrorZ {
8719         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
8720         /// `err` or `result` depending on the state of `result_ok`.
8721         pub contents: CResult_PaymentSecretAPIErrorZPtr,
8722         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
8723         pub result_ok: bool,
8724 }
8725 #[no_mangle]
8726 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
8727 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
8728         CResult_PaymentSecretAPIErrorZ {
8729                 contents: CResult_PaymentSecretAPIErrorZPtr {
8730                         result: Box::into_raw(Box::new(o)),
8731                 },
8732                 result_ok: true,
8733         }
8734 }
8735 #[no_mangle]
8736 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
8737 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
8738         CResult_PaymentSecretAPIErrorZ {
8739                 contents: CResult_PaymentSecretAPIErrorZPtr {
8740                         err: Box::into_raw(Box::new(e)),
8741                 },
8742                 result_ok: false,
8743         }
8744 }
8745 /// Checks if the given object is currently in the success state
8746 #[no_mangle]
8747 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
8748         o.result_ok
8749 }
8750 #[no_mangle]
8751 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
8752 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
8753 impl Drop for CResult_PaymentSecretAPIErrorZ {
8754         fn drop(&mut self) {
8755                 if self.result_ok {
8756                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8757                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8758                         }
8759                 } else {
8760                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8761                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8762                         }
8763                 }
8764         }
8765 }
8766 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
8767         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8768                 let contents = if o.result_ok {
8769                         let result = unsafe { o.contents.result };
8770                         unsafe { o.contents.result = core::ptr::null_mut() };
8771                         CResult_PaymentSecretAPIErrorZPtr { result }
8772                 } else {
8773                         let err = unsafe { o.contents.err };
8774                         unsafe { o.contents.err = core::ptr::null_mut(); }
8775                         CResult_PaymentSecretAPIErrorZPtr { err }
8776                 };
8777                 Self {
8778                         contents,
8779                         result_ok: o.result_ok,
8780                 }
8781         }
8782 }
8783 impl Clone for CResult_PaymentSecretAPIErrorZ {
8784         fn clone(&self) -> Self {
8785                 if self.result_ok {
8786                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
8787                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8788                         } }
8789                 } else {
8790                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
8791                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8792                         } }
8793                 }
8794         }
8795 }
8796 #[no_mangle]
8797 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
8798 /// but with all dynamically-allocated buffers duplicated in new buffers.
8799 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
8800 #[repr(C)]
8801 /// The contents of CResult_PaymentPreimageAPIErrorZ
8802 pub union CResult_PaymentPreimageAPIErrorZPtr {
8803         /// A pointer to the contents in the success state.
8804         /// Reading from this pointer when `result_ok` is not set is undefined.
8805         pub result: *mut crate::c_types::ThirtyTwoBytes,
8806         /// A pointer to the contents in the error state.
8807         /// Reading from this pointer when `result_ok` is set is undefined.
8808         pub err: *mut crate::lightning::util::errors::APIError,
8809 }
8810 #[repr(C)]
8811 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
8812 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
8813 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8814 pub struct CResult_PaymentPreimageAPIErrorZ {
8815         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
8816         /// `err` or `result` depending on the state of `result_ok`.
8817         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
8818         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
8819         pub result_ok: bool,
8820 }
8821 #[no_mangle]
8822 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
8823 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
8824         CResult_PaymentPreimageAPIErrorZ {
8825                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8826                         result: Box::into_raw(Box::new(o)),
8827                 },
8828                 result_ok: true,
8829         }
8830 }
8831 #[no_mangle]
8832 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
8833 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
8834         CResult_PaymentPreimageAPIErrorZ {
8835                 contents: CResult_PaymentPreimageAPIErrorZPtr {
8836                         err: Box::into_raw(Box::new(e)),
8837                 },
8838                 result_ok: false,
8839         }
8840 }
8841 /// Checks if the given object is currently in the success state
8842 #[no_mangle]
8843 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
8844         o.result_ok
8845 }
8846 #[no_mangle]
8847 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
8848 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
8849 impl Drop for CResult_PaymentPreimageAPIErrorZ {
8850         fn drop(&mut self) {
8851                 if self.result_ok {
8852                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8853                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8854                         }
8855                 } else {
8856                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8857                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8858                         }
8859                 }
8860         }
8861 }
8862 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
8863         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
8864                 let contents = if o.result_ok {
8865                         let result = unsafe { o.contents.result };
8866                         unsafe { o.contents.result = core::ptr::null_mut() };
8867                         CResult_PaymentPreimageAPIErrorZPtr { result }
8868                 } else {
8869                         let err = unsafe { o.contents.err };
8870                         unsafe { o.contents.err = core::ptr::null_mut(); }
8871                         CResult_PaymentPreimageAPIErrorZPtr { err }
8872                 };
8873                 Self {
8874                         contents,
8875                         result_ok: o.result_ok,
8876                 }
8877         }
8878 }
8879 impl Clone for CResult_PaymentPreimageAPIErrorZ {
8880         fn clone(&self) -> Self {
8881                 if self.result_ok {
8882                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
8883                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8884                         } }
8885                 } else {
8886                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
8887                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
8888                         } }
8889                 }
8890         }
8891 }
8892 #[no_mangle]
8893 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
8894 /// but with all dynamically-allocated buffers duplicated in new buffers.
8895 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
8896 #[repr(C)]
8897 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
8898 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8899         /// A pointer to the contents in the success state.
8900         /// Reading from this pointer when `result_ok` is not set is undefined.
8901         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
8902         /// A pointer to the contents in the error state.
8903         /// Reading from this pointer when `result_ok` is set is undefined.
8904         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8905 }
8906 #[repr(C)]
8907 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
8908 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8909 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8910 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
8911         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
8912         /// `err` or `result` depending on the state of `result_ok`.
8913         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
8914         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
8915         pub result_ok: bool,
8916 }
8917 #[no_mangle]
8918 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
8919 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8920         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8921                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8922                         result: Box::into_raw(Box::new(o)),
8923                 },
8924                 result_ok: true,
8925         }
8926 }
8927 #[no_mangle]
8928 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
8929 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
8930         CResult_CounterpartyForwardingInfoDecodeErrorZ {
8931                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8932                         err: Box::into_raw(Box::new(e)),
8933                 },
8934                 result_ok: false,
8935         }
8936 }
8937 /// Checks if the given object is currently in the success state
8938 #[no_mangle]
8939 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
8940         o.result_ok
8941 }
8942 #[no_mangle]
8943 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
8944 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
8945 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8946         fn drop(&mut self) {
8947                 if self.result_ok {
8948                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8949                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8950                         }
8951                 } else {
8952                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8953                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8954                         }
8955                 }
8956         }
8957 }
8958 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8959         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
8960                 let contents = if o.result_ok {
8961                         let result = unsafe { o.contents.result };
8962                         unsafe { o.contents.result = core::ptr::null_mut() };
8963                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
8964                 } else {
8965                         let err = unsafe { o.contents.err };
8966                         unsafe { o.contents.err = core::ptr::null_mut(); }
8967                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
8968                 };
8969                 Self {
8970                         contents,
8971                         result_ok: o.result_ok,
8972                 }
8973         }
8974 }
8975 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
8976         fn clone(&self) -> Self {
8977                 if self.result_ok {
8978                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8979                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
8980                         } }
8981                 } else {
8982                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
8983                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
8984                         } }
8985                 }
8986         }
8987 }
8988 #[no_mangle]
8989 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
8990 /// but with all dynamically-allocated buffers duplicated in new buffers.
8991 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
8992 #[repr(C)]
8993 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
8994 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
8995         /// A pointer to the contents in the success state.
8996         /// Reading from this pointer when `result_ok` is not set is undefined.
8997         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
8998         /// A pointer to the contents in the error state.
8999         /// Reading from this pointer when `result_ok` is set is undefined.
9000         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9001 }
9002 #[repr(C)]
9003 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
9004 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
9005 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9006 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
9007         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
9008         /// `err` or `result` depending on the state of `result_ok`.
9009         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
9010         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
9011         pub result_ok: bool,
9012 }
9013 #[no_mangle]
9014 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
9015 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
9016         CResult_ChannelCounterpartyDecodeErrorZ {
9017                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9018                         result: Box::into_raw(Box::new(o)),
9019                 },
9020                 result_ok: true,
9021         }
9022 }
9023 #[no_mangle]
9024 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
9025 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
9026         CResult_ChannelCounterpartyDecodeErrorZ {
9027                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9028                         err: Box::into_raw(Box::new(e)),
9029                 },
9030                 result_ok: false,
9031         }
9032 }
9033 /// Checks if the given object is currently in the success state
9034 #[no_mangle]
9035 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
9036         o.result_ok
9037 }
9038 #[no_mangle]
9039 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
9040 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
9041 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
9042         fn drop(&mut self) {
9043                 if self.result_ok {
9044                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9045                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9046                         }
9047                 } else {
9048                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9049                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9050                         }
9051                 }
9052         }
9053 }
9054 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
9055         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
9056                 let contents = if o.result_ok {
9057                         let result = unsafe { o.contents.result };
9058                         unsafe { o.contents.result = core::ptr::null_mut() };
9059                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
9060                 } else {
9061                         let err = unsafe { o.contents.err };
9062                         unsafe { o.contents.err = core::ptr::null_mut(); }
9063                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
9064                 };
9065                 Self {
9066                         contents,
9067                         result_ok: o.result_ok,
9068                 }
9069         }
9070 }
9071 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
9072         fn clone(&self) -> Self {
9073                 if self.result_ok {
9074                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9075                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
9076                         } }
9077                 } else {
9078                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
9079                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9080                         } }
9081                 }
9082         }
9083 }
9084 #[no_mangle]
9085 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
9086 /// but with all dynamically-allocated buffers duplicated in new buffers.
9087 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
9088 #[repr(C)]
9089 /// The contents of CResult_ChannelDetailsDecodeErrorZ
9090 pub union CResult_ChannelDetailsDecodeErrorZPtr {
9091         /// A pointer to the contents in the success state.
9092         /// Reading from this pointer when `result_ok` is not set is undefined.
9093         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
9094         /// A pointer to the contents in the error state.
9095         /// Reading from this pointer when `result_ok` is set is undefined.
9096         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9097 }
9098 #[repr(C)]
9099 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
9100 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
9101 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9102 pub struct CResult_ChannelDetailsDecodeErrorZ {
9103         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
9104         /// `err` or `result` depending on the state of `result_ok`.
9105         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
9106         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
9107         pub result_ok: bool,
9108 }
9109 #[no_mangle]
9110 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
9111 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
9112         CResult_ChannelDetailsDecodeErrorZ {
9113                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9114                         result: Box::into_raw(Box::new(o)),
9115                 },
9116                 result_ok: true,
9117         }
9118 }
9119 #[no_mangle]
9120 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
9121 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
9122         CResult_ChannelDetailsDecodeErrorZ {
9123                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
9124                         err: Box::into_raw(Box::new(e)),
9125                 },
9126                 result_ok: false,
9127         }
9128 }
9129 /// Checks if the given object is currently in the success state
9130 #[no_mangle]
9131 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
9132         o.result_ok
9133 }
9134 #[no_mangle]
9135 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
9136 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
9137 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
9138         fn drop(&mut self) {
9139                 if self.result_ok {
9140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9142                         }
9143                 } else {
9144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9146                         }
9147                 }
9148         }
9149 }
9150 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
9151         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
9152                 let contents = if o.result_ok {
9153                         let result = unsafe { o.contents.result };
9154                         unsafe { o.contents.result = core::ptr::null_mut() };
9155                         CResult_ChannelDetailsDecodeErrorZPtr { result }
9156                 } else {
9157                         let err = unsafe { o.contents.err };
9158                         unsafe { o.contents.err = core::ptr::null_mut(); }
9159                         CResult_ChannelDetailsDecodeErrorZPtr { err }
9160                 };
9161                 Self {
9162                         contents,
9163                         result_ok: o.result_ok,
9164                 }
9165         }
9166 }
9167 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
9168         fn clone(&self) -> Self {
9169                 if self.result_ok {
9170                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9171                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
9172                         } }
9173                 } else {
9174                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
9175                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9176                         } }
9177                 }
9178         }
9179 }
9180 #[no_mangle]
9181 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
9182 /// but with all dynamically-allocated buffers duplicated in new buffers.
9183 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
9184 #[repr(C)]
9185 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
9186 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
9187         /// A pointer to the contents in the success state.
9188         /// Reading from this pointer when `result_ok` is not set is undefined.
9189         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
9190         /// A pointer to the contents in the error state.
9191         /// Reading from this pointer when `result_ok` is set is undefined.
9192         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9193 }
9194 #[repr(C)]
9195 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
9196 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
9197 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9198 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
9199         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
9200         /// `err` or `result` depending on the state of `result_ok`.
9201         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
9202         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
9203         pub result_ok: bool,
9204 }
9205 #[no_mangle]
9206 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
9207 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
9208         CResult_PhantomRouteHintsDecodeErrorZ {
9209                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9210                         result: Box::into_raw(Box::new(o)),
9211                 },
9212                 result_ok: true,
9213         }
9214 }
9215 #[no_mangle]
9216 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
9217 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
9218         CResult_PhantomRouteHintsDecodeErrorZ {
9219                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9220                         err: Box::into_raw(Box::new(e)),
9221                 },
9222                 result_ok: false,
9223         }
9224 }
9225 /// Checks if the given object is currently in the success state
9226 #[no_mangle]
9227 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
9228         o.result_ok
9229 }
9230 #[no_mangle]
9231 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
9232 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
9233 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
9234         fn drop(&mut self) {
9235                 if self.result_ok {
9236                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9237                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9238                         }
9239                 } else {
9240                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9241                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9242                         }
9243                 }
9244         }
9245 }
9246 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
9247         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
9248                 let contents = if o.result_ok {
9249                         let result = unsafe { o.contents.result };
9250                         unsafe { o.contents.result = core::ptr::null_mut() };
9251                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
9252                 } else {
9253                         let err = unsafe { o.contents.err };
9254                         unsafe { o.contents.err = core::ptr::null_mut(); }
9255                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
9256                 };
9257                 Self {
9258                         contents,
9259                         result_ok: o.result_ok,
9260                 }
9261         }
9262 }
9263 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
9264         fn clone(&self) -> Self {
9265                 if self.result_ok {
9266                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9267                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
9268                         } }
9269                 } else {
9270                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
9271                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9272                         } }
9273                 }
9274         }
9275 }
9276 #[no_mangle]
9277 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
9278 /// but with all dynamically-allocated buffers duplicated in new buffers.
9279 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
9280 #[repr(C)]
9281 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
9282 /// This corresponds to std::vector in C++
9283 pub struct CVec_ChannelMonitorZ {
9284         /// The elements in the array.
9285         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9286         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
9287         /// The number of elements pointed to by `data`.
9288         pub datalen: usize
9289 }
9290 impl CVec_ChannelMonitorZ {
9291         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
9292                 if self.datalen == 0 { return Vec::new(); }
9293                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9294                 self.data = core::ptr::null_mut();
9295                 self.datalen = 0;
9296                 ret
9297         }
9298         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
9299                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9300         }
9301 }
9302 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
9303         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
9304                 let datalen = v.len();
9305                 let data = Box::into_raw(v.into_boxed_slice());
9306                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9307         }
9308 }
9309 #[no_mangle]
9310 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9311 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
9312 impl Drop for CVec_ChannelMonitorZ {
9313         fn drop(&mut self) {
9314                 if self.datalen == 0 { return; }
9315                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9316         }
9317 }
9318 #[repr(C)]
9319 /// A tuple of 2 elements. See the individual fields for the types contained.
9320 pub struct C2Tuple_BlockHashChannelManagerZ {
9321         /// The element at position 0
9322         pub a: crate::c_types::ThirtyTwoBytes,
9323         /// The element at position 1
9324         pub b: crate::lightning::ln::channelmanager::ChannelManager,
9325 }
9326 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
9327         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
9328                 Self {
9329                         a: tup.0,
9330                         b: tup.1,
9331                 }
9332         }
9333 }
9334 impl C2Tuple_BlockHashChannelManagerZ {
9335         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
9336                 (self.a, self.b)
9337         }
9338 }
9339 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9340 #[no_mangle]
9341 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
9342         C2Tuple_BlockHashChannelManagerZ { a, b, }
9343 }
9344
9345 #[no_mangle]
9346 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9347 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
9348 #[repr(C)]
9349 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
9350 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9351         /// A pointer to the contents in the success state.
9352         /// Reading from this pointer when `result_ok` is not set is undefined.
9353         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
9354         /// A pointer to the contents in the error state.
9355         /// Reading from this pointer when `result_ok` is set is undefined.
9356         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9357 }
9358 #[repr(C)]
9359 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
9360 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9361 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9362 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9363         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
9364         /// `err` or `result` depending on the state of `result_ok`.
9365         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
9366         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
9367         pub result_ok: bool,
9368 }
9369 #[no_mangle]
9370 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9371 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9372         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9373                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9374                         result: Box::into_raw(Box::new(o)),
9375                 },
9376                 result_ok: true,
9377         }
9378 }
9379 #[no_mangle]
9380 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9381 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9382         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9383                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
9384                         err: Box::into_raw(Box::new(e)),
9385                 },
9386                 result_ok: false,
9387         }
9388 }
9389 /// Checks if the given object is currently in the success state
9390 #[no_mangle]
9391 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
9392         o.result_ok
9393 }
9394 #[no_mangle]
9395 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9396 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
9397 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9398         fn drop(&mut self) {
9399                 if self.result_ok {
9400                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9401                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9402                         }
9403                 } else {
9404                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9405                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9406                         }
9407                 }
9408         }
9409 }
9410 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
9411         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9412                 let contents = if o.result_ok {
9413                         let result = unsafe { o.contents.result };
9414                         unsafe { o.contents.result = core::ptr::null_mut() };
9415                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
9416                 } else {
9417                         let err = unsafe { o.contents.err };
9418                         unsafe { o.contents.err = core::ptr::null_mut(); }
9419                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
9420                 };
9421                 Self {
9422                         contents,
9423                         result_ok: o.result_ok,
9424                 }
9425         }
9426 }
9427 #[repr(C)]
9428 /// The contents of CResult_ChannelConfigDecodeErrorZ
9429 pub union CResult_ChannelConfigDecodeErrorZPtr {
9430         /// A pointer to the contents in the success state.
9431         /// Reading from this pointer when `result_ok` is not set is undefined.
9432         pub result: *mut crate::lightning::util::config::ChannelConfig,
9433         /// A pointer to the contents in the error state.
9434         /// Reading from this pointer when `result_ok` is set is undefined.
9435         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9436 }
9437 #[repr(C)]
9438 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
9439 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
9440 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9441 pub struct CResult_ChannelConfigDecodeErrorZ {
9442         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
9443         /// `err` or `result` depending on the state of `result_ok`.
9444         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
9445         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
9446         pub result_ok: bool,
9447 }
9448 #[no_mangle]
9449 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
9450 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
9451         CResult_ChannelConfigDecodeErrorZ {
9452                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9453                         result: Box::into_raw(Box::new(o)),
9454                 },
9455                 result_ok: true,
9456         }
9457 }
9458 #[no_mangle]
9459 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
9460 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
9461         CResult_ChannelConfigDecodeErrorZ {
9462                 contents: CResult_ChannelConfigDecodeErrorZPtr {
9463                         err: Box::into_raw(Box::new(e)),
9464                 },
9465                 result_ok: false,
9466         }
9467 }
9468 /// Checks if the given object is currently in the success state
9469 #[no_mangle]
9470 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
9471         o.result_ok
9472 }
9473 #[no_mangle]
9474 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
9475 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
9476 impl Drop for CResult_ChannelConfigDecodeErrorZ {
9477         fn drop(&mut self) {
9478                 if self.result_ok {
9479                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9480                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9481                         }
9482                 } else {
9483                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9484                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9485                         }
9486                 }
9487         }
9488 }
9489 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
9490         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
9491                 let contents = if o.result_ok {
9492                         let result = unsafe { o.contents.result };
9493                         unsafe { o.contents.result = core::ptr::null_mut() };
9494                         CResult_ChannelConfigDecodeErrorZPtr { result }
9495                 } else {
9496                         let err = unsafe { o.contents.err };
9497                         unsafe { o.contents.err = core::ptr::null_mut(); }
9498                         CResult_ChannelConfigDecodeErrorZPtr { err }
9499                 };
9500                 Self {
9501                         contents,
9502                         result_ok: o.result_ok,
9503                 }
9504         }
9505 }
9506 impl Clone for CResult_ChannelConfigDecodeErrorZ {
9507         fn clone(&self) -> Self {
9508                 if self.result_ok {
9509                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
9510                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
9511                         } }
9512                 } else {
9513                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
9514                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9515                         } }
9516                 }
9517         }
9518 }
9519 #[no_mangle]
9520 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
9521 /// but with all dynamically-allocated buffers duplicated in new buffers.
9522 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
9523 #[repr(C)]
9524 /// The contents of CResult_OutPointDecodeErrorZ
9525 pub union CResult_OutPointDecodeErrorZPtr {
9526         /// A pointer to the contents in the success state.
9527         /// Reading from this pointer when `result_ok` is not set is undefined.
9528         pub result: *mut crate::lightning::chain::transaction::OutPoint,
9529         /// A pointer to the contents in the error state.
9530         /// Reading from this pointer when `result_ok` is set is undefined.
9531         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9532 }
9533 #[repr(C)]
9534 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
9535 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
9536 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9537 pub struct CResult_OutPointDecodeErrorZ {
9538         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
9539         /// `err` or `result` depending on the state of `result_ok`.
9540         pub contents: CResult_OutPointDecodeErrorZPtr,
9541         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
9542         pub result_ok: bool,
9543 }
9544 #[no_mangle]
9545 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
9546 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
9547         CResult_OutPointDecodeErrorZ {
9548                 contents: CResult_OutPointDecodeErrorZPtr {
9549                         result: Box::into_raw(Box::new(o)),
9550                 },
9551                 result_ok: true,
9552         }
9553 }
9554 #[no_mangle]
9555 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
9556 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
9557         CResult_OutPointDecodeErrorZ {
9558                 contents: CResult_OutPointDecodeErrorZPtr {
9559                         err: Box::into_raw(Box::new(e)),
9560                 },
9561                 result_ok: false,
9562         }
9563 }
9564 /// Checks if the given object is currently in the success state
9565 #[no_mangle]
9566 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
9567         o.result_ok
9568 }
9569 #[no_mangle]
9570 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
9571 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
9572 impl Drop for CResult_OutPointDecodeErrorZ {
9573         fn drop(&mut self) {
9574                 if self.result_ok {
9575                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9576                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9577                         }
9578                 } else {
9579                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9580                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9581                         }
9582                 }
9583         }
9584 }
9585 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
9586         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
9587                 let contents = if o.result_ok {
9588                         let result = unsafe { o.contents.result };
9589                         unsafe { o.contents.result = core::ptr::null_mut() };
9590                         CResult_OutPointDecodeErrorZPtr { result }
9591                 } else {
9592                         let err = unsafe { o.contents.err };
9593                         unsafe { o.contents.err = core::ptr::null_mut(); }
9594                         CResult_OutPointDecodeErrorZPtr { err }
9595                 };
9596                 Self {
9597                         contents,
9598                         result_ok: o.result_ok,
9599                 }
9600         }
9601 }
9602 impl Clone for CResult_OutPointDecodeErrorZ {
9603         fn clone(&self) -> Self {
9604                 if self.result_ok {
9605                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
9606                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
9607                         } }
9608                 } else {
9609                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
9610                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9611                         } }
9612                 }
9613         }
9614 }
9615 #[no_mangle]
9616 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
9617 /// but with all dynamically-allocated buffers duplicated in new buffers.
9618 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
9619 #[repr(C)]
9620 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
9621 pub enum COption_TypeZ {
9622         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
9623         Some(crate::lightning::ln::wire::Type),
9624         /// When we're in this state, this COption_TypeZ contains nothing
9625         None
9626 }
9627 impl COption_TypeZ {
9628         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9629                 if let Self::None = self { false } else { true }
9630         }
9631         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9632                 !self.is_some()
9633         }
9634         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
9635                 if let Self::Some(v) = self { v } else { unreachable!() }
9636         }
9637 }
9638 #[no_mangle]
9639 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
9640 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
9641         COption_TypeZ::Some(o)
9642 }
9643 #[no_mangle]
9644 /// Constructs a new COption_TypeZ containing nothing
9645 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
9646         COption_TypeZ::None
9647 }
9648 #[no_mangle]
9649 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
9650 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
9651 #[repr(C)]
9652 /// The contents of CResult_COption_TypeZDecodeErrorZ
9653 pub union CResult_COption_TypeZDecodeErrorZPtr {
9654         /// A pointer to the contents in the success state.
9655         /// Reading from this pointer when `result_ok` is not set is undefined.
9656         pub result: *mut crate::c_types::derived::COption_TypeZ,
9657         /// A pointer to the contents in the error state.
9658         /// Reading from this pointer when `result_ok` is set is undefined.
9659         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9660 }
9661 #[repr(C)]
9662 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
9663 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9664 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9665 pub struct CResult_COption_TypeZDecodeErrorZ {
9666         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
9667         /// `err` or `result` depending on the state of `result_ok`.
9668         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
9669         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
9670         pub result_ok: bool,
9671 }
9672 #[no_mangle]
9673 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
9674 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
9675         CResult_COption_TypeZDecodeErrorZ {
9676                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9677                         result: Box::into_raw(Box::new(o)),
9678                 },
9679                 result_ok: true,
9680         }
9681 }
9682 #[no_mangle]
9683 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
9684 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
9685         CResult_COption_TypeZDecodeErrorZ {
9686                 contents: CResult_COption_TypeZDecodeErrorZPtr {
9687                         err: Box::into_raw(Box::new(e)),
9688                 },
9689                 result_ok: false,
9690         }
9691 }
9692 /// Checks if the given object is currently in the success state
9693 #[no_mangle]
9694 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
9695         o.result_ok
9696 }
9697 #[no_mangle]
9698 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
9699 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
9700 impl Drop for CResult_COption_TypeZDecodeErrorZ {
9701         fn drop(&mut self) {
9702                 if self.result_ok {
9703                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9704                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9705                         }
9706                 } else {
9707                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9708                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9709                         }
9710                 }
9711         }
9712 }
9713 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
9714         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9715                 let contents = if o.result_ok {
9716                         let result = unsafe { o.contents.result };
9717                         unsafe { o.contents.result = core::ptr::null_mut() };
9718                         CResult_COption_TypeZDecodeErrorZPtr { result }
9719                 } else {
9720                         let err = unsafe { o.contents.err };
9721                         unsafe { o.contents.err = core::ptr::null_mut(); }
9722                         CResult_COption_TypeZDecodeErrorZPtr { err }
9723                 };
9724                 Self {
9725                         contents,
9726                         result_ok: o.result_ok,
9727                 }
9728         }
9729 }
9730 #[repr(C)]
9731 /// The contents of CResult_PaymentIdPaymentErrorZ
9732 pub union CResult_PaymentIdPaymentErrorZPtr {
9733         /// A pointer to the contents in the success state.
9734         /// Reading from this pointer when `result_ok` is not set is undefined.
9735         pub result: *mut crate::c_types::ThirtyTwoBytes,
9736         /// A pointer to the contents in the error state.
9737         /// Reading from this pointer when `result_ok` is set is undefined.
9738         pub err: *mut crate::lightning_invoice::payment::PaymentError,
9739 }
9740 #[repr(C)]
9741 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
9742 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
9743 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9744 pub struct CResult_PaymentIdPaymentErrorZ {
9745         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
9746         /// `err` or `result` depending on the state of `result_ok`.
9747         pub contents: CResult_PaymentIdPaymentErrorZPtr,
9748         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
9749         pub result_ok: bool,
9750 }
9751 #[no_mangle]
9752 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
9753 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
9754         CResult_PaymentIdPaymentErrorZ {
9755                 contents: CResult_PaymentIdPaymentErrorZPtr {
9756                         result: Box::into_raw(Box::new(o)),
9757                 },
9758                 result_ok: true,
9759         }
9760 }
9761 #[no_mangle]
9762 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
9763 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
9764         CResult_PaymentIdPaymentErrorZ {
9765                 contents: CResult_PaymentIdPaymentErrorZPtr {
9766                         err: Box::into_raw(Box::new(e)),
9767                 },
9768                 result_ok: false,
9769         }
9770 }
9771 /// Checks if the given object is currently in the success state
9772 #[no_mangle]
9773 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
9774         o.result_ok
9775 }
9776 #[no_mangle]
9777 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
9778 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
9779 impl Drop for CResult_PaymentIdPaymentErrorZ {
9780         fn drop(&mut self) {
9781                 if self.result_ok {
9782                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9783                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9784                         }
9785                 } else {
9786                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9787                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9788                         }
9789                 }
9790         }
9791 }
9792 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
9793         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
9794                 let contents = if o.result_ok {
9795                         let result = unsafe { o.contents.result };
9796                         unsafe { o.contents.result = core::ptr::null_mut() };
9797                         CResult_PaymentIdPaymentErrorZPtr { result }
9798                 } else {
9799                         let err = unsafe { o.contents.err };
9800                         unsafe { o.contents.err = core::ptr::null_mut(); }
9801                         CResult_PaymentIdPaymentErrorZPtr { err }
9802                 };
9803                 Self {
9804                         contents,
9805                         result_ok: o.result_ok,
9806                 }
9807         }
9808 }
9809 impl Clone for CResult_PaymentIdPaymentErrorZ {
9810         fn clone(&self) -> Self {
9811                 if self.result_ok {
9812                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
9813                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
9814                         } }
9815                 } else {
9816                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
9817                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
9818                         } }
9819                 }
9820         }
9821 }
9822 #[no_mangle]
9823 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
9824 /// but with all dynamically-allocated buffers duplicated in new buffers.
9825 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
9826 #[repr(C)]
9827 /// The contents of CResult_SiPrefixParseErrorZ
9828 pub union CResult_SiPrefixParseErrorZPtr {
9829         /// A pointer to the contents in the success state.
9830         /// Reading from this pointer when `result_ok` is not set is undefined.
9831         pub result: *mut crate::lightning_invoice::SiPrefix,
9832         /// A pointer to the contents in the error state.
9833         /// Reading from this pointer when `result_ok` is set is undefined.
9834         pub err: *mut crate::lightning_invoice::ParseError,
9835 }
9836 #[repr(C)]
9837 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
9838 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
9839 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9840 pub struct CResult_SiPrefixParseErrorZ {
9841         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
9842         /// `err` or `result` depending on the state of `result_ok`.
9843         pub contents: CResult_SiPrefixParseErrorZPtr,
9844         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
9845         pub result_ok: bool,
9846 }
9847 #[no_mangle]
9848 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
9849 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
9850         CResult_SiPrefixParseErrorZ {
9851                 contents: CResult_SiPrefixParseErrorZPtr {
9852                         result: Box::into_raw(Box::new(o)),
9853                 },
9854                 result_ok: true,
9855         }
9856 }
9857 #[no_mangle]
9858 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
9859 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
9860         CResult_SiPrefixParseErrorZ {
9861                 contents: CResult_SiPrefixParseErrorZPtr {
9862                         err: Box::into_raw(Box::new(e)),
9863                 },
9864                 result_ok: false,
9865         }
9866 }
9867 /// Checks if the given object is currently in the success state
9868 #[no_mangle]
9869 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
9870         o.result_ok
9871 }
9872 #[no_mangle]
9873 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
9874 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
9875 impl Drop for CResult_SiPrefixParseErrorZ {
9876         fn drop(&mut self) {
9877                 if self.result_ok {
9878                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9879                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9880                         }
9881                 } else {
9882                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9883                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9884                         }
9885                 }
9886         }
9887 }
9888 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
9889         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
9890                 let contents = if o.result_ok {
9891                         let result = unsafe { o.contents.result };
9892                         unsafe { o.contents.result = core::ptr::null_mut() };
9893                         CResult_SiPrefixParseErrorZPtr { result }
9894                 } else {
9895                         let err = unsafe { o.contents.err };
9896                         unsafe { o.contents.err = core::ptr::null_mut(); }
9897                         CResult_SiPrefixParseErrorZPtr { err }
9898                 };
9899                 Self {
9900                         contents,
9901                         result_ok: o.result_ok,
9902                 }
9903         }
9904 }
9905 impl Clone for CResult_SiPrefixParseErrorZ {
9906         fn clone(&self) -> Self {
9907                 if self.result_ok {
9908                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
9909                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
9910                         } }
9911                 } else {
9912                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
9913                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
9914                         } }
9915                 }
9916         }
9917 }
9918 #[no_mangle]
9919 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
9920 /// but with all dynamically-allocated buffers duplicated in new buffers.
9921 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
9922 #[repr(C)]
9923 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
9924 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
9925         /// A pointer to the contents in the success state.
9926         /// Reading from this pointer when `result_ok` is not set is undefined.
9927         pub result: *mut crate::lightning_invoice::Invoice,
9928         /// A pointer to the contents in the error state.
9929         /// Reading from this pointer when `result_ok` is set is undefined.
9930         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
9931 }
9932 #[repr(C)]
9933 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
9934 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
9935 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9936 pub struct CResult_InvoiceParseOrSemanticErrorZ {
9937         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
9938         /// `err` or `result` depending on the state of `result_ok`.
9939         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
9940         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
9941         pub result_ok: bool,
9942 }
9943 #[no_mangle]
9944 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
9945 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
9946         CResult_InvoiceParseOrSemanticErrorZ {
9947                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9948                         result: Box::into_raw(Box::new(o)),
9949                 },
9950                 result_ok: true,
9951         }
9952 }
9953 #[no_mangle]
9954 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
9955 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
9956         CResult_InvoiceParseOrSemanticErrorZ {
9957                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
9958                         err: Box::into_raw(Box::new(e)),
9959                 },
9960                 result_ok: false,
9961         }
9962 }
9963 /// Checks if the given object is currently in the success state
9964 #[no_mangle]
9965 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
9966         o.result_ok
9967 }
9968 #[no_mangle]
9969 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
9970 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
9971 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
9972         fn drop(&mut self) {
9973                 if self.result_ok {
9974                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9975                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9976                         }
9977                 } else {
9978                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9979                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9980                         }
9981                 }
9982         }
9983 }
9984 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
9985         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
9986                 let contents = if o.result_ok {
9987                         let result = unsafe { o.contents.result };
9988                         unsafe { o.contents.result = core::ptr::null_mut() };
9989                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
9990                 } else {
9991                         let err = unsafe { o.contents.err };
9992                         unsafe { o.contents.err = core::ptr::null_mut(); }
9993                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
9994                 };
9995                 Self {
9996                         contents,
9997                         result_ok: o.result_ok,
9998                 }
9999         }
10000 }
10001 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
10002         fn clone(&self) -> Self {
10003                 if self.result_ok {
10004                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10005                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10006                         } }
10007                 } else {
10008                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
10009                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
10010                         } }
10011                 }
10012         }
10013 }
10014 #[no_mangle]
10015 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
10016 /// but with all dynamically-allocated buffers duplicated in new buffers.
10017 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
10018 #[repr(C)]
10019 /// The contents of CResult_SignedRawInvoiceParseErrorZ
10020 pub union CResult_SignedRawInvoiceParseErrorZPtr {
10021         /// A pointer to the contents in the success state.
10022         /// Reading from this pointer when `result_ok` is not set is undefined.
10023         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
10024         /// A pointer to the contents in the error state.
10025         /// Reading from this pointer when `result_ok` is set is undefined.
10026         pub err: *mut crate::lightning_invoice::ParseError,
10027 }
10028 #[repr(C)]
10029 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
10030 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
10031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10032 pub struct CResult_SignedRawInvoiceParseErrorZ {
10033         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
10034         /// `err` or `result` depending on the state of `result_ok`.
10035         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
10036         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
10037         pub result_ok: bool,
10038 }
10039 #[no_mangle]
10040 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
10041 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
10042         CResult_SignedRawInvoiceParseErrorZ {
10043                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10044                         result: Box::into_raw(Box::new(o)),
10045                 },
10046                 result_ok: true,
10047         }
10048 }
10049 #[no_mangle]
10050 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
10051 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
10052         CResult_SignedRawInvoiceParseErrorZ {
10053                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
10054                         err: Box::into_raw(Box::new(e)),
10055                 },
10056                 result_ok: false,
10057         }
10058 }
10059 /// Checks if the given object is currently in the success state
10060 #[no_mangle]
10061 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
10062         o.result_ok
10063 }
10064 #[no_mangle]
10065 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
10066 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
10067 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
10068         fn drop(&mut self) {
10069                 if self.result_ok {
10070                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10071                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10072                         }
10073                 } else {
10074                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10075                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10076                         }
10077                 }
10078         }
10079 }
10080 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
10081         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
10082                 let contents = if o.result_ok {
10083                         let result = unsafe { o.contents.result };
10084                         unsafe { o.contents.result = core::ptr::null_mut() };
10085                         CResult_SignedRawInvoiceParseErrorZPtr { result }
10086                 } else {
10087                         let err = unsafe { o.contents.err };
10088                         unsafe { o.contents.err = core::ptr::null_mut(); }
10089                         CResult_SignedRawInvoiceParseErrorZPtr { err }
10090                 };
10091                 Self {
10092                         contents,
10093                         result_ok: o.result_ok,
10094                 }
10095         }
10096 }
10097 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
10098         fn clone(&self) -> Self {
10099                 if self.result_ok {
10100                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10101                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
10102                         } }
10103                 } else {
10104                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
10105                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
10106                         } }
10107                 }
10108         }
10109 }
10110 #[no_mangle]
10111 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
10112 /// but with all dynamically-allocated buffers duplicated in new buffers.
10113 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
10114 #[repr(C)]
10115 /// A tuple of 3 elements. See the individual fields for the types contained.
10116 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10117         /// The element at position 0
10118         pub a: crate::lightning_invoice::RawInvoice,
10119         /// The element at position 1
10120         pub b: crate::c_types::ThirtyTwoBytes,
10121         /// The element at position 2
10122         pub c: crate::lightning_invoice::InvoiceSignature,
10123 }
10124 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10125         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
10126                 Self {
10127                         a: tup.0,
10128                         b: tup.1,
10129                         c: tup.2,
10130                 }
10131         }
10132 }
10133 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10134         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
10135                 (self.a, self.b, self.c)
10136         }
10137 }
10138 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
10139         fn clone(&self) -> Self {
10140                 Self {
10141                         a: Clone::clone(&self.a),
10142                         b: Clone::clone(&self.b),
10143                         c: Clone::clone(&self.c),
10144                 }
10145         }
10146 }
10147 #[no_mangle]
10148 /// Creates a new tuple which has the same data as `orig`
10149 /// but with all dynamically-allocated buffers duplicated in new buffers.
10150 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
10151 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10152 #[no_mangle]
10153 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 {
10154         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
10155 }
10156
10157 #[no_mangle]
10158 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10159 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
10160 #[repr(C)]
10161 /// The contents of CResult_PayeePubKeyErrorZ
10162 pub union CResult_PayeePubKeyErrorZPtr {
10163         /// A pointer to the contents in the success state.
10164         /// Reading from this pointer when `result_ok` is not set is undefined.
10165         pub result: *mut crate::lightning_invoice::PayeePubKey,
10166         /// A pointer to the contents in the error state.
10167         /// Reading from this pointer when `result_ok` is set is undefined.
10168         pub err: *mut crate::c_types::Secp256k1Error,
10169 }
10170 #[repr(C)]
10171 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
10172 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
10173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174 pub struct CResult_PayeePubKeyErrorZ {
10175         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
10176         /// `err` or `result` depending on the state of `result_ok`.
10177         pub contents: CResult_PayeePubKeyErrorZPtr,
10178         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
10179         pub result_ok: bool,
10180 }
10181 #[no_mangle]
10182 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
10183 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
10184         CResult_PayeePubKeyErrorZ {
10185                 contents: CResult_PayeePubKeyErrorZPtr {
10186                         result: Box::into_raw(Box::new(o)),
10187                 },
10188                 result_ok: true,
10189         }
10190 }
10191 #[no_mangle]
10192 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
10193 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
10194         CResult_PayeePubKeyErrorZ {
10195                 contents: CResult_PayeePubKeyErrorZPtr {
10196                         err: Box::into_raw(Box::new(e)),
10197                 },
10198                 result_ok: false,
10199         }
10200 }
10201 /// Checks if the given object is currently in the success state
10202 #[no_mangle]
10203 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
10204         o.result_ok
10205 }
10206 #[no_mangle]
10207 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
10208 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
10209 impl Drop for CResult_PayeePubKeyErrorZ {
10210         fn drop(&mut self) {
10211                 if self.result_ok {
10212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10214                         }
10215                 } else {
10216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10218                         }
10219                 }
10220         }
10221 }
10222 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
10223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
10224                 let contents = if o.result_ok {
10225                         let result = unsafe { o.contents.result };
10226                         unsafe { o.contents.result = core::ptr::null_mut() };
10227                         CResult_PayeePubKeyErrorZPtr { result }
10228                 } else {
10229                         let err = unsafe { o.contents.err };
10230                         unsafe { o.contents.err = core::ptr::null_mut(); }
10231                         CResult_PayeePubKeyErrorZPtr { err }
10232                 };
10233                 Self {
10234                         contents,
10235                         result_ok: o.result_ok,
10236                 }
10237         }
10238 }
10239 impl Clone for CResult_PayeePubKeyErrorZ {
10240         fn clone(&self) -> Self {
10241                 if self.result_ok {
10242                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
10243                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
10244                         } }
10245                 } else {
10246                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
10247                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10248                         } }
10249                 }
10250         }
10251 }
10252 #[no_mangle]
10253 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10254 /// but with all dynamically-allocated buffers duplicated in new buffers.
10255 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
10256 #[repr(C)]
10257 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
10258 /// This corresponds to std::vector in C++
10259 pub struct CVec_PrivateRouteZ {
10260         /// The elements in the array.
10261         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10262         pub data: *mut crate::lightning_invoice::PrivateRoute,
10263         /// The number of elements pointed to by `data`.
10264         pub datalen: usize
10265 }
10266 impl CVec_PrivateRouteZ {
10267         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
10268                 if self.datalen == 0 { return Vec::new(); }
10269                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10270                 self.data = core::ptr::null_mut();
10271                 self.datalen = 0;
10272                 ret
10273         }
10274         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
10275                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10276         }
10277 }
10278 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
10279         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
10280                 let datalen = v.len();
10281                 let data = Box::into_raw(v.into_boxed_slice());
10282                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10283         }
10284 }
10285 #[no_mangle]
10286 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10287 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
10288 impl Drop for CVec_PrivateRouteZ {
10289         fn drop(&mut self) {
10290                 if self.datalen == 0 { return; }
10291                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10292         }
10293 }
10294 impl Clone for CVec_PrivateRouteZ {
10295         fn clone(&self) -> Self {
10296                 let mut res = Vec::new();
10297                 if self.datalen == 0 { return Self::from(res); }
10298                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10299                 Self::from(res)
10300         }
10301 }
10302 #[repr(C)]
10303 /// The contents of CResult_PositiveTimestampCreationErrorZ
10304 pub union CResult_PositiveTimestampCreationErrorZPtr {
10305         /// A pointer to the contents in the success state.
10306         /// Reading from this pointer when `result_ok` is not set is undefined.
10307         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
10308         /// A pointer to the contents in the error state.
10309         /// Reading from this pointer when `result_ok` is set is undefined.
10310         pub err: *mut crate::lightning_invoice::CreationError,
10311 }
10312 #[repr(C)]
10313 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
10314 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
10315 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10316 pub struct CResult_PositiveTimestampCreationErrorZ {
10317         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
10318         /// `err` or `result` depending on the state of `result_ok`.
10319         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
10320         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
10321         pub result_ok: bool,
10322 }
10323 #[no_mangle]
10324 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10325 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
10326         CResult_PositiveTimestampCreationErrorZ {
10327                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10328                         result: Box::into_raw(Box::new(o)),
10329                 },
10330                 result_ok: true,
10331         }
10332 }
10333 #[no_mangle]
10334 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10335 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
10336         CResult_PositiveTimestampCreationErrorZ {
10337                 contents: CResult_PositiveTimestampCreationErrorZPtr {
10338                         err: Box::into_raw(Box::new(e)),
10339                 },
10340                 result_ok: false,
10341         }
10342 }
10343 /// Checks if the given object is currently in the success state
10344 #[no_mangle]
10345 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
10346         o.result_ok
10347 }
10348 #[no_mangle]
10349 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10350 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
10351 impl Drop for CResult_PositiveTimestampCreationErrorZ {
10352         fn drop(&mut self) {
10353                 if self.result_ok {
10354                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10355                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10356                         }
10357                 } else {
10358                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10359                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10360                         }
10361                 }
10362         }
10363 }
10364 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
10365         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
10366                 let contents = if o.result_ok {
10367                         let result = unsafe { o.contents.result };
10368                         unsafe { o.contents.result = core::ptr::null_mut() };
10369                         CResult_PositiveTimestampCreationErrorZPtr { result }
10370                 } else {
10371                         let err = unsafe { o.contents.err };
10372                         unsafe { o.contents.err = core::ptr::null_mut(); }
10373                         CResult_PositiveTimestampCreationErrorZPtr { err }
10374                 };
10375                 Self {
10376                         contents,
10377                         result_ok: o.result_ok,
10378                 }
10379         }
10380 }
10381 impl Clone for CResult_PositiveTimestampCreationErrorZ {
10382         fn clone(&self) -> Self {
10383                 if self.result_ok {
10384                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
10385                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
10386                         } }
10387                 } else {
10388                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
10389                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10390                         } }
10391                 }
10392         }
10393 }
10394 #[no_mangle]
10395 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10396 /// but with all dynamically-allocated buffers duplicated in new buffers.
10397 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
10398 #[repr(C)]
10399 /// The contents of CResult_NoneSemanticErrorZ
10400 pub union CResult_NoneSemanticErrorZPtr {
10401         /// Note that this value is always NULL, as there are no contents in the OK variant
10402         pub result: *mut core::ffi::c_void,
10403         /// A pointer to the contents in the error state.
10404         /// Reading from this pointer when `result_ok` is set is undefined.
10405         pub err: *mut crate::lightning_invoice::SemanticError,
10406 }
10407 #[repr(C)]
10408 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
10409 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
10410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10411 pub struct CResult_NoneSemanticErrorZ {
10412         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
10413         /// `err` or `result` depending on the state of `result_ok`.
10414         pub contents: CResult_NoneSemanticErrorZPtr,
10415         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
10416         pub result_ok: bool,
10417 }
10418 #[no_mangle]
10419 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
10420 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
10421         CResult_NoneSemanticErrorZ {
10422                 contents: CResult_NoneSemanticErrorZPtr {
10423                         result: core::ptr::null_mut(),
10424                 },
10425                 result_ok: true,
10426         }
10427 }
10428 #[no_mangle]
10429 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
10430 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
10431         CResult_NoneSemanticErrorZ {
10432                 contents: CResult_NoneSemanticErrorZPtr {
10433                         err: Box::into_raw(Box::new(e)),
10434                 },
10435                 result_ok: false,
10436         }
10437 }
10438 /// Checks if the given object is currently in the success state
10439 #[no_mangle]
10440 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
10441         o.result_ok
10442 }
10443 #[no_mangle]
10444 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
10445 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
10446 impl Drop for CResult_NoneSemanticErrorZ {
10447         fn drop(&mut self) {
10448                 if self.result_ok {
10449                 } else {
10450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10452                         }
10453                 }
10454         }
10455 }
10456 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
10457         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
10458                 let contents = if o.result_ok {
10459                         let _ = unsafe { Box::from_raw(o.contents.result) };
10460                         o.contents.result = core::ptr::null_mut();
10461                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
10462                 } else {
10463                         let err = unsafe { o.contents.err };
10464                         unsafe { o.contents.err = core::ptr::null_mut(); }
10465                         CResult_NoneSemanticErrorZPtr { err }
10466                 };
10467                 Self {
10468                         contents,
10469                         result_ok: o.result_ok,
10470                 }
10471         }
10472 }
10473 impl Clone for CResult_NoneSemanticErrorZ {
10474         fn clone(&self) -> Self {
10475                 if self.result_ok {
10476                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
10477                                 result: core::ptr::null_mut()
10478                         } }
10479                 } else {
10480                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
10481                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10482                         } }
10483                 }
10484         }
10485 }
10486 #[no_mangle]
10487 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10488 /// but with all dynamically-allocated buffers duplicated in new buffers.
10489 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
10490 #[repr(C)]
10491 /// The contents of CResult_InvoiceSemanticErrorZ
10492 pub union CResult_InvoiceSemanticErrorZPtr {
10493         /// A pointer to the contents in the success state.
10494         /// Reading from this pointer when `result_ok` is not set is undefined.
10495         pub result: *mut crate::lightning_invoice::Invoice,
10496         /// A pointer to the contents in the error state.
10497         /// Reading from this pointer when `result_ok` is set is undefined.
10498         pub err: *mut crate::lightning_invoice::SemanticError,
10499 }
10500 #[repr(C)]
10501 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
10502 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
10503 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10504 pub struct CResult_InvoiceSemanticErrorZ {
10505         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
10506         /// `err` or `result` depending on the state of `result_ok`.
10507         pub contents: CResult_InvoiceSemanticErrorZPtr,
10508         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
10509         pub result_ok: bool,
10510 }
10511 #[no_mangle]
10512 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10513 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
10514         CResult_InvoiceSemanticErrorZ {
10515                 contents: CResult_InvoiceSemanticErrorZPtr {
10516                         result: Box::into_raw(Box::new(o)),
10517                 },
10518                 result_ok: true,
10519         }
10520 }
10521 #[no_mangle]
10522 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10523 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
10524         CResult_InvoiceSemanticErrorZ {
10525                 contents: CResult_InvoiceSemanticErrorZPtr {
10526                         err: Box::into_raw(Box::new(e)),
10527                 },
10528                 result_ok: false,
10529         }
10530 }
10531 /// Checks if the given object is currently in the success state
10532 #[no_mangle]
10533 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
10534         o.result_ok
10535 }
10536 #[no_mangle]
10537 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10538 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
10539 impl Drop for CResult_InvoiceSemanticErrorZ {
10540         fn drop(&mut self) {
10541                 if self.result_ok {
10542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10544                         }
10545                 } else {
10546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10548                         }
10549                 }
10550         }
10551 }
10552 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
10553         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
10554                 let contents = if o.result_ok {
10555                         let result = unsafe { o.contents.result };
10556                         unsafe { o.contents.result = core::ptr::null_mut() };
10557                         CResult_InvoiceSemanticErrorZPtr { result }
10558                 } else {
10559                         let err = unsafe { o.contents.err };
10560                         unsafe { o.contents.err = core::ptr::null_mut(); }
10561                         CResult_InvoiceSemanticErrorZPtr { err }
10562                 };
10563                 Self {
10564                         contents,
10565                         result_ok: o.result_ok,
10566                 }
10567         }
10568 }
10569 impl Clone for CResult_InvoiceSemanticErrorZ {
10570         fn clone(&self) -> Self {
10571                 if self.result_ok {
10572                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
10573                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
10574                         } }
10575                 } else {
10576                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
10577                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
10578                         } }
10579                 }
10580         }
10581 }
10582 #[no_mangle]
10583 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10584 /// but with all dynamically-allocated buffers duplicated in new buffers.
10585 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
10586 #[repr(C)]
10587 /// The contents of CResult_DescriptionCreationErrorZ
10588 pub union CResult_DescriptionCreationErrorZPtr {
10589         /// A pointer to the contents in the success state.
10590         /// Reading from this pointer when `result_ok` is not set is undefined.
10591         pub result: *mut crate::lightning_invoice::Description,
10592         /// A pointer to the contents in the error state.
10593         /// Reading from this pointer when `result_ok` is set is undefined.
10594         pub err: *mut crate::lightning_invoice::CreationError,
10595 }
10596 #[repr(C)]
10597 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
10598 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
10599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10600 pub struct CResult_DescriptionCreationErrorZ {
10601         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
10602         /// `err` or `result` depending on the state of `result_ok`.
10603         pub contents: CResult_DescriptionCreationErrorZPtr,
10604         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
10605         pub result_ok: bool,
10606 }
10607 #[no_mangle]
10608 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
10609 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
10610         CResult_DescriptionCreationErrorZ {
10611                 contents: CResult_DescriptionCreationErrorZPtr {
10612                         result: Box::into_raw(Box::new(o)),
10613                 },
10614                 result_ok: true,
10615         }
10616 }
10617 #[no_mangle]
10618 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
10619 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
10620         CResult_DescriptionCreationErrorZ {
10621                 contents: CResult_DescriptionCreationErrorZPtr {
10622                         err: Box::into_raw(Box::new(e)),
10623                 },
10624                 result_ok: false,
10625         }
10626 }
10627 /// Checks if the given object is currently in the success state
10628 #[no_mangle]
10629 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
10630         o.result_ok
10631 }
10632 #[no_mangle]
10633 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
10634 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
10635 impl Drop for CResult_DescriptionCreationErrorZ {
10636         fn drop(&mut self) {
10637                 if self.result_ok {
10638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10640                         }
10641                 } else {
10642                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10643                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10644                         }
10645                 }
10646         }
10647 }
10648 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
10649         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
10650                 let contents = if o.result_ok {
10651                         let result = unsafe { o.contents.result };
10652                         unsafe { o.contents.result = core::ptr::null_mut() };
10653                         CResult_DescriptionCreationErrorZPtr { result }
10654                 } else {
10655                         let err = unsafe { o.contents.err };
10656                         unsafe { o.contents.err = core::ptr::null_mut(); }
10657                         CResult_DescriptionCreationErrorZPtr { err }
10658                 };
10659                 Self {
10660                         contents,
10661                         result_ok: o.result_ok,
10662                 }
10663         }
10664 }
10665 impl Clone for CResult_DescriptionCreationErrorZ {
10666         fn clone(&self) -> Self {
10667                 if self.result_ok {
10668                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
10669                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
10670                         } }
10671                 } else {
10672                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
10673                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10674                         } }
10675                 }
10676         }
10677 }
10678 #[no_mangle]
10679 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10680 /// but with all dynamically-allocated buffers duplicated in new buffers.
10681 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
10682 #[repr(C)]
10683 /// The contents of CResult_PrivateRouteCreationErrorZ
10684 pub union CResult_PrivateRouteCreationErrorZPtr {
10685         /// A pointer to the contents in the success state.
10686         /// Reading from this pointer when `result_ok` is not set is undefined.
10687         pub result: *mut crate::lightning_invoice::PrivateRoute,
10688         /// A pointer to the contents in the error state.
10689         /// Reading from this pointer when `result_ok` is set is undefined.
10690         pub err: *mut crate::lightning_invoice::CreationError,
10691 }
10692 #[repr(C)]
10693 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
10694 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
10695 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10696 pub struct CResult_PrivateRouteCreationErrorZ {
10697         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
10698         /// `err` or `result` depending on the state of `result_ok`.
10699         pub contents: CResult_PrivateRouteCreationErrorZPtr,
10700         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
10701         pub result_ok: bool,
10702 }
10703 #[no_mangle]
10704 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10705 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
10706         CResult_PrivateRouteCreationErrorZ {
10707                 contents: CResult_PrivateRouteCreationErrorZPtr {
10708                         result: Box::into_raw(Box::new(o)),
10709                 },
10710                 result_ok: true,
10711         }
10712 }
10713 #[no_mangle]
10714 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10715 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
10716         CResult_PrivateRouteCreationErrorZ {
10717                 contents: CResult_PrivateRouteCreationErrorZPtr {
10718                         err: Box::into_raw(Box::new(e)),
10719                 },
10720                 result_ok: false,
10721         }
10722 }
10723 /// Checks if the given object is currently in the success state
10724 #[no_mangle]
10725 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
10726         o.result_ok
10727 }
10728 #[no_mangle]
10729 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10730 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
10731 impl Drop for CResult_PrivateRouteCreationErrorZ {
10732         fn drop(&mut self) {
10733                 if self.result_ok {
10734                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10735                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10736                         }
10737                 } else {
10738                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10739                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10740                         }
10741                 }
10742         }
10743 }
10744 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
10745         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
10746                 let contents = if o.result_ok {
10747                         let result = unsafe { o.contents.result };
10748                         unsafe { o.contents.result = core::ptr::null_mut() };
10749                         CResult_PrivateRouteCreationErrorZPtr { result }
10750                 } else {
10751                         let err = unsafe { o.contents.err };
10752                         unsafe { o.contents.err = core::ptr::null_mut(); }
10753                         CResult_PrivateRouteCreationErrorZPtr { err }
10754                 };
10755                 Self {
10756                         contents,
10757                         result_ok: o.result_ok,
10758                 }
10759         }
10760 }
10761 impl Clone for CResult_PrivateRouteCreationErrorZ {
10762         fn clone(&self) -> Self {
10763                 if self.result_ok {
10764                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
10765                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
10766                         } }
10767                 } else {
10768                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
10769                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
10770                         } }
10771                 }
10772         }
10773 }
10774 #[no_mangle]
10775 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10776 /// but with all dynamically-allocated buffers duplicated in new buffers.
10777 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
10778 #[repr(C)]
10779 /// The contents of CResult_StringErrorZ
10780 pub union CResult_StringErrorZPtr {
10781         /// A pointer to the contents in the success state.
10782         /// Reading from this pointer when `result_ok` is not set is undefined.
10783         pub result: *mut crate::c_types::Str,
10784         /// A pointer to the contents in the error state.
10785         /// Reading from this pointer when `result_ok` is set is undefined.
10786         pub err: *mut crate::c_types::Secp256k1Error,
10787 }
10788 #[repr(C)]
10789 /// A CResult_StringErrorZ represents the result of a fallible operation,
10790 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
10791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10792 pub struct CResult_StringErrorZ {
10793         /// The contents of this CResult_StringErrorZ, accessible via either
10794         /// `err` or `result` depending on the state of `result_ok`.
10795         pub contents: CResult_StringErrorZPtr,
10796         /// Whether this CResult_StringErrorZ represents a success state.
10797         pub result_ok: bool,
10798 }
10799 #[no_mangle]
10800 /// Creates a new CResult_StringErrorZ in the success state.
10801 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
10802         CResult_StringErrorZ {
10803                 contents: CResult_StringErrorZPtr {
10804                         result: Box::into_raw(Box::new(o)),
10805                 },
10806                 result_ok: true,
10807         }
10808 }
10809 #[no_mangle]
10810 /// Creates a new CResult_StringErrorZ in the error state.
10811 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
10812         CResult_StringErrorZ {
10813                 contents: CResult_StringErrorZPtr {
10814                         err: Box::into_raw(Box::new(e)),
10815                 },
10816                 result_ok: false,
10817         }
10818 }
10819 /// Checks if the given object is currently in the success state
10820 #[no_mangle]
10821 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
10822         o.result_ok
10823 }
10824 #[no_mangle]
10825 /// Frees any resources used by the CResult_StringErrorZ.
10826 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
10827 impl Drop for CResult_StringErrorZ {
10828         fn drop(&mut self) {
10829                 if self.result_ok {
10830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10832                         }
10833                 } else {
10834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10836                         }
10837                 }
10838         }
10839 }
10840 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
10841         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
10842                 let contents = if o.result_ok {
10843                         let result = unsafe { o.contents.result };
10844                         unsafe { o.contents.result = core::ptr::null_mut() };
10845                         CResult_StringErrorZPtr { result }
10846                 } else {
10847                         let err = unsafe { o.contents.err };
10848                         unsafe { o.contents.err = core::ptr::null_mut(); }
10849                         CResult_StringErrorZPtr { err }
10850                 };
10851                 Self {
10852                         contents,
10853                         result_ok: o.result_ok,
10854                 }
10855         }
10856 }
10857 impl Clone for CResult_StringErrorZ {
10858         fn clone(&self) -> Self {
10859                 if self.result_ok {
10860                         Self { result_ok: true, contents: CResult_StringErrorZPtr {
10861                                 result: Box::into_raw(Box::new(<crate::c_types::Str>::clone(unsafe { &*self.contents.result })))
10862                         } }
10863                 } else {
10864                         Self { result_ok: false, contents: CResult_StringErrorZPtr {
10865                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
10866                         } }
10867                 }
10868         }
10869 }
10870 #[no_mangle]
10871 /// Creates a new CResult_StringErrorZ which has the same data as `orig`
10872 /// but with all dynamically-allocated buffers duplicated in new buffers.
10873 pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) }
10874 #[repr(C)]
10875 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
10876 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10877         /// A pointer to the contents in the success state.
10878         /// Reading from this pointer when `result_ok` is not set is undefined.
10879         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
10880         /// A pointer to the contents in the error state.
10881         /// Reading from this pointer when `result_ok` is set is undefined.
10882         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10883 }
10884 #[repr(C)]
10885 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
10886 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10887 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10888 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
10889         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
10890         /// `err` or `result` depending on the state of `result_ok`.
10891         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
10892         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
10893         pub result_ok: bool,
10894 }
10895 #[no_mangle]
10896 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10897 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10898         CResult_ChannelMonitorUpdateDecodeErrorZ {
10899                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10900                         result: Box::into_raw(Box::new(o)),
10901                 },
10902                 result_ok: true,
10903         }
10904 }
10905 #[no_mangle]
10906 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10907 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
10908         CResult_ChannelMonitorUpdateDecodeErrorZ {
10909                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10910                         err: Box::into_raw(Box::new(e)),
10911                 },
10912                 result_ok: false,
10913         }
10914 }
10915 /// Checks if the given object is currently in the success state
10916 #[no_mangle]
10917 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
10918         o.result_ok
10919 }
10920 #[no_mangle]
10921 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10922 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
10923 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
10924         fn drop(&mut self) {
10925                 if self.result_ok {
10926                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10927                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10928                         }
10929                 } else {
10930                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10931                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10932                         }
10933                 }
10934         }
10935 }
10936 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
10937         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
10938                 let contents = if o.result_ok {
10939                         let result = unsafe { o.contents.result };
10940                         unsafe { o.contents.result = core::ptr::null_mut() };
10941                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
10942                 } else {
10943                         let err = unsafe { o.contents.err };
10944                         unsafe { o.contents.err = core::ptr::null_mut(); }
10945                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
10946                 };
10947                 Self {
10948                         contents,
10949                         result_ok: o.result_ok,
10950                 }
10951         }
10952 }
10953 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
10954         fn clone(&self) -> Self {
10955                 if self.result_ok {
10956                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10957                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
10958                         } }
10959                 } else {
10960                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
10961                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10962                         } }
10963                 }
10964         }
10965 }
10966 #[no_mangle]
10967 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10968 /// but with all dynamically-allocated buffers duplicated in new buffers.
10969 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
10970 #[repr(C)]
10971 #[derive(Clone)]
10972 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
10973 pub enum COption_MonitorEventZ {
10974         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
10975         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
10976         /// When we're in this state, this COption_MonitorEventZ contains nothing
10977         None
10978 }
10979 impl COption_MonitorEventZ {
10980         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10981                 if let Self::None = self { false } else { true }
10982         }
10983         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10984                 !self.is_some()
10985         }
10986         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
10987                 if let Self::Some(v) = self { v } else { unreachable!() }
10988         }
10989 }
10990 #[no_mangle]
10991 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
10992 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
10993         COption_MonitorEventZ::Some(o)
10994 }
10995 #[no_mangle]
10996 /// Constructs a new COption_MonitorEventZ containing nothing
10997 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
10998         COption_MonitorEventZ::None
10999 }
11000 #[no_mangle]
11001 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
11002 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
11003 #[no_mangle]
11004 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
11005 /// but with all dynamically-allocated buffers duplicated in new buffers.
11006 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
11007 #[repr(C)]
11008 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
11009 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
11010         /// A pointer to the contents in the success state.
11011         /// Reading from this pointer when `result_ok` is not set is undefined.
11012         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
11013         /// A pointer to the contents in the error state.
11014         /// Reading from this pointer when `result_ok` is set is undefined.
11015         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11016 }
11017 #[repr(C)]
11018 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
11019 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11020 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11021 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
11022         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
11023         /// `err` or `result` depending on the state of `result_ok`.
11024         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
11025         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
11026         pub result_ok: bool,
11027 }
11028 #[no_mangle]
11029 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
11030 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
11031         CResult_COption_MonitorEventZDecodeErrorZ {
11032                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11033                         result: Box::into_raw(Box::new(o)),
11034                 },
11035                 result_ok: true,
11036         }
11037 }
11038 #[no_mangle]
11039 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
11040 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
11041         CResult_COption_MonitorEventZDecodeErrorZ {
11042                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11043                         err: Box::into_raw(Box::new(e)),
11044                 },
11045                 result_ok: false,
11046         }
11047 }
11048 /// Checks if the given object is currently in the success state
11049 #[no_mangle]
11050 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
11051         o.result_ok
11052 }
11053 #[no_mangle]
11054 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
11055 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
11056 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
11057         fn drop(&mut self) {
11058                 if self.result_ok {
11059                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11060                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11061                         }
11062                 } else {
11063                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11064                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11065                         }
11066                 }
11067         }
11068 }
11069 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
11070         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11071                 let contents = if o.result_ok {
11072                         let result = unsafe { o.contents.result };
11073                         unsafe { o.contents.result = core::ptr::null_mut() };
11074                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
11075                 } else {
11076                         let err = unsafe { o.contents.err };
11077                         unsafe { o.contents.err = core::ptr::null_mut(); }
11078                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
11079                 };
11080                 Self {
11081                         contents,
11082                         result_ok: o.result_ok,
11083                 }
11084         }
11085 }
11086 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
11087         fn clone(&self) -> Self {
11088                 if self.result_ok {
11089                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11090                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
11091                         } }
11092                 } else {
11093                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
11094                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11095                         } }
11096                 }
11097         }
11098 }
11099 #[no_mangle]
11100 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
11101 /// but with all dynamically-allocated buffers duplicated in new buffers.
11102 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
11103 #[repr(C)]
11104 /// The contents of CResult_HTLCUpdateDecodeErrorZ
11105 pub union CResult_HTLCUpdateDecodeErrorZPtr {
11106         /// A pointer to the contents in the success state.
11107         /// Reading from this pointer when `result_ok` is not set is undefined.
11108         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
11109         /// A pointer to the contents in the error state.
11110         /// Reading from this pointer when `result_ok` is set is undefined.
11111         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11112 }
11113 #[repr(C)]
11114 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
11115 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
11116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11117 pub struct CResult_HTLCUpdateDecodeErrorZ {
11118         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
11119         /// `err` or `result` depending on the state of `result_ok`.
11120         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
11121         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
11122         pub result_ok: bool,
11123 }
11124 #[no_mangle]
11125 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
11126 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
11127         CResult_HTLCUpdateDecodeErrorZ {
11128                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11129                         result: Box::into_raw(Box::new(o)),
11130                 },
11131                 result_ok: true,
11132         }
11133 }
11134 #[no_mangle]
11135 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
11136 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
11137         CResult_HTLCUpdateDecodeErrorZ {
11138                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
11139                         err: Box::into_raw(Box::new(e)),
11140                 },
11141                 result_ok: false,
11142         }
11143 }
11144 /// Checks if the given object is currently in the success state
11145 #[no_mangle]
11146 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
11147         o.result_ok
11148 }
11149 #[no_mangle]
11150 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
11151 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
11152 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
11153         fn drop(&mut self) {
11154                 if self.result_ok {
11155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11157                         }
11158                 } else {
11159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11161                         }
11162                 }
11163         }
11164 }
11165 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
11166         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
11167                 let contents = if o.result_ok {
11168                         let result = unsafe { o.contents.result };
11169                         unsafe { o.contents.result = core::ptr::null_mut() };
11170                         CResult_HTLCUpdateDecodeErrorZPtr { result }
11171                 } else {
11172                         let err = unsafe { o.contents.err };
11173                         unsafe { o.contents.err = core::ptr::null_mut(); }
11174                         CResult_HTLCUpdateDecodeErrorZPtr { err }
11175                 };
11176                 Self {
11177                         contents,
11178                         result_ok: o.result_ok,
11179                 }
11180         }
11181 }
11182 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
11183         fn clone(&self) -> Self {
11184                 if self.result_ok {
11185                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11186                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
11187                         } }
11188                 } else {
11189                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
11190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11191                         } }
11192                 }
11193         }
11194 }
11195 #[no_mangle]
11196 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
11197 /// but with all dynamically-allocated buffers duplicated in new buffers.
11198 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
11199 #[repr(C)]
11200 /// A tuple of 2 elements. See the individual fields for the types contained.
11201 pub struct C2Tuple_OutPointScriptZ {
11202         /// The element at position 0
11203         pub a: crate::lightning::chain::transaction::OutPoint,
11204         /// The element at position 1
11205         pub b: crate::c_types::derived::CVec_u8Z,
11206 }
11207 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
11208         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
11209                 Self {
11210                         a: tup.0,
11211                         b: tup.1,
11212                 }
11213         }
11214 }
11215 impl C2Tuple_OutPointScriptZ {
11216         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
11217                 (self.a, self.b)
11218         }
11219 }
11220 impl Clone for C2Tuple_OutPointScriptZ {
11221         fn clone(&self) -> Self {
11222                 Self {
11223                         a: Clone::clone(&self.a),
11224                         b: Clone::clone(&self.b),
11225                 }
11226         }
11227 }
11228 #[no_mangle]
11229 /// Creates a new tuple which has the same data as `orig`
11230 /// but with all dynamically-allocated buffers duplicated in new buffers.
11231 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
11232 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
11233 #[no_mangle]
11234 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
11235         C2Tuple_OutPointScriptZ { a, b, }
11236 }
11237
11238 #[no_mangle]
11239 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
11240 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
11241 #[repr(C)]
11242 /// A tuple of 2 elements. See the individual fields for the types contained.
11243 pub struct C2Tuple_u32ScriptZ {
11244         /// The element at position 0
11245         pub a: u32,
11246         /// The element at position 1
11247         pub b: crate::c_types::derived::CVec_u8Z,
11248 }
11249 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
11250         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
11251                 Self {
11252                         a: tup.0,
11253                         b: tup.1,
11254                 }
11255         }
11256 }
11257 impl C2Tuple_u32ScriptZ {
11258         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
11259                 (self.a, self.b)
11260         }
11261 }
11262 impl Clone for C2Tuple_u32ScriptZ {
11263         fn clone(&self) -> Self {
11264                 Self {
11265                         a: Clone::clone(&self.a),
11266                         b: Clone::clone(&self.b),
11267                 }
11268         }
11269 }
11270 #[no_mangle]
11271 /// Creates a new tuple which has the same data as `orig`
11272 /// but with all dynamically-allocated buffers duplicated in new buffers.
11273 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
11274 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
11275 #[no_mangle]
11276 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
11277         C2Tuple_u32ScriptZ { a, b, }
11278 }
11279
11280 #[no_mangle]
11281 /// Frees any resources used by the C2Tuple_u32ScriptZ.
11282 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
11283 #[repr(C)]
11284 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
11285 /// This corresponds to std::vector in C++
11286 pub struct CVec_C2Tuple_u32ScriptZZ {
11287         /// The elements in the array.
11288         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11289         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
11290         /// The number of elements pointed to by `data`.
11291         pub datalen: usize
11292 }
11293 impl CVec_C2Tuple_u32ScriptZZ {
11294         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
11295                 if self.datalen == 0 { return Vec::new(); }
11296                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11297                 self.data = core::ptr::null_mut();
11298                 self.datalen = 0;
11299                 ret
11300         }
11301         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
11302                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11303         }
11304 }
11305 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
11306         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
11307                 let datalen = v.len();
11308                 let data = Box::into_raw(v.into_boxed_slice());
11309                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11310         }
11311 }
11312 #[no_mangle]
11313 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11314 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
11315 impl Drop for CVec_C2Tuple_u32ScriptZZ {
11316         fn drop(&mut self) {
11317                 if self.datalen == 0 { return; }
11318                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11319         }
11320 }
11321 impl Clone for CVec_C2Tuple_u32ScriptZZ {
11322         fn clone(&self) -> Self {
11323                 let mut res = Vec::new();
11324                 if self.datalen == 0 { return Self::from(res); }
11325                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11326                 Self::from(res)
11327         }
11328 }
11329 #[repr(C)]
11330 /// A tuple of 2 elements. See the individual fields for the types contained.
11331 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11332         /// The element at position 0
11333         pub a: crate::c_types::ThirtyTwoBytes,
11334         /// The element at position 1
11335         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
11336 }
11337 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11338         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
11339                 Self {
11340                         a: tup.0,
11341                         b: tup.1,
11342                 }
11343         }
11344 }
11345 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11346         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
11347                 (self.a, self.b)
11348         }
11349 }
11350 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
11351         fn clone(&self) -> Self {
11352                 Self {
11353                         a: Clone::clone(&self.a),
11354                         b: Clone::clone(&self.b),
11355                 }
11356         }
11357 }
11358 #[no_mangle]
11359 /// Creates a new tuple which has the same data as `orig`
11360 /// but with all dynamically-allocated buffers duplicated in new buffers.
11361 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
11362 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
11363 #[no_mangle]
11364 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 {
11365         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
11366 }
11367
11368 #[no_mangle]
11369 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
11370 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
11371 #[repr(C)]
11372 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
11373 /// This corresponds to std::vector in C++
11374 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11375         /// The elements in the array.
11376         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11377         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
11378         /// The number of elements pointed to by `data`.
11379         pub datalen: usize
11380 }
11381 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11382         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
11383                 if self.datalen == 0 { return Vec::new(); }
11384                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11385                 self.data = core::ptr::null_mut();
11386                 self.datalen = 0;
11387                 ret
11388         }
11389         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
11390                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11391         }
11392 }
11393 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11394         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
11395                 let datalen = v.len();
11396                 let data = Box::into_raw(v.into_boxed_slice());
11397                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11398         }
11399 }
11400 #[no_mangle]
11401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11402 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
11403 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11404         fn drop(&mut self) {
11405                 if self.datalen == 0 { return; }
11406                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11407         }
11408 }
11409 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
11410         fn clone(&self) -> Self {
11411                 let mut res = Vec::new();
11412                 if self.datalen == 0 { return Self::from(res); }
11413                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11414                 Self::from(res)
11415         }
11416 }
11417 #[repr(C)]
11418 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
11419 /// This corresponds to std::vector in C++
11420 pub struct CVec_EventZ {
11421         /// The elements in the array.
11422         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11423         pub data: *mut crate::lightning::util::events::Event,
11424         /// The number of elements pointed to by `data`.
11425         pub datalen: usize
11426 }
11427 impl CVec_EventZ {
11428         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
11429                 if self.datalen == 0 { return Vec::new(); }
11430                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11431                 self.data = core::ptr::null_mut();
11432                 self.datalen = 0;
11433                 ret
11434         }
11435         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
11436                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11437         }
11438 }
11439 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
11440         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
11441                 let datalen = v.len();
11442                 let data = Box::into_raw(v.into_boxed_slice());
11443                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11444         }
11445 }
11446 #[no_mangle]
11447 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11448 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
11449 impl Drop for CVec_EventZ {
11450         fn drop(&mut self) {
11451                 if self.datalen == 0 { return; }
11452                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11453         }
11454 }
11455 impl Clone for CVec_EventZ {
11456         fn clone(&self) -> Self {
11457                 let mut res = Vec::new();
11458                 if self.datalen == 0 { return Self::from(res); }
11459                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11460                 Self::from(res)
11461         }
11462 }
11463 #[repr(C)]
11464 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
11465 /// This corresponds to std::vector in C++
11466 pub struct CVec_TransactionZ {
11467         /// The elements in the array.
11468         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11469         pub data: *mut crate::c_types::Transaction,
11470         /// The number of elements pointed to by `data`.
11471         pub datalen: usize
11472 }
11473 impl CVec_TransactionZ {
11474         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
11475                 if self.datalen == 0 { return Vec::new(); }
11476                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11477                 self.data = core::ptr::null_mut();
11478                 self.datalen = 0;
11479                 ret
11480         }
11481         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
11482                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11483         }
11484 }
11485 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
11486         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
11487                 let datalen = v.len();
11488                 let data = Box::into_raw(v.into_boxed_slice());
11489                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11490         }
11491 }
11492 #[no_mangle]
11493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11494 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
11495 impl Drop for CVec_TransactionZ {
11496         fn drop(&mut self) {
11497                 if self.datalen == 0 { return; }
11498                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11499         }
11500 }
11501 impl Clone for CVec_TransactionZ {
11502         fn clone(&self) -> Self {
11503                 let mut res = Vec::new();
11504                 if self.datalen == 0 { return Self::from(res); }
11505                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11506                 Self::from(res)
11507         }
11508 }
11509 #[repr(C)]
11510 /// A tuple of 2 elements. See the individual fields for the types contained.
11511 pub struct C2Tuple_u32TxOutZ {
11512         /// The element at position 0
11513         pub a: u32,
11514         /// The element at position 1
11515         pub b: crate::c_types::TxOut,
11516 }
11517 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
11518         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
11519                 Self {
11520                         a: tup.0,
11521                         b: tup.1,
11522                 }
11523         }
11524 }
11525 impl C2Tuple_u32TxOutZ {
11526         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
11527                 (self.a, self.b)
11528         }
11529 }
11530 impl Clone for C2Tuple_u32TxOutZ {
11531         fn clone(&self) -> Self {
11532                 Self {
11533                         a: Clone::clone(&self.a),
11534                         b: Clone::clone(&self.b),
11535                 }
11536         }
11537 }
11538 #[no_mangle]
11539 /// Creates a new tuple which has the same data as `orig`
11540 /// but with all dynamically-allocated buffers duplicated in new buffers.
11541 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
11542 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
11543 #[no_mangle]
11544 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
11545         C2Tuple_u32TxOutZ { a, b, }
11546 }
11547
11548 #[no_mangle]
11549 /// Frees any resources used by the C2Tuple_u32TxOutZ.
11550 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
11551 #[repr(C)]
11552 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
11553 /// This corresponds to std::vector in C++
11554 pub struct CVec_C2Tuple_u32TxOutZZ {
11555         /// The elements in the array.
11556         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11557         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
11558         /// The number of elements pointed to by `data`.
11559         pub datalen: usize
11560 }
11561 impl CVec_C2Tuple_u32TxOutZZ {
11562         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
11563                 if self.datalen == 0 { return Vec::new(); }
11564                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11565                 self.data = core::ptr::null_mut();
11566                 self.datalen = 0;
11567                 ret
11568         }
11569         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
11570                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11571         }
11572 }
11573 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
11574         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
11575                 let datalen = v.len();
11576                 let data = Box::into_raw(v.into_boxed_slice());
11577                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11578         }
11579 }
11580 #[no_mangle]
11581 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11582 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
11583 impl Drop for CVec_C2Tuple_u32TxOutZZ {
11584         fn drop(&mut self) {
11585                 if self.datalen == 0 { return; }
11586                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11587         }
11588 }
11589 impl Clone for CVec_C2Tuple_u32TxOutZZ {
11590         fn clone(&self) -> Self {
11591                 let mut res = Vec::new();
11592                 if self.datalen == 0 { return Self::from(res); }
11593                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11594                 Self::from(res)
11595         }
11596 }
11597 #[repr(C)]
11598 /// A tuple of 2 elements. See the individual fields for the types contained.
11599 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11600         /// The element at position 0
11601         pub a: crate::c_types::ThirtyTwoBytes,
11602         /// The element at position 1
11603         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
11604 }
11605 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11606         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
11607                 Self {
11608                         a: tup.0,
11609                         b: tup.1,
11610                 }
11611         }
11612 }
11613 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11614         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
11615                 (self.a, self.b)
11616         }
11617 }
11618 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
11619         fn clone(&self) -> Self {
11620                 Self {
11621                         a: Clone::clone(&self.a),
11622                         b: Clone::clone(&self.b),
11623                 }
11624         }
11625 }
11626 #[no_mangle]
11627 /// Creates a new tuple which has the same data as `orig`
11628 /// but with all dynamically-allocated buffers duplicated in new buffers.
11629 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
11630 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
11631 #[no_mangle]
11632 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 {
11633         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
11634 }
11635
11636 #[no_mangle]
11637 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
11638 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
11639 #[repr(C)]
11640 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
11641 /// This corresponds to std::vector in C++
11642 pub struct CVec_TransactionOutputsZ {
11643         /// The elements in the array.
11644         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11645         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
11646         /// The number of elements pointed to by `data`.
11647         pub datalen: usize
11648 }
11649 impl CVec_TransactionOutputsZ {
11650         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
11651                 if self.datalen == 0 { return Vec::new(); }
11652                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11653                 self.data = core::ptr::null_mut();
11654                 self.datalen = 0;
11655                 ret
11656         }
11657         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
11658                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11659         }
11660 }
11661 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
11662         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
11663                 let datalen = v.len();
11664                 let data = Box::into_raw(v.into_boxed_slice());
11665                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11666         }
11667 }
11668 #[no_mangle]
11669 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11670 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
11671 impl Drop for CVec_TransactionOutputsZ {
11672         fn drop(&mut self) {
11673                 if self.datalen == 0 { return; }
11674                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11675         }
11676 }
11677 impl Clone for CVec_TransactionOutputsZ {
11678         fn clone(&self) -> Self {
11679                 let mut res = Vec::new();
11680                 if self.datalen == 0 { return Self::from(res); }
11681                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11682                 Self::from(res)
11683         }
11684 }
11685 #[repr(C)]
11686 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
11687 /// This corresponds to std::vector in C++
11688 pub struct CVec_BalanceZ {
11689         /// The elements in the array.
11690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11691         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
11692         /// The number of elements pointed to by `data`.
11693         pub datalen: usize
11694 }
11695 impl CVec_BalanceZ {
11696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
11697                 if self.datalen == 0 { return Vec::new(); }
11698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11699                 self.data = core::ptr::null_mut();
11700                 self.datalen = 0;
11701                 ret
11702         }
11703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
11704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11705         }
11706 }
11707 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
11708         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
11709                 let datalen = v.len();
11710                 let data = Box::into_raw(v.into_boxed_slice());
11711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11712         }
11713 }
11714 #[no_mangle]
11715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11716 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
11717 impl Drop for CVec_BalanceZ {
11718         fn drop(&mut self) {
11719                 if self.datalen == 0 { return; }
11720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11721         }
11722 }
11723 impl Clone for CVec_BalanceZ {
11724         fn clone(&self) -> Self {
11725                 let mut res = Vec::new();
11726                 if self.datalen == 0 { return Self::from(res); }
11727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11728                 Self::from(res)
11729         }
11730 }
11731 #[repr(C)]
11732 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
11733 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11734         /// A pointer to the contents in the success state.
11735         /// Reading from this pointer when `result_ok` is not set is undefined.
11736         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
11737         /// A pointer to the contents in the error state.
11738         /// Reading from this pointer when `result_ok` is set is undefined.
11739         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11740 }
11741 #[repr(C)]
11742 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
11743 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
11744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11745 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11746         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
11747         /// `err` or `result` depending on the state of `result_ok`.
11748         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
11749         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
11750         pub result_ok: bool,
11751 }
11752 #[no_mangle]
11753 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
11754 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11755         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11756                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11757                         result: Box::into_raw(Box::new(o)),
11758                 },
11759                 result_ok: true,
11760         }
11761 }
11762 #[no_mangle]
11763 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
11764 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11765         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11766                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
11767                         err: Box::into_raw(Box::new(e)),
11768                 },
11769                 result_ok: false,
11770         }
11771 }
11772 /// Checks if the given object is currently in the success state
11773 #[no_mangle]
11774 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
11775         o.result_ok
11776 }
11777 #[no_mangle]
11778 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
11779 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
11780 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11781         fn drop(&mut self) {
11782                 if self.result_ok {
11783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11785                         }
11786                 } else {
11787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11789                         }
11790                 }
11791         }
11792 }
11793 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
11794         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11795                 let contents = if o.result_ok {
11796                         let result = unsafe { o.contents.result };
11797                         unsafe { o.contents.result = core::ptr::null_mut() };
11798                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
11799                 } else {
11800                         let err = unsafe { o.contents.err };
11801                         unsafe { o.contents.err = core::ptr::null_mut(); }
11802                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
11803                 };
11804                 Self {
11805                         contents,
11806                         result_ok: o.result_ok,
11807                 }
11808         }
11809 }
11810 #[repr(C)]
11811 /// A tuple of 2 elements. See the individual fields for the types contained.
11812 pub struct C2Tuple_PublicKeyTypeZ {
11813         /// The element at position 0
11814         pub a: crate::c_types::PublicKey,
11815         /// The element at position 1
11816         pub b: crate::lightning::ln::wire::Type,
11817 }
11818 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
11819         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
11820                 Self {
11821                         a: tup.0,
11822                         b: tup.1,
11823                 }
11824         }
11825 }
11826 impl C2Tuple_PublicKeyTypeZ {
11827         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
11828                 (self.a, self.b)
11829         }
11830 }
11831 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
11832 #[no_mangle]
11833 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
11834         C2Tuple_PublicKeyTypeZ { a, b, }
11835 }
11836
11837 #[no_mangle]
11838 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
11839 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
11840 #[repr(C)]
11841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
11842 /// This corresponds to std::vector in C++
11843 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
11844         /// The elements in the array.
11845         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11846         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
11847         /// The number of elements pointed to by `data`.
11848         pub datalen: usize
11849 }
11850 impl CVec_C2Tuple_PublicKeyTypeZZ {
11851         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
11852                 if self.datalen == 0 { return Vec::new(); }
11853                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11854                 self.data = core::ptr::null_mut();
11855                 self.datalen = 0;
11856                 ret
11857         }
11858         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
11859                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11860         }
11861 }
11862 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
11863         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
11864                 let datalen = v.len();
11865                 let data = Box::into_raw(v.into_boxed_slice());
11866                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11867         }
11868 }
11869 #[no_mangle]
11870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11871 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
11872 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
11873         fn drop(&mut self) {
11874                 if self.datalen == 0 { return; }
11875                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11876         }
11877 }
11878 #[repr(C)]
11879 #[derive(Clone)]
11880 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
11881 pub enum COption_NetAddressZ {
11882         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
11883         Some(crate::lightning::ln::msgs::NetAddress),
11884         /// When we're in this state, this COption_NetAddressZ contains nothing
11885         None
11886 }
11887 impl COption_NetAddressZ {
11888         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11889                 if let Self::None = self { false } else { true }
11890         }
11891         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11892                 !self.is_some()
11893         }
11894         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
11895                 if let Self::Some(v) = self { v } else { unreachable!() }
11896         }
11897 }
11898 #[no_mangle]
11899 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
11900 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
11901         COption_NetAddressZ::Some(o)
11902 }
11903 #[no_mangle]
11904 /// Constructs a new COption_NetAddressZ containing nothing
11905 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
11906         COption_NetAddressZ::None
11907 }
11908 #[no_mangle]
11909 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
11910 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
11911 #[no_mangle]
11912 /// Creates a new COption_NetAddressZ which has the same data as `orig`
11913 /// but with all dynamically-allocated buffers duplicated in new buffers.
11914 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
11915 #[repr(C)]
11916 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
11917 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
11918         /// A pointer to the contents in the success state.
11919         /// Reading from this pointer when `result_ok` is not set is undefined.
11920         pub result: *mut crate::c_types::derived::CVec_u8Z,
11921         /// A pointer to the contents in the error state.
11922         /// Reading from this pointer when `result_ok` is set is undefined.
11923         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
11924 }
11925 #[repr(C)]
11926 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
11927 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
11928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11929 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
11930         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
11931         /// `err` or `result` depending on the state of `result_ok`.
11932         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
11933         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
11934         pub result_ok: bool,
11935 }
11936 #[no_mangle]
11937 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11938 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
11939         CResult_CVec_u8ZPeerHandleErrorZ {
11940                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11941                         result: Box::into_raw(Box::new(o)),
11942                 },
11943                 result_ok: true,
11944         }
11945 }
11946 #[no_mangle]
11947 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11948 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
11949         CResult_CVec_u8ZPeerHandleErrorZ {
11950                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11951                         err: Box::into_raw(Box::new(e)),
11952                 },
11953                 result_ok: false,
11954         }
11955 }
11956 /// Checks if the given object is currently in the success state
11957 #[no_mangle]
11958 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
11959         o.result_ok
11960 }
11961 #[no_mangle]
11962 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11963 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
11964 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
11965         fn drop(&mut self) {
11966                 if self.result_ok {
11967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11969                         }
11970                 } else {
11971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11973                         }
11974                 }
11975         }
11976 }
11977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
11978         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
11979                 let contents = if o.result_ok {
11980                         let result = unsafe { o.contents.result };
11981                         unsafe { o.contents.result = core::ptr::null_mut() };
11982                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
11983                 } else {
11984                         let err = unsafe { o.contents.err };
11985                         unsafe { o.contents.err = core::ptr::null_mut(); }
11986                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
11987                 };
11988                 Self {
11989                         contents,
11990                         result_ok: o.result_ok,
11991                 }
11992         }
11993 }
11994 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
11995         fn clone(&self) -> Self {
11996                 if self.result_ok {
11997                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
11998                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
11999                         } }
12000                 } else {
12001                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
12002                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12003                         } }
12004                 }
12005         }
12006 }
12007 #[no_mangle]
12008 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
12009 /// but with all dynamically-allocated buffers duplicated in new buffers.
12010 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
12011 #[repr(C)]
12012 /// The contents of CResult_NonePeerHandleErrorZ
12013 pub union CResult_NonePeerHandleErrorZPtr {
12014         /// Note that this value is always NULL, as there are no contents in the OK variant
12015         pub result: *mut core::ffi::c_void,
12016         /// A pointer to the contents in the error state.
12017         /// Reading from this pointer when `result_ok` is set is undefined.
12018         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12019 }
12020 #[repr(C)]
12021 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
12022 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12023 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12024 pub struct CResult_NonePeerHandleErrorZ {
12025         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
12026         /// `err` or `result` depending on the state of `result_ok`.
12027         pub contents: CResult_NonePeerHandleErrorZPtr,
12028         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
12029         pub result_ok: bool,
12030 }
12031 #[no_mangle]
12032 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
12033 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
12034         CResult_NonePeerHandleErrorZ {
12035                 contents: CResult_NonePeerHandleErrorZPtr {
12036                         result: core::ptr::null_mut(),
12037                 },
12038                 result_ok: true,
12039         }
12040 }
12041 #[no_mangle]
12042 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
12043 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
12044         CResult_NonePeerHandleErrorZ {
12045                 contents: CResult_NonePeerHandleErrorZPtr {
12046                         err: Box::into_raw(Box::new(e)),
12047                 },
12048                 result_ok: false,
12049         }
12050 }
12051 /// Checks if the given object is currently in the success state
12052 #[no_mangle]
12053 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
12054         o.result_ok
12055 }
12056 #[no_mangle]
12057 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
12058 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
12059 impl Drop for CResult_NonePeerHandleErrorZ {
12060         fn drop(&mut self) {
12061                 if self.result_ok {
12062                 } else {
12063                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12064                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12065                         }
12066                 }
12067         }
12068 }
12069 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
12070         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12071                 let contents = if o.result_ok {
12072                         let _ = unsafe { Box::from_raw(o.contents.result) };
12073                         o.contents.result = core::ptr::null_mut();
12074                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
12075                 } else {
12076                         let err = unsafe { o.contents.err };
12077                         unsafe { o.contents.err = core::ptr::null_mut(); }
12078                         CResult_NonePeerHandleErrorZPtr { err }
12079                 };
12080                 Self {
12081                         contents,
12082                         result_ok: o.result_ok,
12083                 }
12084         }
12085 }
12086 impl Clone for CResult_NonePeerHandleErrorZ {
12087         fn clone(&self) -> Self {
12088                 if self.result_ok {
12089                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
12090                                 result: core::ptr::null_mut()
12091                         } }
12092                 } else {
12093                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
12094                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12095                         } }
12096                 }
12097         }
12098 }
12099 #[no_mangle]
12100 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
12101 /// but with all dynamically-allocated buffers duplicated in new buffers.
12102 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
12103 #[repr(C)]
12104 /// The contents of CResult_boolPeerHandleErrorZ
12105 pub union CResult_boolPeerHandleErrorZPtr {
12106         /// A pointer to the contents in the success state.
12107         /// Reading from this pointer when `result_ok` is not set is undefined.
12108         pub result: *mut bool,
12109         /// A pointer to the contents in the error state.
12110         /// Reading from this pointer when `result_ok` is set is undefined.
12111         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
12112 }
12113 #[repr(C)]
12114 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
12115 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
12116 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12117 pub struct CResult_boolPeerHandleErrorZ {
12118         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
12119         /// `err` or `result` depending on the state of `result_ok`.
12120         pub contents: CResult_boolPeerHandleErrorZPtr,
12121         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
12122         pub result_ok: bool,
12123 }
12124 #[no_mangle]
12125 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
12126 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
12127         CResult_boolPeerHandleErrorZ {
12128                 contents: CResult_boolPeerHandleErrorZPtr {
12129                         result: Box::into_raw(Box::new(o)),
12130                 },
12131                 result_ok: true,
12132         }
12133 }
12134 #[no_mangle]
12135 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
12136 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
12137         CResult_boolPeerHandleErrorZ {
12138                 contents: CResult_boolPeerHandleErrorZPtr {
12139                         err: Box::into_raw(Box::new(e)),
12140                 },
12141                 result_ok: false,
12142         }
12143 }
12144 /// Checks if the given object is currently in the success state
12145 #[no_mangle]
12146 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
12147         o.result_ok
12148 }
12149 #[no_mangle]
12150 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
12151 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
12152 impl Drop for CResult_boolPeerHandleErrorZ {
12153         fn drop(&mut self) {
12154                 if self.result_ok {
12155                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12156                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12157                         }
12158                 } else {
12159                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12160                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12161                         }
12162                 }
12163         }
12164 }
12165 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
12166         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
12167                 let contents = if o.result_ok {
12168                         let result = unsafe { o.contents.result };
12169                         unsafe { o.contents.result = core::ptr::null_mut() };
12170                         CResult_boolPeerHandleErrorZPtr { result }
12171                 } else {
12172                         let err = unsafe { o.contents.err };
12173                         unsafe { o.contents.err = core::ptr::null_mut(); }
12174                         CResult_boolPeerHandleErrorZPtr { err }
12175                 };
12176                 Self {
12177                         contents,
12178                         result_ok: o.result_ok,
12179                 }
12180         }
12181 }
12182 impl Clone for CResult_boolPeerHandleErrorZ {
12183         fn clone(&self) -> Self {
12184                 if self.result_ok {
12185                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
12186                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
12187                         } }
12188                 } else {
12189                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
12190                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
12191                         } }
12192                 }
12193         }
12194 }
12195 #[no_mangle]
12196 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
12197 /// but with all dynamically-allocated buffers duplicated in new buffers.
12198 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
12199 #[repr(C)]
12200 /// The contents of CResult_u32GraphSyncErrorZ
12201 pub union CResult_u32GraphSyncErrorZPtr {
12202         /// A pointer to the contents in the success state.
12203         /// Reading from this pointer when `result_ok` is not set is undefined.
12204         pub result: *mut u32,
12205         /// A pointer to the contents in the error state.
12206         /// Reading from this pointer when `result_ok` is set is undefined.
12207         pub err: *mut crate::lightning_rapid_gossip_sync::error::GraphSyncError,
12208 }
12209 #[repr(C)]
12210 /// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
12211 /// containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
12212 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12213 pub struct CResult_u32GraphSyncErrorZ {
12214         /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either
12215         /// `err` or `result` depending on the state of `result_ok`.
12216         pub contents: CResult_u32GraphSyncErrorZPtr,
12217         /// Whether this CResult_u32GraphSyncErrorZ represents a success state.
12218         pub result_ok: bool,
12219 }
12220 #[no_mangle]
12221 /// Creates a new CResult_u32GraphSyncErrorZ in the success state.
12222 pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ {
12223         CResult_u32GraphSyncErrorZ {
12224                 contents: CResult_u32GraphSyncErrorZPtr {
12225                         result: Box::into_raw(Box::new(o)),
12226                 },
12227                 result_ok: true,
12228         }
12229 }
12230 #[no_mangle]
12231 /// Creates a new CResult_u32GraphSyncErrorZ in the error state.
12232 pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::error::GraphSyncError) -> CResult_u32GraphSyncErrorZ {
12233         CResult_u32GraphSyncErrorZ {
12234                 contents: CResult_u32GraphSyncErrorZPtr {
12235                         err: Box::into_raw(Box::new(e)),
12236                 },
12237                 result_ok: false,
12238         }
12239 }
12240 /// Checks if the given object is currently in the success state
12241 #[no_mangle]
12242 pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool {
12243         o.result_ok
12244 }
12245 #[no_mangle]
12246 /// Frees any resources used by the CResult_u32GraphSyncErrorZ.
12247 pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { }
12248 impl Drop for CResult_u32GraphSyncErrorZ {
12249         fn drop(&mut self) {
12250                 if self.result_ok {
12251                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12252                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12253                         }
12254                 } else {
12255                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12256                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12257                         }
12258                 }
12259         }
12260 }
12261 impl From<crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>> for CResult_u32GraphSyncErrorZ {
12262         fn from(mut o: crate::c_types::CResultTempl<u32, crate::lightning_rapid_gossip_sync::error::GraphSyncError>) -> Self {
12263                 let contents = if o.result_ok {
12264                         let result = unsafe { o.contents.result };
12265                         unsafe { o.contents.result = core::ptr::null_mut() };
12266                         CResult_u32GraphSyncErrorZPtr { result }
12267                 } else {
12268                         let err = unsafe { o.contents.err };
12269                         unsafe { o.contents.err = core::ptr::null_mut(); }
12270                         CResult_u32GraphSyncErrorZPtr { err }
12271                 };
12272                 Self {
12273                         contents,
12274                         result_ok: o.result_ok,
12275                 }
12276         }
12277 }
12278 #[repr(C)]
12279 /// The contents of CResult_NetAddressDecodeErrorZ
12280 pub union CResult_NetAddressDecodeErrorZPtr {
12281         /// A pointer to the contents in the success state.
12282         /// Reading from this pointer when `result_ok` is not set is undefined.
12283         pub result: *mut crate::lightning::ln::msgs::NetAddress,
12284         /// A pointer to the contents in the error state.
12285         /// Reading from this pointer when `result_ok` is set is undefined.
12286         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12287 }
12288 #[repr(C)]
12289 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
12290 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
12291 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12292 pub struct CResult_NetAddressDecodeErrorZ {
12293         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
12294         /// `err` or `result` depending on the state of `result_ok`.
12295         pub contents: CResult_NetAddressDecodeErrorZPtr,
12296         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
12297         pub result_ok: bool,
12298 }
12299 #[no_mangle]
12300 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
12301 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
12302         CResult_NetAddressDecodeErrorZ {
12303                 contents: CResult_NetAddressDecodeErrorZPtr {
12304                         result: Box::into_raw(Box::new(o)),
12305                 },
12306                 result_ok: true,
12307         }
12308 }
12309 #[no_mangle]
12310 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
12311 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
12312         CResult_NetAddressDecodeErrorZ {
12313                 contents: CResult_NetAddressDecodeErrorZPtr {
12314                         err: Box::into_raw(Box::new(e)),
12315                 },
12316                 result_ok: false,
12317         }
12318 }
12319 /// Checks if the given object is currently in the success state
12320 #[no_mangle]
12321 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
12322         o.result_ok
12323 }
12324 #[no_mangle]
12325 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
12326 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
12327 impl Drop for CResult_NetAddressDecodeErrorZ {
12328         fn drop(&mut self) {
12329                 if self.result_ok {
12330                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12331                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12332                         }
12333                 } else {
12334                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12335                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12336                         }
12337                 }
12338         }
12339 }
12340 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
12341         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
12342                 let contents = if o.result_ok {
12343                         let result = unsafe { o.contents.result };
12344                         unsafe { o.contents.result = core::ptr::null_mut() };
12345                         CResult_NetAddressDecodeErrorZPtr { result }
12346                 } else {
12347                         let err = unsafe { o.contents.err };
12348                         unsafe { o.contents.err = core::ptr::null_mut(); }
12349                         CResult_NetAddressDecodeErrorZPtr { err }
12350                 };
12351                 Self {
12352                         contents,
12353                         result_ok: o.result_ok,
12354                 }
12355         }
12356 }
12357 impl Clone for CResult_NetAddressDecodeErrorZ {
12358         fn clone(&self) -> Self {
12359                 if self.result_ok {
12360                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
12361                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
12362                         } }
12363                 } else {
12364                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
12365                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12366                         } }
12367                 }
12368         }
12369 }
12370 #[no_mangle]
12371 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
12372 /// but with all dynamically-allocated buffers duplicated in new buffers.
12373 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
12374 #[repr(C)]
12375 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
12376 /// This corresponds to std::vector in C++
12377 pub struct CVec_UpdateAddHTLCZ {
12378         /// The elements in the array.
12379         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12380         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
12381         /// The number of elements pointed to by `data`.
12382         pub datalen: usize
12383 }
12384 impl CVec_UpdateAddHTLCZ {
12385         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
12386                 if self.datalen == 0 { return Vec::new(); }
12387                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12388                 self.data = core::ptr::null_mut();
12389                 self.datalen = 0;
12390                 ret
12391         }
12392         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
12393                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12394         }
12395 }
12396 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
12397         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
12398                 let datalen = v.len();
12399                 let data = Box::into_raw(v.into_boxed_slice());
12400                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12401         }
12402 }
12403 #[no_mangle]
12404 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12405 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
12406 impl Drop for CVec_UpdateAddHTLCZ {
12407         fn drop(&mut self) {
12408                 if self.datalen == 0 { return; }
12409                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12410         }
12411 }
12412 impl Clone for CVec_UpdateAddHTLCZ {
12413         fn clone(&self) -> Self {
12414                 let mut res = Vec::new();
12415                 if self.datalen == 0 { return Self::from(res); }
12416                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12417                 Self::from(res)
12418         }
12419 }
12420 #[repr(C)]
12421 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
12422 /// This corresponds to std::vector in C++
12423 pub struct CVec_UpdateFulfillHTLCZ {
12424         /// The elements in the array.
12425         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12426         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
12427         /// The number of elements pointed to by `data`.
12428         pub datalen: usize
12429 }
12430 impl CVec_UpdateFulfillHTLCZ {
12431         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
12432                 if self.datalen == 0 { return Vec::new(); }
12433                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12434                 self.data = core::ptr::null_mut();
12435                 self.datalen = 0;
12436                 ret
12437         }
12438         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
12439                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12440         }
12441 }
12442 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
12443         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
12444                 let datalen = v.len();
12445                 let data = Box::into_raw(v.into_boxed_slice());
12446                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12447         }
12448 }
12449 #[no_mangle]
12450 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12451 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
12452 impl Drop for CVec_UpdateFulfillHTLCZ {
12453         fn drop(&mut self) {
12454                 if self.datalen == 0 { return; }
12455                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12456         }
12457 }
12458 impl Clone for CVec_UpdateFulfillHTLCZ {
12459         fn clone(&self) -> Self {
12460                 let mut res = Vec::new();
12461                 if self.datalen == 0 { return Self::from(res); }
12462                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12463                 Self::from(res)
12464         }
12465 }
12466 #[repr(C)]
12467 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
12468 /// This corresponds to std::vector in C++
12469 pub struct CVec_UpdateFailHTLCZ {
12470         /// The elements in the array.
12471         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12472         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
12473         /// The number of elements pointed to by `data`.
12474         pub datalen: usize
12475 }
12476 impl CVec_UpdateFailHTLCZ {
12477         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
12478                 if self.datalen == 0 { return Vec::new(); }
12479                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12480                 self.data = core::ptr::null_mut();
12481                 self.datalen = 0;
12482                 ret
12483         }
12484         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
12485                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12486         }
12487 }
12488 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
12489         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
12490                 let datalen = v.len();
12491                 let data = Box::into_raw(v.into_boxed_slice());
12492                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12493         }
12494 }
12495 #[no_mangle]
12496 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12497 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
12498 impl Drop for CVec_UpdateFailHTLCZ {
12499         fn drop(&mut self) {
12500                 if self.datalen == 0 { return; }
12501                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12502         }
12503 }
12504 impl Clone for CVec_UpdateFailHTLCZ {
12505         fn clone(&self) -> Self {
12506                 let mut res = Vec::new();
12507                 if self.datalen == 0 { return Self::from(res); }
12508                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12509                 Self::from(res)
12510         }
12511 }
12512 #[repr(C)]
12513 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
12514 /// This corresponds to std::vector in C++
12515 pub struct CVec_UpdateFailMalformedHTLCZ {
12516         /// The elements in the array.
12517         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
12518         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
12519         /// The number of elements pointed to by `data`.
12520         pub datalen: usize
12521 }
12522 impl CVec_UpdateFailMalformedHTLCZ {
12523         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
12524                 if self.datalen == 0 { return Vec::new(); }
12525                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
12526                 self.data = core::ptr::null_mut();
12527                 self.datalen = 0;
12528                 ret
12529         }
12530         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
12531                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
12532         }
12533 }
12534 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
12535         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
12536                 let datalen = v.len();
12537                 let data = Box::into_raw(v.into_boxed_slice());
12538                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
12539         }
12540 }
12541 #[no_mangle]
12542 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12543 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12544 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12545         fn drop(&mut self) {
12546                 if self.datalen == 0 { return; }
12547                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12548         }
12549 }
12550 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12551         fn clone(&self) -> Self {
12552                 let mut res = Vec::new();
12553                 if self.datalen == 0 { return Self::from(res); }
12554                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12555                 Self::from(res)
12556         }
12557 }
12558 #[repr(C)]
12559 /// The contents of CResult_AcceptChannelDecodeErrorZ
12560 pub union CResult_AcceptChannelDecodeErrorZPtr {
12561         /// A pointer to the contents in the success state.
12562         /// Reading from this pointer when `result_ok` is not set is undefined.
12563         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12564         /// A pointer to the contents in the error state.
12565         /// Reading from this pointer when `result_ok` is set is undefined.
12566         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12567 }
12568 #[repr(C)]
12569 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12570 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12571 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12572 pub struct CResult_AcceptChannelDecodeErrorZ {
12573         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12574         /// `err` or `result` depending on the state of `result_ok`.
12575         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12576         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12577         pub result_ok: bool,
12578 }
12579 #[no_mangle]
12580 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12581 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12582         CResult_AcceptChannelDecodeErrorZ {
12583                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12584                         result: Box::into_raw(Box::new(o)),
12585                 },
12586                 result_ok: true,
12587         }
12588 }
12589 #[no_mangle]
12590 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12591 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12592         CResult_AcceptChannelDecodeErrorZ {
12593                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12594                         err: Box::into_raw(Box::new(e)),
12595                 },
12596                 result_ok: false,
12597         }
12598 }
12599 /// Checks if the given object is currently in the success state
12600 #[no_mangle]
12601 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12602         o.result_ok
12603 }
12604 #[no_mangle]
12605 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12606 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12607 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12608         fn drop(&mut self) {
12609                 if self.result_ok {
12610                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12611                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12612                         }
12613                 } else {
12614                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12615                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12616                         }
12617                 }
12618         }
12619 }
12620 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12621         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12622                 let contents = if o.result_ok {
12623                         let result = unsafe { o.contents.result };
12624                         unsafe { o.contents.result = core::ptr::null_mut() };
12625                         CResult_AcceptChannelDecodeErrorZPtr { result }
12626                 } else {
12627                         let err = unsafe { o.contents.err };
12628                         unsafe { o.contents.err = core::ptr::null_mut(); }
12629                         CResult_AcceptChannelDecodeErrorZPtr { err }
12630                 };
12631                 Self {
12632                         contents,
12633                         result_ok: o.result_ok,
12634                 }
12635         }
12636 }
12637 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12638         fn clone(&self) -> Self {
12639                 if self.result_ok {
12640                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12641                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12642                         } }
12643                 } else {
12644                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12645                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12646                         } }
12647                 }
12648         }
12649 }
12650 #[no_mangle]
12651 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12652 /// but with all dynamically-allocated buffers duplicated in new buffers.
12653 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12654 #[repr(C)]
12655 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12656 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12657         /// A pointer to the contents in the success state.
12658         /// Reading from this pointer when `result_ok` is not set is undefined.
12659         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12660         /// A pointer to the contents in the error state.
12661         /// Reading from this pointer when `result_ok` is set is undefined.
12662         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12663 }
12664 #[repr(C)]
12665 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12666 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12667 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12668 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12669         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12670         /// `err` or `result` depending on the state of `result_ok`.
12671         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12672         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12673         pub result_ok: bool,
12674 }
12675 #[no_mangle]
12676 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12677 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12678         CResult_AnnouncementSignaturesDecodeErrorZ {
12679                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12680                         result: Box::into_raw(Box::new(o)),
12681                 },
12682                 result_ok: true,
12683         }
12684 }
12685 #[no_mangle]
12686 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12687 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12688         CResult_AnnouncementSignaturesDecodeErrorZ {
12689                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12690                         err: Box::into_raw(Box::new(e)),
12691                 },
12692                 result_ok: false,
12693         }
12694 }
12695 /// Checks if the given object is currently in the success state
12696 #[no_mangle]
12697 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12698         o.result_ok
12699 }
12700 #[no_mangle]
12701 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12702 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12703 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12704         fn drop(&mut self) {
12705                 if self.result_ok {
12706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12708                         }
12709                 } else {
12710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12712                         }
12713                 }
12714         }
12715 }
12716 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12717         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12718                 let contents = if o.result_ok {
12719                         let result = unsafe { o.contents.result };
12720                         unsafe { o.contents.result = core::ptr::null_mut() };
12721                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12722                 } else {
12723                         let err = unsafe { o.contents.err };
12724                         unsafe { o.contents.err = core::ptr::null_mut(); }
12725                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12726                 };
12727                 Self {
12728                         contents,
12729                         result_ok: o.result_ok,
12730                 }
12731         }
12732 }
12733 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12734         fn clone(&self) -> Self {
12735                 if self.result_ok {
12736                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12737                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12738                         } }
12739                 } else {
12740                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12741                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12742                         } }
12743                 }
12744         }
12745 }
12746 #[no_mangle]
12747 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12748 /// but with all dynamically-allocated buffers duplicated in new buffers.
12749 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12750 #[repr(C)]
12751 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12752 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12753         /// A pointer to the contents in the success state.
12754         /// Reading from this pointer when `result_ok` is not set is undefined.
12755         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12756         /// A pointer to the contents in the error state.
12757         /// Reading from this pointer when `result_ok` is set is undefined.
12758         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12759 }
12760 #[repr(C)]
12761 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12762 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12763 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12764 pub struct CResult_ChannelReestablishDecodeErrorZ {
12765         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12766         /// `err` or `result` depending on the state of `result_ok`.
12767         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12768         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12769         pub result_ok: bool,
12770 }
12771 #[no_mangle]
12772 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12773 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12774         CResult_ChannelReestablishDecodeErrorZ {
12775                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12776                         result: Box::into_raw(Box::new(o)),
12777                 },
12778                 result_ok: true,
12779         }
12780 }
12781 #[no_mangle]
12782 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12783 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12784         CResult_ChannelReestablishDecodeErrorZ {
12785                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12786                         err: Box::into_raw(Box::new(e)),
12787                 },
12788                 result_ok: false,
12789         }
12790 }
12791 /// Checks if the given object is currently in the success state
12792 #[no_mangle]
12793 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12794         o.result_ok
12795 }
12796 #[no_mangle]
12797 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12798 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12799 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12800         fn drop(&mut self) {
12801                 if self.result_ok {
12802                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12803                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12804                         }
12805                 } else {
12806                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12807                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12808                         }
12809                 }
12810         }
12811 }
12812 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12813         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12814                 let contents = if o.result_ok {
12815                         let result = unsafe { o.contents.result };
12816                         unsafe { o.contents.result = core::ptr::null_mut() };
12817                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12818                 } else {
12819                         let err = unsafe { o.contents.err };
12820                         unsafe { o.contents.err = core::ptr::null_mut(); }
12821                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12822                 };
12823                 Self {
12824                         contents,
12825                         result_ok: o.result_ok,
12826                 }
12827         }
12828 }
12829 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12830         fn clone(&self) -> Self {
12831                 if self.result_ok {
12832                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12833                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12834                         } }
12835                 } else {
12836                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12837                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12838                         } }
12839                 }
12840         }
12841 }
12842 #[no_mangle]
12843 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12844 /// but with all dynamically-allocated buffers duplicated in new buffers.
12845 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12846 #[repr(C)]
12847 /// The contents of CResult_ClosingSignedDecodeErrorZ
12848 pub union CResult_ClosingSignedDecodeErrorZPtr {
12849         /// A pointer to the contents in the success state.
12850         /// Reading from this pointer when `result_ok` is not set is undefined.
12851         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12852         /// A pointer to the contents in the error state.
12853         /// Reading from this pointer when `result_ok` is set is undefined.
12854         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12855 }
12856 #[repr(C)]
12857 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12858 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12859 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12860 pub struct CResult_ClosingSignedDecodeErrorZ {
12861         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12862         /// `err` or `result` depending on the state of `result_ok`.
12863         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12864         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12865         pub result_ok: bool,
12866 }
12867 #[no_mangle]
12868 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12869 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12870         CResult_ClosingSignedDecodeErrorZ {
12871                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12872                         result: Box::into_raw(Box::new(o)),
12873                 },
12874                 result_ok: true,
12875         }
12876 }
12877 #[no_mangle]
12878 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12879 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12880         CResult_ClosingSignedDecodeErrorZ {
12881                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12882                         err: Box::into_raw(Box::new(e)),
12883                 },
12884                 result_ok: false,
12885         }
12886 }
12887 /// Checks if the given object is currently in the success state
12888 #[no_mangle]
12889 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12890         o.result_ok
12891 }
12892 #[no_mangle]
12893 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12894 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12895 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12896         fn drop(&mut self) {
12897                 if self.result_ok {
12898                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12899                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12900                         }
12901                 } else {
12902                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12903                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12904                         }
12905                 }
12906         }
12907 }
12908 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12909         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12910                 let contents = if o.result_ok {
12911                         let result = unsafe { o.contents.result };
12912                         unsafe { o.contents.result = core::ptr::null_mut() };
12913                         CResult_ClosingSignedDecodeErrorZPtr { result }
12914                 } else {
12915                         let err = unsafe { o.contents.err };
12916                         unsafe { o.contents.err = core::ptr::null_mut(); }
12917                         CResult_ClosingSignedDecodeErrorZPtr { err }
12918                 };
12919                 Self {
12920                         contents,
12921                         result_ok: o.result_ok,
12922                 }
12923         }
12924 }
12925 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12926         fn clone(&self) -> Self {
12927                 if self.result_ok {
12928                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12929                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12930                         } }
12931                 } else {
12932                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12933                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12934                         } }
12935                 }
12936         }
12937 }
12938 #[no_mangle]
12939 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12940 /// but with all dynamically-allocated buffers duplicated in new buffers.
12941 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12942 #[repr(C)]
12943 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12944 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12945         /// A pointer to the contents in the success state.
12946         /// Reading from this pointer when `result_ok` is not set is undefined.
12947         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12948         /// A pointer to the contents in the error state.
12949         /// Reading from this pointer when `result_ok` is set is undefined.
12950         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12951 }
12952 #[repr(C)]
12953 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12954 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12956 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12957         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12958         /// `err` or `result` depending on the state of `result_ok`.
12959         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12960         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12961         pub result_ok: bool,
12962 }
12963 #[no_mangle]
12964 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12965 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12966         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12967                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12968                         result: Box::into_raw(Box::new(o)),
12969                 },
12970                 result_ok: true,
12971         }
12972 }
12973 #[no_mangle]
12974 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12975 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12976         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12977                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12978                         err: Box::into_raw(Box::new(e)),
12979                 },
12980                 result_ok: false,
12981         }
12982 }
12983 /// Checks if the given object is currently in the success state
12984 #[no_mangle]
12985 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12986         o.result_ok
12987 }
12988 #[no_mangle]
12989 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12990 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12991 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12992         fn drop(&mut self) {
12993                 if self.result_ok {
12994                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12995                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12996                         }
12997                 } else {
12998                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12999                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13000                         }
13001                 }
13002         }
13003 }
13004 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13005         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
13006                 let contents = if o.result_ok {
13007                         let result = unsafe { o.contents.result };
13008                         unsafe { o.contents.result = core::ptr::null_mut() };
13009                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
13010                 } else {
13011                         let err = unsafe { o.contents.err };
13012                         unsafe { o.contents.err = core::ptr::null_mut(); }
13013                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
13014                 };
13015                 Self {
13016                         contents,
13017                         result_ok: o.result_ok,
13018                 }
13019         }
13020 }
13021 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
13022         fn clone(&self) -> Self {
13023                 if self.result_ok {
13024                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13025                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
13026                         } }
13027                 } else {
13028                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
13029                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13030                         } }
13031                 }
13032         }
13033 }
13034 #[no_mangle]
13035 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
13036 /// but with all dynamically-allocated buffers duplicated in new buffers.
13037 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
13038 #[repr(C)]
13039 /// The contents of CResult_CommitmentSignedDecodeErrorZ
13040 pub union CResult_CommitmentSignedDecodeErrorZPtr {
13041         /// A pointer to the contents in the success state.
13042         /// Reading from this pointer when `result_ok` is not set is undefined.
13043         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
13044         /// A pointer to the contents in the error state.
13045         /// Reading from this pointer when `result_ok` is set is undefined.
13046         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13047 }
13048 #[repr(C)]
13049 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
13050 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13051 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13052 pub struct CResult_CommitmentSignedDecodeErrorZ {
13053         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
13054         /// `err` or `result` depending on the state of `result_ok`.
13055         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
13056         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
13057         pub result_ok: bool,
13058 }
13059 #[no_mangle]
13060 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
13061 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
13062         CResult_CommitmentSignedDecodeErrorZ {
13063                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13064                         result: Box::into_raw(Box::new(o)),
13065                 },
13066                 result_ok: true,
13067         }
13068 }
13069 #[no_mangle]
13070 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
13071 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
13072         CResult_CommitmentSignedDecodeErrorZ {
13073                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
13074                         err: Box::into_raw(Box::new(e)),
13075                 },
13076                 result_ok: false,
13077         }
13078 }
13079 /// Checks if the given object is currently in the success state
13080 #[no_mangle]
13081 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
13082         o.result_ok
13083 }
13084 #[no_mangle]
13085 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
13086 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
13087 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
13088         fn drop(&mut self) {
13089                 if self.result_ok {
13090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13092                         }
13093                 } else {
13094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13096                         }
13097                 }
13098         }
13099 }
13100 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
13101         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13102                 let contents = if o.result_ok {
13103                         let result = unsafe { o.contents.result };
13104                         unsafe { o.contents.result = core::ptr::null_mut() };
13105                         CResult_CommitmentSignedDecodeErrorZPtr { result }
13106                 } else {
13107                         let err = unsafe { o.contents.err };
13108                         unsafe { o.contents.err = core::ptr::null_mut(); }
13109                         CResult_CommitmentSignedDecodeErrorZPtr { err }
13110                 };
13111                 Self {
13112                         contents,
13113                         result_ok: o.result_ok,
13114                 }
13115         }
13116 }
13117 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
13118         fn clone(&self) -> Self {
13119                 if self.result_ok {
13120                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13121                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
13122                         } }
13123                 } else {
13124                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
13125                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13126                         } }
13127                 }
13128         }
13129 }
13130 #[no_mangle]
13131 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
13132 /// but with all dynamically-allocated buffers duplicated in new buffers.
13133 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
13134 #[repr(C)]
13135 /// The contents of CResult_FundingCreatedDecodeErrorZ
13136 pub union CResult_FundingCreatedDecodeErrorZPtr {
13137         /// A pointer to the contents in the success state.
13138         /// Reading from this pointer when `result_ok` is not set is undefined.
13139         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
13140         /// A pointer to the contents in the error state.
13141         /// Reading from this pointer when `result_ok` is set is undefined.
13142         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13143 }
13144 #[repr(C)]
13145 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
13146 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
13147 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13148 pub struct CResult_FundingCreatedDecodeErrorZ {
13149         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
13150         /// `err` or `result` depending on the state of `result_ok`.
13151         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
13152         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
13153         pub result_ok: bool,
13154 }
13155 #[no_mangle]
13156 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
13157 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
13158         CResult_FundingCreatedDecodeErrorZ {
13159                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13160                         result: Box::into_raw(Box::new(o)),
13161                 },
13162                 result_ok: true,
13163         }
13164 }
13165 #[no_mangle]
13166 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
13167 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
13168         CResult_FundingCreatedDecodeErrorZ {
13169                 contents: CResult_FundingCreatedDecodeErrorZPtr {
13170                         err: Box::into_raw(Box::new(e)),
13171                 },
13172                 result_ok: false,
13173         }
13174 }
13175 /// Checks if the given object is currently in the success state
13176 #[no_mangle]
13177 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
13178         o.result_ok
13179 }
13180 #[no_mangle]
13181 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
13182 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
13183 impl Drop for CResult_FundingCreatedDecodeErrorZ {
13184         fn drop(&mut self) {
13185                 if self.result_ok {
13186                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13187                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13188                         }
13189                 } else {
13190                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13191                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13192                         }
13193                 }
13194         }
13195 }
13196 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
13197         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
13198                 let contents = if o.result_ok {
13199                         let result = unsafe { o.contents.result };
13200                         unsafe { o.contents.result = core::ptr::null_mut() };
13201                         CResult_FundingCreatedDecodeErrorZPtr { result }
13202                 } else {
13203                         let err = unsafe { o.contents.err };
13204                         unsafe { o.contents.err = core::ptr::null_mut(); }
13205                         CResult_FundingCreatedDecodeErrorZPtr { err }
13206                 };
13207                 Self {
13208                         contents,
13209                         result_ok: o.result_ok,
13210                 }
13211         }
13212 }
13213 impl Clone for CResult_FundingCreatedDecodeErrorZ {
13214         fn clone(&self) -> Self {
13215                 if self.result_ok {
13216                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
13217                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
13218                         } }
13219                 } else {
13220                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
13221                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13222                         } }
13223                 }
13224         }
13225 }
13226 #[no_mangle]
13227 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
13228 /// but with all dynamically-allocated buffers duplicated in new buffers.
13229 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
13230 #[repr(C)]
13231 /// The contents of CResult_FundingSignedDecodeErrorZ
13232 pub union CResult_FundingSignedDecodeErrorZPtr {
13233         /// A pointer to the contents in the success state.
13234         /// Reading from this pointer when `result_ok` is not set is undefined.
13235         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
13236         /// A pointer to the contents in the error state.
13237         /// Reading from this pointer when `result_ok` is set is undefined.
13238         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13239 }
13240 #[repr(C)]
13241 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
13242 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
13243 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13244 pub struct CResult_FundingSignedDecodeErrorZ {
13245         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
13246         /// `err` or `result` depending on the state of `result_ok`.
13247         pub contents: CResult_FundingSignedDecodeErrorZPtr,
13248         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
13249         pub result_ok: bool,
13250 }
13251 #[no_mangle]
13252 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
13253 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
13254         CResult_FundingSignedDecodeErrorZ {
13255                 contents: CResult_FundingSignedDecodeErrorZPtr {
13256                         result: Box::into_raw(Box::new(o)),
13257                 },
13258                 result_ok: true,
13259         }
13260 }
13261 #[no_mangle]
13262 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
13263 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
13264         CResult_FundingSignedDecodeErrorZ {
13265                 contents: CResult_FundingSignedDecodeErrorZPtr {
13266                         err: Box::into_raw(Box::new(e)),
13267                 },
13268                 result_ok: false,
13269         }
13270 }
13271 /// Checks if the given object is currently in the success state
13272 #[no_mangle]
13273 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
13274         o.result_ok
13275 }
13276 #[no_mangle]
13277 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
13278 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
13279 impl Drop for CResult_FundingSignedDecodeErrorZ {
13280         fn drop(&mut self) {
13281                 if self.result_ok {
13282                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13283                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13284                         }
13285                 } else {
13286                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13287                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13288                         }
13289                 }
13290         }
13291 }
13292 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
13293         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
13294                 let contents = if o.result_ok {
13295                         let result = unsafe { o.contents.result };
13296                         unsafe { o.contents.result = core::ptr::null_mut() };
13297                         CResult_FundingSignedDecodeErrorZPtr { result }
13298                 } else {
13299                         let err = unsafe { o.contents.err };
13300                         unsafe { o.contents.err = core::ptr::null_mut(); }
13301                         CResult_FundingSignedDecodeErrorZPtr { err }
13302                 };
13303                 Self {
13304                         contents,
13305                         result_ok: o.result_ok,
13306                 }
13307         }
13308 }
13309 impl Clone for CResult_FundingSignedDecodeErrorZ {
13310         fn clone(&self) -> Self {
13311                 if self.result_ok {
13312                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
13313                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
13314                         } }
13315                 } else {
13316                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
13317                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13318                         } }
13319                 }
13320         }
13321 }
13322 #[no_mangle]
13323 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
13324 /// but with all dynamically-allocated buffers duplicated in new buffers.
13325 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
13326 #[repr(C)]
13327 /// The contents of CResult_ChannelReadyDecodeErrorZ
13328 pub union CResult_ChannelReadyDecodeErrorZPtr {
13329         /// A pointer to the contents in the success state.
13330         /// Reading from this pointer when `result_ok` is not set is undefined.
13331         pub result: *mut crate::lightning::ln::msgs::ChannelReady,
13332         /// A pointer to the contents in the error state.
13333         /// Reading from this pointer when `result_ok` is set is undefined.
13334         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13335 }
13336 #[repr(C)]
13337 /// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
13338 /// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
13339 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13340 pub struct CResult_ChannelReadyDecodeErrorZ {
13341         /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
13342         /// `err` or `result` depending on the state of `result_ok`.
13343         pub contents: CResult_ChannelReadyDecodeErrorZPtr,
13344         /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
13345         pub result_ok: bool,
13346 }
13347 #[no_mangle]
13348 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
13349 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ {
13350         CResult_ChannelReadyDecodeErrorZ {
13351                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13352                         result: Box::into_raw(Box::new(o)),
13353                 },
13354                 result_ok: true,
13355         }
13356 }
13357 #[no_mangle]
13358 /// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
13359 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ {
13360         CResult_ChannelReadyDecodeErrorZ {
13361                 contents: CResult_ChannelReadyDecodeErrorZPtr {
13362                         err: Box::into_raw(Box::new(e)),
13363                 },
13364                 result_ok: false,
13365         }
13366 }
13367 /// Checks if the given object is currently in the success state
13368 #[no_mangle]
13369 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool {
13370         o.result_ok
13371 }
13372 #[no_mangle]
13373 /// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
13374 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { }
13375 impl Drop for CResult_ChannelReadyDecodeErrorZ {
13376         fn drop(&mut self) {
13377                 if self.result_ok {
13378                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13379                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13380                         }
13381                 } else {
13382                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13383                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13384                         }
13385                 }
13386         }
13387 }
13388 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReadyDecodeErrorZ {
13389         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReady, crate::lightning::ln::msgs::DecodeError>) -> Self {
13390                 let contents = if o.result_ok {
13391                         let result = unsafe { o.contents.result };
13392                         unsafe { o.contents.result = core::ptr::null_mut() };
13393                         CResult_ChannelReadyDecodeErrorZPtr { result }
13394                 } else {
13395                         let err = unsafe { o.contents.err };
13396                         unsafe { o.contents.err = core::ptr::null_mut(); }
13397                         CResult_ChannelReadyDecodeErrorZPtr { err }
13398                 };
13399                 Self {
13400                         contents,
13401                         result_ok: o.result_ok,
13402                 }
13403         }
13404 }
13405 impl Clone for CResult_ChannelReadyDecodeErrorZ {
13406         fn clone(&self) -> Self {
13407                 if self.result_ok {
13408                         Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr {
13409                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReady>::clone(unsafe { &*self.contents.result })))
13410                         } }
13411                 } else {
13412                         Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr {
13413                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13414                         } }
13415                 }
13416         }
13417 }
13418 #[no_mangle]
13419 /// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
13420 /// but with all dynamically-allocated buffers duplicated in new buffers.
13421 pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) }
13422 #[repr(C)]
13423 /// The contents of CResult_InitDecodeErrorZ
13424 pub union CResult_InitDecodeErrorZPtr {
13425         /// A pointer to the contents in the success state.
13426         /// Reading from this pointer when `result_ok` is not set is undefined.
13427         pub result: *mut crate::lightning::ln::msgs::Init,
13428         /// A pointer to the contents in the error state.
13429         /// Reading from this pointer when `result_ok` is set is undefined.
13430         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13431 }
13432 #[repr(C)]
13433 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
13434 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
13435 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13436 pub struct CResult_InitDecodeErrorZ {
13437         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
13438         /// `err` or `result` depending on the state of `result_ok`.
13439         pub contents: CResult_InitDecodeErrorZPtr,
13440         /// Whether this CResult_InitDecodeErrorZ represents a success state.
13441         pub result_ok: bool,
13442 }
13443 #[no_mangle]
13444 /// Creates a new CResult_InitDecodeErrorZ in the success state.
13445 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
13446         CResult_InitDecodeErrorZ {
13447                 contents: CResult_InitDecodeErrorZPtr {
13448                         result: Box::into_raw(Box::new(o)),
13449                 },
13450                 result_ok: true,
13451         }
13452 }
13453 #[no_mangle]
13454 /// Creates a new CResult_InitDecodeErrorZ in the error state.
13455 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
13456         CResult_InitDecodeErrorZ {
13457                 contents: CResult_InitDecodeErrorZPtr {
13458                         err: Box::into_raw(Box::new(e)),
13459                 },
13460                 result_ok: false,
13461         }
13462 }
13463 /// Checks if the given object is currently in the success state
13464 #[no_mangle]
13465 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
13466         o.result_ok
13467 }
13468 #[no_mangle]
13469 /// Frees any resources used by the CResult_InitDecodeErrorZ.
13470 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
13471 impl Drop for CResult_InitDecodeErrorZ {
13472         fn drop(&mut self) {
13473                 if self.result_ok {
13474                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13475                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13476                         }
13477                 } else {
13478                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13479                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13480                         }
13481                 }
13482         }
13483 }
13484 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
13485         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
13486                 let contents = if o.result_ok {
13487                         let result = unsafe { o.contents.result };
13488                         unsafe { o.contents.result = core::ptr::null_mut() };
13489                         CResult_InitDecodeErrorZPtr { result }
13490                 } else {
13491                         let err = unsafe { o.contents.err };
13492                         unsafe { o.contents.err = core::ptr::null_mut(); }
13493                         CResult_InitDecodeErrorZPtr { err }
13494                 };
13495                 Self {
13496                         contents,
13497                         result_ok: o.result_ok,
13498                 }
13499         }
13500 }
13501 impl Clone for CResult_InitDecodeErrorZ {
13502         fn clone(&self) -> Self {
13503                 if self.result_ok {
13504                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
13505                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
13506                         } }
13507                 } else {
13508                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
13509                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13510                         } }
13511                 }
13512         }
13513 }
13514 #[no_mangle]
13515 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
13516 /// but with all dynamically-allocated buffers duplicated in new buffers.
13517 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
13518 #[repr(C)]
13519 /// The contents of CResult_OpenChannelDecodeErrorZ
13520 pub union CResult_OpenChannelDecodeErrorZPtr {
13521         /// A pointer to the contents in the success state.
13522         /// Reading from this pointer when `result_ok` is not set is undefined.
13523         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
13524         /// A pointer to the contents in the error state.
13525         /// Reading from this pointer when `result_ok` is set is undefined.
13526         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13527 }
13528 #[repr(C)]
13529 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
13530 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
13531 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13532 pub struct CResult_OpenChannelDecodeErrorZ {
13533         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
13534         /// `err` or `result` depending on the state of `result_ok`.
13535         pub contents: CResult_OpenChannelDecodeErrorZPtr,
13536         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
13537         pub result_ok: bool,
13538 }
13539 #[no_mangle]
13540 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13541 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13542         CResult_OpenChannelDecodeErrorZ {
13543                 contents: CResult_OpenChannelDecodeErrorZPtr {
13544                         result: Box::into_raw(Box::new(o)),
13545                 },
13546                 result_ok: true,
13547         }
13548 }
13549 #[no_mangle]
13550 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13551 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13552         CResult_OpenChannelDecodeErrorZ {
13553                 contents: CResult_OpenChannelDecodeErrorZPtr {
13554                         err: Box::into_raw(Box::new(e)),
13555                 },
13556                 result_ok: false,
13557         }
13558 }
13559 /// Checks if the given object is currently in the success state
13560 #[no_mangle]
13561 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13562         o.result_ok
13563 }
13564 #[no_mangle]
13565 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13566 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13567 impl Drop for CResult_OpenChannelDecodeErrorZ {
13568         fn drop(&mut self) {
13569                 if self.result_ok {
13570                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13571                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13572                         }
13573                 } else {
13574                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13575                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13576                         }
13577                 }
13578         }
13579 }
13580 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13581         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13582                 let contents = if o.result_ok {
13583                         let result = unsafe { o.contents.result };
13584                         unsafe { o.contents.result = core::ptr::null_mut() };
13585                         CResult_OpenChannelDecodeErrorZPtr { result }
13586                 } else {
13587                         let err = unsafe { o.contents.err };
13588                         unsafe { o.contents.err = core::ptr::null_mut(); }
13589                         CResult_OpenChannelDecodeErrorZPtr { err }
13590                 };
13591                 Self {
13592                         contents,
13593                         result_ok: o.result_ok,
13594                 }
13595         }
13596 }
13597 impl Clone for CResult_OpenChannelDecodeErrorZ {
13598         fn clone(&self) -> Self {
13599                 if self.result_ok {
13600                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13601                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13602                         } }
13603                 } else {
13604                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13605                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13606                         } }
13607                 }
13608         }
13609 }
13610 #[no_mangle]
13611 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13612 /// but with all dynamically-allocated buffers duplicated in new buffers.
13613 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13614 #[repr(C)]
13615 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13616 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13617         /// A pointer to the contents in the success state.
13618         /// Reading from this pointer when `result_ok` is not set is undefined.
13619         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13620         /// A pointer to the contents in the error state.
13621         /// Reading from this pointer when `result_ok` is set is undefined.
13622         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13623 }
13624 #[repr(C)]
13625 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13626 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13627 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13628 pub struct CResult_RevokeAndACKDecodeErrorZ {
13629         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13630         /// `err` or `result` depending on the state of `result_ok`.
13631         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13632         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13633         pub result_ok: bool,
13634 }
13635 #[no_mangle]
13636 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13637 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13638         CResult_RevokeAndACKDecodeErrorZ {
13639                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13640                         result: Box::into_raw(Box::new(o)),
13641                 },
13642                 result_ok: true,
13643         }
13644 }
13645 #[no_mangle]
13646 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13647 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13648         CResult_RevokeAndACKDecodeErrorZ {
13649                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13650                         err: Box::into_raw(Box::new(e)),
13651                 },
13652                 result_ok: false,
13653         }
13654 }
13655 /// Checks if the given object is currently in the success state
13656 #[no_mangle]
13657 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13658         o.result_ok
13659 }
13660 #[no_mangle]
13661 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13662 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13663 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13664         fn drop(&mut self) {
13665                 if self.result_ok {
13666                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13667                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13668                         }
13669                 } else {
13670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13672                         }
13673                 }
13674         }
13675 }
13676 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13677         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13678                 let contents = if o.result_ok {
13679                         let result = unsafe { o.contents.result };
13680                         unsafe { o.contents.result = core::ptr::null_mut() };
13681                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13682                 } else {
13683                         let err = unsafe { o.contents.err };
13684                         unsafe { o.contents.err = core::ptr::null_mut(); }
13685                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13686                 };
13687                 Self {
13688                         contents,
13689                         result_ok: o.result_ok,
13690                 }
13691         }
13692 }
13693 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13694         fn clone(&self) -> Self {
13695                 if self.result_ok {
13696                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13697                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13698                         } }
13699                 } else {
13700                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13701                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13702                         } }
13703                 }
13704         }
13705 }
13706 #[no_mangle]
13707 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13708 /// but with all dynamically-allocated buffers duplicated in new buffers.
13709 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13710 #[repr(C)]
13711 /// The contents of CResult_ShutdownDecodeErrorZ
13712 pub union CResult_ShutdownDecodeErrorZPtr {
13713         /// A pointer to the contents in the success state.
13714         /// Reading from this pointer when `result_ok` is not set is undefined.
13715         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13716         /// A pointer to the contents in the error state.
13717         /// Reading from this pointer when `result_ok` is set is undefined.
13718         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13719 }
13720 #[repr(C)]
13721 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13722 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13724 pub struct CResult_ShutdownDecodeErrorZ {
13725         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13726         /// `err` or `result` depending on the state of `result_ok`.
13727         pub contents: CResult_ShutdownDecodeErrorZPtr,
13728         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13729         pub result_ok: bool,
13730 }
13731 #[no_mangle]
13732 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13733 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13734         CResult_ShutdownDecodeErrorZ {
13735                 contents: CResult_ShutdownDecodeErrorZPtr {
13736                         result: Box::into_raw(Box::new(o)),
13737                 },
13738                 result_ok: true,
13739         }
13740 }
13741 #[no_mangle]
13742 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13743 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13744         CResult_ShutdownDecodeErrorZ {
13745                 contents: CResult_ShutdownDecodeErrorZPtr {
13746                         err: Box::into_raw(Box::new(e)),
13747                 },
13748                 result_ok: false,
13749         }
13750 }
13751 /// Checks if the given object is currently in the success state
13752 #[no_mangle]
13753 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13754         o.result_ok
13755 }
13756 #[no_mangle]
13757 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13758 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13759 impl Drop for CResult_ShutdownDecodeErrorZ {
13760         fn drop(&mut self) {
13761                 if self.result_ok {
13762                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13763                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13764                         }
13765                 } else {
13766                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13767                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13768                         }
13769                 }
13770         }
13771 }
13772 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13773         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13774                 let contents = if o.result_ok {
13775                         let result = unsafe { o.contents.result };
13776                         unsafe { o.contents.result = core::ptr::null_mut() };
13777                         CResult_ShutdownDecodeErrorZPtr { result }
13778                 } else {
13779                         let err = unsafe { o.contents.err };
13780                         unsafe { o.contents.err = core::ptr::null_mut(); }
13781                         CResult_ShutdownDecodeErrorZPtr { err }
13782                 };
13783                 Self {
13784                         contents,
13785                         result_ok: o.result_ok,
13786                 }
13787         }
13788 }
13789 impl Clone for CResult_ShutdownDecodeErrorZ {
13790         fn clone(&self) -> Self {
13791                 if self.result_ok {
13792                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13793                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13794                         } }
13795                 } else {
13796                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13797                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13798                         } }
13799                 }
13800         }
13801 }
13802 #[no_mangle]
13803 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13804 /// but with all dynamically-allocated buffers duplicated in new buffers.
13805 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13806 #[repr(C)]
13807 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13808 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13809         /// A pointer to the contents in the success state.
13810         /// Reading from this pointer when `result_ok` is not set is undefined.
13811         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13812         /// A pointer to the contents in the error state.
13813         /// Reading from this pointer when `result_ok` is set is undefined.
13814         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13815 }
13816 #[repr(C)]
13817 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13818 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13820 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13821         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13822         /// `err` or `result` depending on the state of `result_ok`.
13823         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13824         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13825         pub result_ok: bool,
13826 }
13827 #[no_mangle]
13828 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13829 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13830         CResult_UpdateFailHTLCDecodeErrorZ {
13831                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13832                         result: Box::into_raw(Box::new(o)),
13833                 },
13834                 result_ok: true,
13835         }
13836 }
13837 #[no_mangle]
13838 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13839 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13840         CResult_UpdateFailHTLCDecodeErrorZ {
13841                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13842                         err: Box::into_raw(Box::new(e)),
13843                 },
13844                 result_ok: false,
13845         }
13846 }
13847 /// Checks if the given object is currently in the success state
13848 #[no_mangle]
13849 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13850         o.result_ok
13851 }
13852 #[no_mangle]
13853 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13854 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13855 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13856         fn drop(&mut self) {
13857                 if self.result_ok {
13858                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13859                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13860                         }
13861                 } else {
13862                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13863                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13864                         }
13865                 }
13866         }
13867 }
13868 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13869         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13870                 let contents = if o.result_ok {
13871                         let result = unsafe { o.contents.result };
13872                         unsafe { o.contents.result = core::ptr::null_mut() };
13873                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13874                 } else {
13875                         let err = unsafe { o.contents.err };
13876                         unsafe { o.contents.err = core::ptr::null_mut(); }
13877                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13878                 };
13879                 Self {
13880                         contents,
13881                         result_ok: o.result_ok,
13882                 }
13883         }
13884 }
13885 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13886         fn clone(&self) -> Self {
13887                 if self.result_ok {
13888                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13889                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13890                         } }
13891                 } else {
13892                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13893                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13894                         } }
13895                 }
13896         }
13897 }
13898 #[no_mangle]
13899 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13900 /// but with all dynamically-allocated buffers duplicated in new buffers.
13901 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13902 #[repr(C)]
13903 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13904 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13905         /// A pointer to the contents in the success state.
13906         /// Reading from this pointer when `result_ok` is not set is undefined.
13907         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13908         /// A pointer to the contents in the error state.
13909         /// Reading from this pointer when `result_ok` is set is undefined.
13910         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13911 }
13912 #[repr(C)]
13913 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13914 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13916 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13917         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13918         /// `err` or `result` depending on the state of `result_ok`.
13919         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13920         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13921         pub result_ok: bool,
13922 }
13923 #[no_mangle]
13924 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13925 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13926         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13927                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13928                         result: Box::into_raw(Box::new(o)),
13929                 },
13930                 result_ok: true,
13931         }
13932 }
13933 #[no_mangle]
13934 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13935 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13936         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13937                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13938                         err: Box::into_raw(Box::new(e)),
13939                 },
13940                 result_ok: false,
13941         }
13942 }
13943 /// Checks if the given object is currently in the success state
13944 #[no_mangle]
13945 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13946         o.result_ok
13947 }
13948 #[no_mangle]
13949 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13950 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13951 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13952         fn drop(&mut self) {
13953                 if self.result_ok {
13954                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13955                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13956                         }
13957                 } else {
13958                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13959                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13960                         }
13961                 }
13962         }
13963 }
13964 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13965         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13966                 let contents = if o.result_ok {
13967                         let result = unsafe { o.contents.result };
13968                         unsafe { o.contents.result = core::ptr::null_mut() };
13969                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13970                 } else {
13971                         let err = unsafe { o.contents.err };
13972                         unsafe { o.contents.err = core::ptr::null_mut(); }
13973                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13974                 };
13975                 Self {
13976                         contents,
13977                         result_ok: o.result_ok,
13978                 }
13979         }
13980 }
13981 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13982         fn clone(&self) -> Self {
13983                 if self.result_ok {
13984                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13985                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13986                         } }
13987                 } else {
13988                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13989                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13990                         } }
13991                 }
13992         }
13993 }
13994 #[no_mangle]
13995 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13996 /// but with all dynamically-allocated buffers duplicated in new buffers.
13997 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13998 #[repr(C)]
13999 /// The contents of CResult_UpdateFeeDecodeErrorZ
14000 pub union CResult_UpdateFeeDecodeErrorZPtr {
14001         /// A pointer to the contents in the success state.
14002         /// Reading from this pointer when `result_ok` is not set is undefined.
14003         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
14004         /// A pointer to the contents in the error state.
14005         /// Reading from this pointer when `result_ok` is set is undefined.
14006         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14007 }
14008 #[repr(C)]
14009 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
14010 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
14011 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14012 pub struct CResult_UpdateFeeDecodeErrorZ {
14013         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
14014         /// `err` or `result` depending on the state of `result_ok`.
14015         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
14016         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
14017         pub result_ok: bool,
14018 }
14019 #[no_mangle]
14020 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
14021 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
14022         CResult_UpdateFeeDecodeErrorZ {
14023                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14024                         result: Box::into_raw(Box::new(o)),
14025                 },
14026                 result_ok: true,
14027         }
14028 }
14029 #[no_mangle]
14030 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
14031 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
14032         CResult_UpdateFeeDecodeErrorZ {
14033                 contents: CResult_UpdateFeeDecodeErrorZPtr {
14034                         err: Box::into_raw(Box::new(e)),
14035                 },
14036                 result_ok: false,
14037         }
14038 }
14039 /// Checks if the given object is currently in the success state
14040 #[no_mangle]
14041 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
14042         o.result_ok
14043 }
14044 #[no_mangle]
14045 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
14046 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
14047 impl Drop for CResult_UpdateFeeDecodeErrorZ {
14048         fn drop(&mut self) {
14049                 if self.result_ok {
14050                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14051                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14052                         }
14053                 } else {
14054                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14055                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14056                         }
14057                 }
14058         }
14059 }
14060 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
14061         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
14062                 let contents = if o.result_ok {
14063                         let result = unsafe { o.contents.result };
14064                         unsafe { o.contents.result = core::ptr::null_mut() };
14065                         CResult_UpdateFeeDecodeErrorZPtr { result }
14066                 } else {
14067                         let err = unsafe { o.contents.err };
14068                         unsafe { o.contents.err = core::ptr::null_mut(); }
14069                         CResult_UpdateFeeDecodeErrorZPtr { err }
14070                 };
14071                 Self {
14072                         contents,
14073                         result_ok: o.result_ok,
14074                 }
14075         }
14076 }
14077 impl Clone for CResult_UpdateFeeDecodeErrorZ {
14078         fn clone(&self) -> Self {
14079                 if self.result_ok {
14080                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
14081                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
14082                         } }
14083                 } else {
14084                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
14085                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14086                         } }
14087                 }
14088         }
14089 }
14090 #[no_mangle]
14091 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
14092 /// but with all dynamically-allocated buffers duplicated in new buffers.
14093 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
14094 #[repr(C)]
14095 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
14096 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14097         /// A pointer to the contents in the success state.
14098         /// Reading from this pointer when `result_ok` is not set is undefined.
14099         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
14100         /// A pointer to the contents in the error state.
14101         /// Reading from this pointer when `result_ok` is set is undefined.
14102         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14103 }
14104 #[repr(C)]
14105 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
14106 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14107 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14108 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
14109         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
14110         /// `err` or `result` depending on the state of `result_ok`.
14111         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
14112         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
14113         pub result_ok: bool,
14114 }
14115 #[no_mangle]
14116 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
14117 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14118         CResult_UpdateFulfillHTLCDecodeErrorZ {
14119                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14120                         result: Box::into_raw(Box::new(o)),
14121                 },
14122                 result_ok: true,
14123         }
14124 }
14125 #[no_mangle]
14126 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
14127 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
14128         CResult_UpdateFulfillHTLCDecodeErrorZ {
14129                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14130                         err: Box::into_raw(Box::new(e)),
14131                 },
14132                 result_ok: false,
14133         }
14134 }
14135 /// Checks if the given object is currently in the success state
14136 #[no_mangle]
14137 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
14138         o.result_ok
14139 }
14140 #[no_mangle]
14141 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
14142 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
14143 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
14144         fn drop(&mut self) {
14145                 if self.result_ok {
14146                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14147                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14148                         }
14149                 } else {
14150                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14151                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14152                         }
14153                 }
14154         }
14155 }
14156 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
14157         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14158                 let contents = if o.result_ok {
14159                         let result = unsafe { o.contents.result };
14160                         unsafe { o.contents.result = core::ptr::null_mut() };
14161                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
14162                 } else {
14163                         let err = unsafe { o.contents.err };
14164                         unsafe { o.contents.err = core::ptr::null_mut(); }
14165                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
14166                 };
14167                 Self {
14168                         contents,
14169                         result_ok: o.result_ok,
14170                 }
14171         }
14172 }
14173 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
14174         fn clone(&self) -> Self {
14175                 if self.result_ok {
14176                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14177                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
14178                         } }
14179                 } else {
14180                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
14181                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14182                         } }
14183                 }
14184         }
14185 }
14186 #[no_mangle]
14187 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
14188 /// but with all dynamically-allocated buffers duplicated in new buffers.
14189 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
14190 #[repr(C)]
14191 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
14192 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
14193         /// A pointer to the contents in the success state.
14194         /// Reading from this pointer when `result_ok` is not set is undefined.
14195         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
14196         /// A pointer to the contents in the error state.
14197         /// Reading from this pointer when `result_ok` is set is undefined.
14198         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14199 }
14200 #[repr(C)]
14201 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
14202 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
14203 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14204 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
14205         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
14206         /// `err` or `result` depending on the state of `result_ok`.
14207         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
14208         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
14209         pub result_ok: bool,
14210 }
14211 #[no_mangle]
14212 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
14213 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
14214         CResult_UpdateAddHTLCDecodeErrorZ {
14215                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14216                         result: Box::into_raw(Box::new(o)),
14217                 },
14218                 result_ok: true,
14219         }
14220 }
14221 #[no_mangle]
14222 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
14223 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
14224         CResult_UpdateAddHTLCDecodeErrorZ {
14225                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14226                         err: Box::into_raw(Box::new(e)),
14227                 },
14228                 result_ok: false,
14229         }
14230 }
14231 /// Checks if the given object is currently in the success state
14232 #[no_mangle]
14233 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
14234         o.result_ok
14235 }
14236 #[no_mangle]
14237 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
14238 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
14239 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
14240         fn drop(&mut self) {
14241                 if self.result_ok {
14242                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14243                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14244                         }
14245                 } else {
14246                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14247                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14248                         }
14249                 }
14250         }
14251 }
14252 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
14253         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
14254                 let contents = if o.result_ok {
14255                         let result = unsafe { o.contents.result };
14256                         unsafe { o.contents.result = core::ptr::null_mut() };
14257                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
14258                 } else {
14259                         let err = unsafe { o.contents.err };
14260                         unsafe { o.contents.err = core::ptr::null_mut(); }
14261                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
14262                 };
14263                 Self {
14264                         contents,
14265                         result_ok: o.result_ok,
14266                 }
14267         }
14268 }
14269 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
14270         fn clone(&self) -> Self {
14271                 if self.result_ok {
14272                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14273                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
14274                         } }
14275                 } else {
14276                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
14277                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14278                         } }
14279                 }
14280         }
14281 }
14282 #[no_mangle]
14283 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
14284 /// but with all dynamically-allocated buffers duplicated in new buffers.
14285 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
14286 #[repr(C)]
14287 /// The contents of CResult_PingDecodeErrorZ
14288 pub union CResult_PingDecodeErrorZPtr {
14289         /// A pointer to the contents in the success state.
14290         /// Reading from this pointer when `result_ok` is not set is undefined.
14291         pub result: *mut crate::lightning::ln::msgs::Ping,
14292         /// A pointer to the contents in the error state.
14293         /// Reading from this pointer when `result_ok` is set is undefined.
14294         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14295 }
14296 #[repr(C)]
14297 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
14298 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
14299 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14300 pub struct CResult_PingDecodeErrorZ {
14301         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
14302         /// `err` or `result` depending on the state of `result_ok`.
14303         pub contents: CResult_PingDecodeErrorZPtr,
14304         /// Whether this CResult_PingDecodeErrorZ represents a success state.
14305         pub result_ok: bool,
14306 }
14307 #[no_mangle]
14308 /// Creates a new CResult_PingDecodeErrorZ in the success state.
14309 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
14310         CResult_PingDecodeErrorZ {
14311                 contents: CResult_PingDecodeErrorZPtr {
14312                         result: Box::into_raw(Box::new(o)),
14313                 },
14314                 result_ok: true,
14315         }
14316 }
14317 #[no_mangle]
14318 /// Creates a new CResult_PingDecodeErrorZ in the error state.
14319 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
14320         CResult_PingDecodeErrorZ {
14321                 contents: CResult_PingDecodeErrorZPtr {
14322                         err: Box::into_raw(Box::new(e)),
14323                 },
14324                 result_ok: false,
14325         }
14326 }
14327 /// Checks if the given object is currently in the success state
14328 #[no_mangle]
14329 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
14330         o.result_ok
14331 }
14332 #[no_mangle]
14333 /// Frees any resources used by the CResult_PingDecodeErrorZ.
14334 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
14335 impl Drop for CResult_PingDecodeErrorZ {
14336         fn drop(&mut self) {
14337                 if self.result_ok {
14338                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14339                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14340                         }
14341                 } else {
14342                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14343                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14344                         }
14345                 }
14346         }
14347 }
14348 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
14349         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
14350                 let contents = if o.result_ok {
14351                         let result = unsafe { o.contents.result };
14352                         unsafe { o.contents.result = core::ptr::null_mut() };
14353                         CResult_PingDecodeErrorZPtr { result }
14354                 } else {
14355                         let err = unsafe { o.contents.err };
14356                         unsafe { o.contents.err = core::ptr::null_mut(); }
14357                         CResult_PingDecodeErrorZPtr { err }
14358                 };
14359                 Self {
14360                         contents,
14361                         result_ok: o.result_ok,
14362                 }
14363         }
14364 }
14365 impl Clone for CResult_PingDecodeErrorZ {
14366         fn clone(&self) -> Self {
14367                 if self.result_ok {
14368                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
14369                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
14370                         } }
14371                 } else {
14372                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
14373                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14374                         } }
14375                 }
14376         }
14377 }
14378 #[no_mangle]
14379 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
14380 /// but with all dynamically-allocated buffers duplicated in new buffers.
14381 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
14382 #[repr(C)]
14383 /// The contents of CResult_PongDecodeErrorZ
14384 pub union CResult_PongDecodeErrorZPtr {
14385         /// A pointer to the contents in the success state.
14386         /// Reading from this pointer when `result_ok` is not set is undefined.
14387         pub result: *mut crate::lightning::ln::msgs::Pong,
14388         /// A pointer to the contents in the error state.
14389         /// Reading from this pointer when `result_ok` is set is undefined.
14390         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14391 }
14392 #[repr(C)]
14393 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
14394 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
14395 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14396 pub struct CResult_PongDecodeErrorZ {
14397         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
14398         /// `err` or `result` depending on the state of `result_ok`.
14399         pub contents: CResult_PongDecodeErrorZPtr,
14400         /// Whether this CResult_PongDecodeErrorZ represents a success state.
14401         pub result_ok: bool,
14402 }
14403 #[no_mangle]
14404 /// Creates a new CResult_PongDecodeErrorZ in the success state.
14405 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
14406         CResult_PongDecodeErrorZ {
14407                 contents: CResult_PongDecodeErrorZPtr {
14408                         result: Box::into_raw(Box::new(o)),
14409                 },
14410                 result_ok: true,
14411         }
14412 }
14413 #[no_mangle]
14414 /// Creates a new CResult_PongDecodeErrorZ in the error state.
14415 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
14416         CResult_PongDecodeErrorZ {
14417                 contents: CResult_PongDecodeErrorZPtr {
14418                         err: Box::into_raw(Box::new(e)),
14419                 },
14420                 result_ok: false,
14421         }
14422 }
14423 /// Checks if the given object is currently in the success state
14424 #[no_mangle]
14425 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
14426         o.result_ok
14427 }
14428 #[no_mangle]
14429 /// Frees any resources used by the CResult_PongDecodeErrorZ.
14430 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
14431 impl Drop for CResult_PongDecodeErrorZ {
14432         fn drop(&mut self) {
14433                 if self.result_ok {
14434                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14435                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14436                         }
14437                 } else {
14438                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14439                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14440                         }
14441                 }
14442         }
14443 }
14444 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
14445         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
14446                 let contents = if o.result_ok {
14447                         let result = unsafe { o.contents.result };
14448                         unsafe { o.contents.result = core::ptr::null_mut() };
14449                         CResult_PongDecodeErrorZPtr { result }
14450                 } else {
14451                         let err = unsafe { o.contents.err };
14452                         unsafe { o.contents.err = core::ptr::null_mut(); }
14453                         CResult_PongDecodeErrorZPtr { err }
14454                 };
14455                 Self {
14456                         contents,
14457                         result_ok: o.result_ok,
14458                 }
14459         }
14460 }
14461 impl Clone for CResult_PongDecodeErrorZ {
14462         fn clone(&self) -> Self {
14463                 if self.result_ok {
14464                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
14465                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
14466                         } }
14467                 } else {
14468                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
14469                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14470                         } }
14471                 }
14472         }
14473 }
14474 #[no_mangle]
14475 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
14476 /// but with all dynamically-allocated buffers duplicated in new buffers.
14477 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
14478 #[repr(C)]
14479 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
14480 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14481         /// A pointer to the contents in the success state.
14482         /// Reading from this pointer when `result_ok` is not set is undefined.
14483         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
14484         /// A pointer to the contents in the error state.
14485         /// Reading from this pointer when `result_ok` is set is undefined.
14486         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14487 }
14488 #[repr(C)]
14489 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14490 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14491 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14492 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14493         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
14494         /// `err` or `result` depending on the state of `result_ok`.
14495         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
14496         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
14497         pub result_ok: bool,
14498 }
14499 #[no_mangle]
14500 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
14501 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14502         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14503                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14504                         result: Box::into_raw(Box::new(o)),
14505                 },
14506                 result_ok: true,
14507         }
14508 }
14509 #[no_mangle]
14510 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
14511 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14512         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14513                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14514                         err: Box::into_raw(Box::new(e)),
14515                 },
14516                 result_ok: false,
14517         }
14518 }
14519 /// Checks if the given object is currently in the success state
14520 #[no_mangle]
14521 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
14522         o.result_ok
14523 }
14524 #[no_mangle]
14525 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
14526 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
14527 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14528         fn drop(&mut self) {
14529                 if self.result_ok {
14530                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14531                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14532                         }
14533                 } else {
14534                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14535                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14536                         }
14537                 }
14538         }
14539 }
14540 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14541         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14542                 let contents = if o.result_ok {
14543                         let result = unsafe { o.contents.result };
14544                         unsafe { o.contents.result = core::ptr::null_mut() };
14545                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14546                 } else {
14547                         let err = unsafe { o.contents.err };
14548                         unsafe { o.contents.err = core::ptr::null_mut(); }
14549                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14550                 };
14551                 Self {
14552                         contents,
14553                         result_ok: o.result_ok,
14554                 }
14555         }
14556 }
14557 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14558         fn clone(&self) -> Self {
14559                 if self.result_ok {
14560                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14561                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14562                         } }
14563                 } else {
14564                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14565                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14566                         } }
14567                 }
14568         }
14569 }
14570 #[no_mangle]
14571 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14572 /// but with all dynamically-allocated buffers duplicated in new buffers.
14573 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14574 #[repr(C)]
14575 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14576 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14577         /// A pointer to the contents in the success state.
14578         /// Reading from this pointer when `result_ok` is not set is undefined.
14579         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14580         /// A pointer to the contents in the error state.
14581         /// Reading from this pointer when `result_ok` is set is undefined.
14582         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14583 }
14584 #[repr(C)]
14585 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14586 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14587 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14588 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14589         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14590         /// `err` or `result` depending on the state of `result_ok`.
14591         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14592         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14593         pub result_ok: bool,
14594 }
14595 #[no_mangle]
14596 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14597 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14598         CResult_ChannelAnnouncementDecodeErrorZ {
14599                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14600                         result: Box::into_raw(Box::new(o)),
14601                 },
14602                 result_ok: true,
14603         }
14604 }
14605 #[no_mangle]
14606 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14607 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14608         CResult_ChannelAnnouncementDecodeErrorZ {
14609                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14610                         err: Box::into_raw(Box::new(e)),
14611                 },
14612                 result_ok: false,
14613         }
14614 }
14615 /// Checks if the given object is currently in the success state
14616 #[no_mangle]
14617 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14618         o.result_ok
14619 }
14620 #[no_mangle]
14621 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14622 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14623 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14624         fn drop(&mut self) {
14625                 if self.result_ok {
14626                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14627                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14628                         }
14629                 } else {
14630                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14631                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14632                         }
14633                 }
14634         }
14635 }
14636 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14637         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14638                 let contents = if o.result_ok {
14639                         let result = unsafe { o.contents.result };
14640                         unsafe { o.contents.result = core::ptr::null_mut() };
14641                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14642                 } else {
14643                         let err = unsafe { o.contents.err };
14644                         unsafe { o.contents.err = core::ptr::null_mut(); }
14645                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14646                 };
14647                 Self {
14648                         contents,
14649                         result_ok: o.result_ok,
14650                 }
14651         }
14652 }
14653 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14654         fn clone(&self) -> Self {
14655                 if self.result_ok {
14656                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14657                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14658                         } }
14659                 } else {
14660                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14661                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14662                         } }
14663                 }
14664         }
14665 }
14666 #[no_mangle]
14667 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14668 /// but with all dynamically-allocated buffers duplicated in new buffers.
14669 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14670 #[repr(C)]
14671 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14672 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14673         /// A pointer to the contents in the success state.
14674         /// Reading from this pointer when `result_ok` is not set is undefined.
14675         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14676         /// A pointer to the contents in the error state.
14677         /// Reading from this pointer when `result_ok` is set is undefined.
14678         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14679 }
14680 #[repr(C)]
14681 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14682 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14683 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14684 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14685         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14686         /// `err` or `result` depending on the state of `result_ok`.
14687         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14688         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14689         pub result_ok: bool,
14690 }
14691 #[no_mangle]
14692 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14693 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14694         CResult_UnsignedChannelUpdateDecodeErrorZ {
14695                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14696                         result: Box::into_raw(Box::new(o)),
14697                 },
14698                 result_ok: true,
14699         }
14700 }
14701 #[no_mangle]
14702 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14703 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14704         CResult_UnsignedChannelUpdateDecodeErrorZ {
14705                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14706                         err: Box::into_raw(Box::new(e)),
14707                 },
14708                 result_ok: false,
14709         }
14710 }
14711 /// Checks if the given object is currently in the success state
14712 #[no_mangle]
14713 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14714         o.result_ok
14715 }
14716 #[no_mangle]
14717 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14718 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14719 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14720         fn drop(&mut self) {
14721                 if self.result_ok {
14722                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14723                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14724                         }
14725                 } else {
14726                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14727                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14728                         }
14729                 }
14730         }
14731 }
14732 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14733         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14734                 let contents = if o.result_ok {
14735                         let result = unsafe { o.contents.result };
14736                         unsafe { o.contents.result = core::ptr::null_mut() };
14737                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14738                 } else {
14739                         let err = unsafe { o.contents.err };
14740                         unsafe { o.contents.err = core::ptr::null_mut(); }
14741                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14742                 };
14743                 Self {
14744                         contents,
14745                         result_ok: o.result_ok,
14746                 }
14747         }
14748 }
14749 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14750         fn clone(&self) -> Self {
14751                 if self.result_ok {
14752                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14753                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14754                         } }
14755                 } else {
14756                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14757                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14758                         } }
14759                 }
14760         }
14761 }
14762 #[no_mangle]
14763 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14764 /// but with all dynamically-allocated buffers duplicated in new buffers.
14765 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14766 #[repr(C)]
14767 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14768 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14769         /// A pointer to the contents in the success state.
14770         /// Reading from this pointer when `result_ok` is not set is undefined.
14771         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14772         /// A pointer to the contents in the error state.
14773         /// Reading from this pointer when `result_ok` is set is undefined.
14774         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14775 }
14776 #[repr(C)]
14777 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14778 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14779 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14780 pub struct CResult_ChannelUpdateDecodeErrorZ {
14781         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14782         /// `err` or `result` depending on the state of `result_ok`.
14783         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14784         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14785         pub result_ok: bool,
14786 }
14787 #[no_mangle]
14788 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14789 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14790         CResult_ChannelUpdateDecodeErrorZ {
14791                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14792                         result: Box::into_raw(Box::new(o)),
14793                 },
14794                 result_ok: true,
14795         }
14796 }
14797 #[no_mangle]
14798 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14799 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14800         CResult_ChannelUpdateDecodeErrorZ {
14801                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14802                         err: Box::into_raw(Box::new(e)),
14803                 },
14804                 result_ok: false,
14805         }
14806 }
14807 /// Checks if the given object is currently in the success state
14808 #[no_mangle]
14809 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14810         o.result_ok
14811 }
14812 #[no_mangle]
14813 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14814 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14815 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14816         fn drop(&mut self) {
14817                 if self.result_ok {
14818                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14819                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14820                         }
14821                 } else {
14822                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14823                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14824                         }
14825                 }
14826         }
14827 }
14828 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14829         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14830                 let contents = if o.result_ok {
14831                         let result = unsafe { o.contents.result };
14832                         unsafe { o.contents.result = core::ptr::null_mut() };
14833                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14834                 } else {
14835                         let err = unsafe { o.contents.err };
14836                         unsafe { o.contents.err = core::ptr::null_mut(); }
14837                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14838                 };
14839                 Self {
14840                         contents,
14841                         result_ok: o.result_ok,
14842                 }
14843         }
14844 }
14845 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14846         fn clone(&self) -> Self {
14847                 if self.result_ok {
14848                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14849                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14850                         } }
14851                 } else {
14852                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14853                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14854                         } }
14855                 }
14856         }
14857 }
14858 #[no_mangle]
14859 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14860 /// but with all dynamically-allocated buffers duplicated in new buffers.
14861 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14862 #[repr(C)]
14863 /// The contents of CResult_ErrorMessageDecodeErrorZ
14864 pub union CResult_ErrorMessageDecodeErrorZPtr {
14865         /// A pointer to the contents in the success state.
14866         /// Reading from this pointer when `result_ok` is not set is undefined.
14867         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14868         /// A pointer to the contents in the error state.
14869         /// Reading from this pointer when `result_ok` is set is undefined.
14870         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14871 }
14872 #[repr(C)]
14873 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14874 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14875 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14876 pub struct CResult_ErrorMessageDecodeErrorZ {
14877         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14878         /// `err` or `result` depending on the state of `result_ok`.
14879         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14880         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14881         pub result_ok: bool,
14882 }
14883 #[no_mangle]
14884 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14885 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14886         CResult_ErrorMessageDecodeErrorZ {
14887                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14888                         result: Box::into_raw(Box::new(o)),
14889                 },
14890                 result_ok: true,
14891         }
14892 }
14893 #[no_mangle]
14894 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14895 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14896         CResult_ErrorMessageDecodeErrorZ {
14897                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14898                         err: Box::into_raw(Box::new(e)),
14899                 },
14900                 result_ok: false,
14901         }
14902 }
14903 /// Checks if the given object is currently in the success state
14904 #[no_mangle]
14905 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14906         o.result_ok
14907 }
14908 #[no_mangle]
14909 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14910 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14911 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14912         fn drop(&mut self) {
14913                 if self.result_ok {
14914                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14915                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14916                         }
14917                 } else {
14918                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14919                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14920                         }
14921                 }
14922         }
14923 }
14924 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14925         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14926                 let contents = if o.result_ok {
14927                         let result = unsafe { o.contents.result };
14928                         unsafe { o.contents.result = core::ptr::null_mut() };
14929                         CResult_ErrorMessageDecodeErrorZPtr { result }
14930                 } else {
14931                         let err = unsafe { o.contents.err };
14932                         unsafe { o.contents.err = core::ptr::null_mut(); }
14933                         CResult_ErrorMessageDecodeErrorZPtr { err }
14934                 };
14935                 Self {
14936                         contents,
14937                         result_ok: o.result_ok,
14938                 }
14939         }
14940 }
14941 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14942         fn clone(&self) -> Self {
14943                 if self.result_ok {
14944                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14945                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14946                         } }
14947                 } else {
14948                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14949                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14950                         } }
14951                 }
14952         }
14953 }
14954 #[no_mangle]
14955 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14956 /// but with all dynamically-allocated buffers duplicated in new buffers.
14957 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14958 #[repr(C)]
14959 /// The contents of CResult_WarningMessageDecodeErrorZ
14960 pub union CResult_WarningMessageDecodeErrorZPtr {
14961         /// A pointer to the contents in the success state.
14962         /// Reading from this pointer when `result_ok` is not set is undefined.
14963         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14964         /// A pointer to the contents in the error state.
14965         /// Reading from this pointer when `result_ok` is set is undefined.
14966         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14967 }
14968 #[repr(C)]
14969 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14970 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14971 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14972 pub struct CResult_WarningMessageDecodeErrorZ {
14973         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14974         /// `err` or `result` depending on the state of `result_ok`.
14975         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14976         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14977         pub result_ok: bool,
14978 }
14979 #[no_mangle]
14980 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14981 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14982         CResult_WarningMessageDecodeErrorZ {
14983                 contents: CResult_WarningMessageDecodeErrorZPtr {
14984                         result: Box::into_raw(Box::new(o)),
14985                 },
14986                 result_ok: true,
14987         }
14988 }
14989 #[no_mangle]
14990 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14991 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14992         CResult_WarningMessageDecodeErrorZ {
14993                 contents: CResult_WarningMessageDecodeErrorZPtr {
14994                         err: Box::into_raw(Box::new(e)),
14995                 },
14996                 result_ok: false,
14997         }
14998 }
14999 /// Checks if the given object is currently in the success state
15000 #[no_mangle]
15001 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
15002         o.result_ok
15003 }
15004 #[no_mangle]
15005 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
15006 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
15007 impl Drop for CResult_WarningMessageDecodeErrorZ {
15008         fn drop(&mut self) {
15009                 if self.result_ok {
15010                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15011                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15012                         }
15013                 } else {
15014                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15015                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15016                         }
15017                 }
15018         }
15019 }
15020 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
15021         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
15022                 let contents = if o.result_ok {
15023                         let result = unsafe { o.contents.result };
15024                         unsafe { o.contents.result = core::ptr::null_mut() };
15025                         CResult_WarningMessageDecodeErrorZPtr { result }
15026                 } else {
15027                         let err = unsafe { o.contents.err };
15028                         unsafe { o.contents.err = core::ptr::null_mut(); }
15029                         CResult_WarningMessageDecodeErrorZPtr { err }
15030                 };
15031                 Self {
15032                         contents,
15033                         result_ok: o.result_ok,
15034                 }
15035         }
15036 }
15037 impl Clone for CResult_WarningMessageDecodeErrorZ {
15038         fn clone(&self) -> Self {
15039                 if self.result_ok {
15040                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
15041                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
15042                         } }
15043                 } else {
15044                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
15045                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15046                         } }
15047                 }
15048         }
15049 }
15050 #[no_mangle]
15051 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
15052 /// but with all dynamically-allocated buffers duplicated in new buffers.
15053 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
15054 #[repr(C)]
15055 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
15056 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15057         /// A pointer to the contents in the success state.
15058         /// Reading from this pointer when `result_ok` is not set is undefined.
15059         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
15060         /// A pointer to the contents in the error state.
15061         /// Reading from this pointer when `result_ok` is set is undefined.
15062         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15063 }
15064 #[repr(C)]
15065 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15066 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15067 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15068 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15069         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
15070         /// `err` or `result` depending on the state of `result_ok`.
15071         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
15072         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
15073         pub result_ok: bool,
15074 }
15075 #[no_mangle]
15076 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
15077 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15078         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15079                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15080                         result: Box::into_raw(Box::new(o)),
15081                 },
15082                 result_ok: true,
15083         }
15084 }
15085 #[no_mangle]
15086 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
15087 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15088         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15089                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15090                         err: Box::into_raw(Box::new(e)),
15091                 },
15092                 result_ok: false,
15093         }
15094 }
15095 /// Checks if the given object is currently in the success state
15096 #[no_mangle]
15097 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
15098         o.result_ok
15099 }
15100 #[no_mangle]
15101 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
15102 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
15103 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15104         fn drop(&mut self) {
15105                 if self.result_ok {
15106                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15107                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15108                         }
15109                 } else {
15110                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15111                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15112                         }
15113                 }
15114         }
15115 }
15116 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15117         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15118                 let contents = if o.result_ok {
15119                         let result = unsafe { o.contents.result };
15120                         unsafe { o.contents.result = core::ptr::null_mut() };
15121                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
15122                 } else {
15123                         let err = unsafe { o.contents.err };
15124                         unsafe { o.contents.err = core::ptr::null_mut(); }
15125                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
15126                 };
15127                 Self {
15128                         contents,
15129                         result_ok: o.result_ok,
15130                 }
15131         }
15132 }
15133 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
15134         fn clone(&self) -> Self {
15135                 if self.result_ok {
15136                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15137                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15138                         } }
15139                 } else {
15140                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
15141                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15142                         } }
15143                 }
15144         }
15145 }
15146 #[no_mangle]
15147 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
15148 /// but with all dynamically-allocated buffers duplicated in new buffers.
15149 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15150 #[repr(C)]
15151 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
15152 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
15153         /// A pointer to the contents in the success state.
15154         /// Reading from this pointer when `result_ok` is not set is undefined.
15155         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
15156         /// A pointer to the contents in the error state.
15157         /// Reading from this pointer when `result_ok` is set is undefined.
15158         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15159 }
15160 #[repr(C)]
15161 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
15162 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
15163 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15164 pub struct CResult_NodeAnnouncementDecodeErrorZ {
15165         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
15166         /// `err` or `result` depending on the state of `result_ok`.
15167         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
15168         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
15169         pub result_ok: bool,
15170 }
15171 #[no_mangle]
15172 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
15173 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
15174         CResult_NodeAnnouncementDecodeErrorZ {
15175                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15176                         result: Box::into_raw(Box::new(o)),
15177                 },
15178                 result_ok: true,
15179         }
15180 }
15181 #[no_mangle]
15182 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
15183 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
15184         CResult_NodeAnnouncementDecodeErrorZ {
15185                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15186                         err: Box::into_raw(Box::new(e)),
15187                 },
15188                 result_ok: false,
15189         }
15190 }
15191 /// Checks if the given object is currently in the success state
15192 #[no_mangle]
15193 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
15194         o.result_ok
15195 }
15196 #[no_mangle]
15197 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
15198 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
15199 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
15200         fn drop(&mut self) {
15201                 if self.result_ok {
15202                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15203                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15204                         }
15205                 } else {
15206                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15207                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15208                         }
15209                 }
15210         }
15211 }
15212 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
15213         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
15214                 let contents = if o.result_ok {
15215                         let result = unsafe { o.contents.result };
15216                         unsafe { o.contents.result = core::ptr::null_mut() };
15217                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
15218                 } else {
15219                         let err = unsafe { o.contents.err };
15220                         unsafe { o.contents.err = core::ptr::null_mut(); }
15221                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
15222                 };
15223                 Self {
15224                         contents,
15225                         result_ok: o.result_ok,
15226                 }
15227         }
15228 }
15229 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
15230         fn clone(&self) -> Self {
15231                 if self.result_ok {
15232                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15233                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
15234                         } }
15235                 } else {
15236                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
15237                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15238                         } }
15239                 }
15240         }
15241 }
15242 #[no_mangle]
15243 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
15244 /// but with all dynamically-allocated buffers duplicated in new buffers.
15245 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
15246 #[repr(C)]
15247 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
15248 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
15249         /// A pointer to the contents in the success state.
15250         /// Reading from this pointer when `result_ok` is not set is undefined.
15251         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
15252         /// A pointer to the contents in the error state.
15253         /// Reading from this pointer when `result_ok` is set is undefined.
15254         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15255 }
15256 #[repr(C)]
15257 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
15258 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
15259 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15260 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
15261         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
15262         /// `err` or `result` depending on the state of `result_ok`.
15263         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
15264         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
15265         pub result_ok: bool,
15266 }
15267 #[no_mangle]
15268 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
15269 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15270         CResult_QueryShortChannelIdsDecodeErrorZ {
15271                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15272                         result: Box::into_raw(Box::new(o)),
15273                 },
15274                 result_ok: true,
15275         }
15276 }
15277 #[no_mangle]
15278 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
15279 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
15280         CResult_QueryShortChannelIdsDecodeErrorZ {
15281                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15282                         err: Box::into_raw(Box::new(e)),
15283                 },
15284                 result_ok: false,
15285         }
15286 }
15287 /// Checks if the given object is currently in the success state
15288 #[no_mangle]
15289 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
15290         o.result_ok
15291 }
15292 #[no_mangle]
15293 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
15294 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
15295 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
15296         fn drop(&mut self) {
15297                 if self.result_ok {
15298                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15299                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15300                         }
15301                 } else {
15302                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15303                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15304                         }
15305                 }
15306         }
15307 }
15308 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
15309         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
15310                 let contents = if o.result_ok {
15311                         let result = unsafe { o.contents.result };
15312                         unsafe { o.contents.result = core::ptr::null_mut() };
15313                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
15314                 } else {
15315                         let err = unsafe { o.contents.err };
15316                         unsafe { o.contents.err = core::ptr::null_mut(); }
15317                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
15318                 };
15319                 Self {
15320                         contents,
15321                         result_ok: o.result_ok,
15322                 }
15323         }
15324 }
15325 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
15326         fn clone(&self) -> Self {
15327                 if self.result_ok {
15328                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15329                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
15330                         } }
15331                 } else {
15332                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
15333                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15334                         } }
15335                 }
15336         }
15337 }
15338 #[no_mangle]
15339 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
15340 /// but with all dynamically-allocated buffers duplicated in new buffers.
15341 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
15342 #[repr(C)]
15343 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
15344 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15345         /// A pointer to the contents in the success state.
15346         /// Reading from this pointer when `result_ok` is not set is undefined.
15347         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
15348         /// A pointer to the contents in the error state.
15349         /// Reading from this pointer when `result_ok` is set is undefined.
15350         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15351 }
15352 #[repr(C)]
15353 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
15354 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
15355 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15356 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15357         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
15358         /// `err` or `result` depending on the state of `result_ok`.
15359         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
15360         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
15361         pub result_ok: bool,
15362 }
15363 #[no_mangle]
15364 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
15365 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15366         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15367                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15368                         result: Box::into_raw(Box::new(o)),
15369                 },
15370                 result_ok: true,
15371         }
15372 }
15373 #[no_mangle]
15374 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
15375 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15376         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15377                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15378                         err: Box::into_raw(Box::new(e)),
15379                 },
15380                 result_ok: false,
15381         }
15382 }
15383 /// Checks if the given object is currently in the success state
15384 #[no_mangle]
15385 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
15386         o.result_ok
15387 }
15388 #[no_mangle]
15389 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
15390 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
15391 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15392         fn drop(&mut self) {
15393                 if self.result_ok {
15394                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15395                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15396                         }
15397                 } else {
15398                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15399                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15400                         }
15401                 }
15402         }
15403 }
15404 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15405         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
15406                 let contents = if o.result_ok {
15407                         let result = unsafe { o.contents.result };
15408                         unsafe { o.contents.result = core::ptr::null_mut() };
15409                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
15410                 } else {
15411                         let err = unsafe { o.contents.err };
15412                         unsafe { o.contents.err = core::ptr::null_mut(); }
15413                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
15414                 };
15415                 Self {
15416                         contents,
15417                         result_ok: o.result_ok,
15418                 }
15419         }
15420 }
15421 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
15422         fn clone(&self) -> Self {
15423                 if self.result_ok {
15424                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15425                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
15426                         } }
15427                 } else {
15428                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
15429                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15430                         } }
15431                 }
15432         }
15433 }
15434 #[no_mangle]
15435 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
15436 /// but with all dynamically-allocated buffers duplicated in new buffers.
15437 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
15438 #[repr(C)]
15439 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
15440 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
15441         /// A pointer to the contents in the success state.
15442         /// Reading from this pointer when `result_ok` is not set is undefined.
15443         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
15444         /// A pointer to the contents in the error state.
15445         /// Reading from this pointer when `result_ok` is set is undefined.
15446         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15447 }
15448 #[repr(C)]
15449 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
15450 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15451 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15452 pub struct CResult_QueryChannelRangeDecodeErrorZ {
15453         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
15454         /// `err` or `result` depending on the state of `result_ok`.
15455         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
15456         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
15457         pub result_ok: bool,
15458 }
15459 #[no_mangle]
15460 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
15461 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
15462         CResult_QueryChannelRangeDecodeErrorZ {
15463                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15464                         result: Box::into_raw(Box::new(o)),
15465                 },
15466                 result_ok: true,
15467         }
15468 }
15469 #[no_mangle]
15470 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
15471 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
15472         CResult_QueryChannelRangeDecodeErrorZ {
15473                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15474                         err: Box::into_raw(Box::new(e)),
15475                 },
15476                 result_ok: false,
15477         }
15478 }
15479 /// Checks if the given object is currently in the success state
15480 #[no_mangle]
15481 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
15482         o.result_ok
15483 }
15484 #[no_mangle]
15485 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
15486 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
15487 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
15488         fn drop(&mut self) {
15489                 if self.result_ok {
15490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15492                         }
15493                 } else {
15494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15496                         }
15497                 }
15498         }
15499 }
15500 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
15501         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15502                 let contents = if o.result_ok {
15503                         let result = unsafe { o.contents.result };
15504                         unsafe { o.contents.result = core::ptr::null_mut() };
15505                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
15506                 } else {
15507                         let err = unsafe { o.contents.err };
15508                         unsafe { o.contents.err = core::ptr::null_mut(); }
15509                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
15510                 };
15511                 Self {
15512                         contents,
15513                         result_ok: o.result_ok,
15514                 }
15515         }
15516 }
15517 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
15518         fn clone(&self) -> Self {
15519                 if self.result_ok {
15520                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15521                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
15522                         } }
15523                 } else {
15524                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
15525                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15526                         } }
15527                 }
15528         }
15529 }
15530 #[no_mangle]
15531 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
15532 /// but with all dynamically-allocated buffers duplicated in new buffers.
15533 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15534 #[repr(C)]
15535 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
15536 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
15537         /// A pointer to the contents in the success state.
15538         /// Reading from this pointer when `result_ok` is not set is undefined.
15539         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15540         /// A pointer to the contents in the error state.
15541         /// Reading from this pointer when `result_ok` is set is undefined.
15542         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15543 }
15544 #[repr(C)]
15545 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15546 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15548 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15549         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15550         /// `err` or `result` depending on the state of `result_ok`.
15551         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15552         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15553         pub result_ok: bool,
15554 }
15555 #[no_mangle]
15556 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15557 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15558         CResult_ReplyChannelRangeDecodeErrorZ {
15559                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15560                         result: Box::into_raw(Box::new(o)),
15561                 },
15562                 result_ok: true,
15563         }
15564 }
15565 #[no_mangle]
15566 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15567 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15568         CResult_ReplyChannelRangeDecodeErrorZ {
15569                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15570                         err: Box::into_raw(Box::new(e)),
15571                 },
15572                 result_ok: false,
15573         }
15574 }
15575 /// Checks if the given object is currently in the success state
15576 #[no_mangle]
15577 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15578         o.result_ok
15579 }
15580 #[no_mangle]
15581 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15582 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15583 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15584         fn drop(&mut self) {
15585                 if self.result_ok {
15586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15588                         }
15589                 } else {
15590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15592                         }
15593                 }
15594         }
15595 }
15596 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15597         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15598                 let contents = if o.result_ok {
15599                         let result = unsafe { o.contents.result };
15600                         unsafe { o.contents.result = core::ptr::null_mut() };
15601                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15602                 } else {
15603                         let err = unsafe { o.contents.err };
15604                         unsafe { o.contents.err = core::ptr::null_mut(); }
15605                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15606                 };
15607                 Self {
15608                         contents,
15609                         result_ok: o.result_ok,
15610                 }
15611         }
15612 }
15613 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15614         fn clone(&self) -> Self {
15615                 if self.result_ok {
15616                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15617                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15618                         } }
15619                 } else {
15620                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15621                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15622                         } }
15623                 }
15624         }
15625 }
15626 #[no_mangle]
15627 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15628 /// but with all dynamically-allocated buffers duplicated in new buffers.
15629 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15630 #[repr(C)]
15631 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15632 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15633         /// A pointer to the contents in the success state.
15634         /// Reading from this pointer when `result_ok` is not set is undefined.
15635         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15636         /// A pointer to the contents in the error state.
15637         /// Reading from this pointer when `result_ok` is set is undefined.
15638         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15639 }
15640 #[repr(C)]
15641 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15642 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15643 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15644 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15645         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15646         /// `err` or `result` depending on the state of `result_ok`.
15647         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15648         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15649         pub result_ok: bool,
15650 }
15651 #[no_mangle]
15652 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15653 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15654         CResult_GossipTimestampFilterDecodeErrorZ {
15655                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15656                         result: Box::into_raw(Box::new(o)),
15657                 },
15658                 result_ok: true,
15659         }
15660 }
15661 #[no_mangle]
15662 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15663 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15664         CResult_GossipTimestampFilterDecodeErrorZ {
15665                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15666                         err: Box::into_raw(Box::new(e)),
15667                 },
15668                 result_ok: false,
15669         }
15670 }
15671 /// Checks if the given object is currently in the success state
15672 #[no_mangle]
15673 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15674         o.result_ok
15675 }
15676 #[no_mangle]
15677 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15678 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15679 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15680         fn drop(&mut self) {
15681                 if self.result_ok {
15682                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15683                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15684                         }
15685                 } else {
15686                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15687                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15688                         }
15689                 }
15690         }
15691 }
15692 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15693         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15694                 let contents = if o.result_ok {
15695                         let result = unsafe { o.contents.result };
15696                         unsafe { o.contents.result = core::ptr::null_mut() };
15697                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15698                 } else {
15699                         let err = unsafe { o.contents.err };
15700                         unsafe { o.contents.err = core::ptr::null_mut(); }
15701                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15702                 };
15703                 Self {
15704                         contents,
15705                         result_ok: o.result_ok,
15706                 }
15707         }
15708 }
15709 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15710         fn clone(&self) -> Self {
15711                 if self.result_ok {
15712                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15713                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15714                         } }
15715                 } else {
15716                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15717                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15718                         } }
15719                 }
15720         }
15721 }
15722 #[no_mangle]
15723 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15724 /// but with all dynamically-allocated buffers duplicated in new buffers.
15725 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15726 #[repr(C)]
15727 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15728 /// This corresponds to std::vector in C++
15729 pub struct CVec_PhantomRouteHintsZ {
15730         /// The elements in the array.
15731         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15732         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15733         /// The number of elements pointed to by `data`.
15734         pub datalen: usize
15735 }
15736 impl CVec_PhantomRouteHintsZ {
15737         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15738                 if self.datalen == 0 { return Vec::new(); }
15739                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15740                 self.data = core::ptr::null_mut();
15741                 self.datalen = 0;
15742                 ret
15743         }
15744         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15745                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15746         }
15747 }
15748 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15749         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15750                 let datalen = v.len();
15751                 let data = Box::into_raw(v.into_boxed_slice());
15752                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15753         }
15754 }
15755 #[no_mangle]
15756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15757 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15758 impl Drop for CVec_PhantomRouteHintsZ {
15759         fn drop(&mut self) {
15760                 if self.datalen == 0 { return; }
15761                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15762         }
15763 }
15764 impl Clone for CVec_PhantomRouteHintsZ {
15765         fn clone(&self) -> Self {
15766                 let mut res = Vec::new();
15767                 if self.datalen == 0 { return Self::from(res); }
15768                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15769                 Self::from(res)
15770         }
15771 }
15772 #[repr(C)]
15773 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15774 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15775         /// A pointer to the contents in the success state.
15776         /// Reading from this pointer when `result_ok` is not set is undefined.
15777         pub result: *mut crate::lightning_invoice::Invoice,
15778         /// A pointer to the contents in the error state.
15779         /// Reading from this pointer when `result_ok` is set is undefined.
15780         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15781 }
15782 #[repr(C)]
15783 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15784 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15785 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15786 pub struct CResult_InvoiceSignOrCreationErrorZ {
15787         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15788         /// `err` or `result` depending on the state of `result_ok`.
15789         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15790         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15791         pub result_ok: bool,
15792 }
15793 #[no_mangle]
15794 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15795 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15796         CResult_InvoiceSignOrCreationErrorZ {
15797                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15798                         result: Box::into_raw(Box::new(o)),
15799                 },
15800                 result_ok: true,
15801         }
15802 }
15803 #[no_mangle]
15804 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15805 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15806         CResult_InvoiceSignOrCreationErrorZ {
15807                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15808                         err: Box::into_raw(Box::new(e)),
15809                 },
15810                 result_ok: false,
15811         }
15812 }
15813 /// Checks if the given object is currently in the success state
15814 #[no_mangle]
15815 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15816         o.result_ok
15817 }
15818 #[no_mangle]
15819 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15820 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15821 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15822         fn drop(&mut self) {
15823                 if self.result_ok {
15824                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15825                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15826                         }
15827                 } else {
15828                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15829                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15830                         }
15831                 }
15832         }
15833 }
15834 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15835         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15836                 let contents = if o.result_ok {
15837                         let result = unsafe { o.contents.result };
15838                         unsafe { o.contents.result = core::ptr::null_mut() };
15839                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15840                 } else {
15841                         let err = unsafe { o.contents.err };
15842                         unsafe { o.contents.err = core::ptr::null_mut(); }
15843                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15844                 };
15845                 Self {
15846                         contents,
15847                         result_ok: o.result_ok,
15848                 }
15849         }
15850 }
15851 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15852         fn clone(&self) -> Self {
15853                 if self.result_ok {
15854                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15855                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15856                         } }
15857                 } else {
15858                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15859                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15860                         } }
15861                 }
15862         }
15863 }
15864 #[no_mangle]
15865 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15866 /// but with all dynamically-allocated buffers duplicated in new buffers.
15867 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15868 #[repr(C)]
15869 /// An enum which can either contain a crate::lightning::chain::Filter or not
15870 pub enum COption_FilterZ {
15871         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15872         Some(crate::lightning::chain::Filter),
15873         /// When we're in this state, this COption_FilterZ contains nothing
15874         None
15875 }
15876 impl COption_FilterZ {
15877         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15878                 if let Self::None = self { false } else { true }
15879         }
15880         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15881                 !self.is_some()
15882         }
15883         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15884                 if let Self::Some(v) = self { v } else { unreachable!() }
15885         }
15886 }
15887 #[no_mangle]
15888 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15889 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15890         COption_FilterZ::Some(o)
15891 }
15892 #[no_mangle]
15893 /// Constructs a new COption_FilterZ containing nothing
15894 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15895         COption_FilterZ::None
15896 }
15897 #[no_mangle]
15898 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15899 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15900 #[repr(C)]
15901 /// The contents of CResult_LockedChannelMonitorNoneZ
15902 pub union CResult_LockedChannelMonitorNoneZPtr {
15903         /// A pointer to the contents in the success state.
15904         /// Reading from this pointer when `result_ok` is not set is undefined.
15905         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15906         /// Note that this value is always NULL, as there are no contents in the Err variant
15907         pub err: *mut core::ffi::c_void,
15908 }
15909 #[repr(C)]
15910 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15911 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15912 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15913 pub struct CResult_LockedChannelMonitorNoneZ {
15914         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15915         /// `err` or `result` depending on the state of `result_ok`.
15916         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15917         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15918         pub result_ok: bool,
15919 }
15920 #[no_mangle]
15921 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15922 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15923         CResult_LockedChannelMonitorNoneZ {
15924                 contents: CResult_LockedChannelMonitorNoneZPtr {
15925                         result: Box::into_raw(Box::new(o)),
15926                 },
15927                 result_ok: true,
15928         }
15929 }
15930 #[no_mangle]
15931 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15932 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15933         CResult_LockedChannelMonitorNoneZ {
15934                 contents: CResult_LockedChannelMonitorNoneZPtr {
15935                         err: core::ptr::null_mut(),
15936                 },
15937                 result_ok: false,
15938         }
15939 }
15940 /// Checks if the given object is currently in the success state
15941 #[no_mangle]
15942 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15943         o.result_ok
15944 }
15945 #[no_mangle]
15946 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15947 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15948 impl Drop for CResult_LockedChannelMonitorNoneZ {
15949         fn drop(&mut self) {
15950                 if self.result_ok {
15951                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15952                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15953                         }
15954                 } else {
15955                 }
15956         }
15957 }
15958 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15959         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15960                 let contents = if o.result_ok {
15961                         let result = unsafe { o.contents.result };
15962                         unsafe { o.contents.result = core::ptr::null_mut() };
15963                         CResult_LockedChannelMonitorNoneZPtr { result }
15964                 } else {
15965                         let _ = unsafe { Box::from_raw(o.contents.err) };
15966                         o.contents.err = core::ptr::null_mut();
15967                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15968                 };
15969                 Self {
15970                         contents,
15971                         result_ok: o.result_ok,
15972                 }
15973         }
15974 }
15975 #[repr(C)]
15976 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15977 /// This corresponds to std::vector in C++
15978 pub struct CVec_OutPointZ {
15979         /// The elements in the array.
15980         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15981         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15982         /// The number of elements pointed to by `data`.
15983         pub datalen: usize
15984 }
15985 impl CVec_OutPointZ {
15986         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15987                 if self.datalen == 0 { return Vec::new(); }
15988                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15989                 self.data = core::ptr::null_mut();
15990                 self.datalen = 0;
15991                 ret
15992         }
15993         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15994                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15995         }
15996 }
15997 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15998         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15999                 let datalen = v.len();
16000                 let data = Box::into_raw(v.into_boxed_slice());
16001                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
16002         }
16003 }
16004 #[no_mangle]
16005 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
16006 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
16007 impl Drop for CVec_OutPointZ {
16008         fn drop(&mut self) {
16009                 if self.datalen == 0 { return; }
16010                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
16011         }
16012 }
16013 impl Clone for CVec_OutPointZ {
16014         fn clone(&self) -> Self {
16015                 let mut res = Vec::new();
16016                 if self.datalen == 0 { return Self::from(res); }
16017                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
16018                 Self::from(res)
16019         }
16020 }