Update auto-generated bindings with FromStr errors
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830         /// A pointer to the contents in the success state.
2831         /// Reading from this pointer when `result_ok` is not set is undefined.
2832         pub result: *mut crate::c_types::TxOut,
2833         /// A pointer to the contents in the error state.
2834         /// Reading from this pointer when `result_ok` is set is undefined.
2835         pub err: *mut crate::lightning::chain::AccessError,
2836 }
2837 #[repr(C)]
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843         /// `err` or `result` depending on the state of `result_ok`.
2844         pub contents: CResult_TxOutAccessErrorZPtr,
2845         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846         pub result_ok: bool,
2847 }
2848 #[no_mangle]
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851         CResult_TxOutAccessErrorZ {
2852                 contents: CResult_TxOutAccessErrorZPtr {
2853                         result: Box::into_raw(Box::new(o)),
2854                 },
2855                 result_ok: true,
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861         CResult_TxOutAccessErrorZ {
2862                 contents: CResult_TxOutAccessErrorZPtr {
2863                         err: Box::into_raw(Box::new(e)),
2864                 },
2865                 result_ok: false,
2866         }
2867 }
2868 /// Checks if the given object is currently in the success state
2869 #[no_mangle]
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2871         o.result_ok
2872 }
2873 #[no_mangle]
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877         fn drop(&mut self) {
2878                 if self.result_ok {
2879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2881                         }
2882                 } else {
2883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2885                         }
2886                 }
2887         }
2888 }
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891                 let contents = if o.result_ok {
2892                         let result = unsafe { o.contents.result };
2893                         unsafe { o.contents.result = core::ptr::null_mut() };
2894                         CResult_TxOutAccessErrorZPtr { result }
2895                 } else {
2896                         let err = unsafe { o.contents.err };
2897                         unsafe { o.contents.err = core::ptr::null_mut(); }
2898                         CResult_TxOutAccessErrorZPtr { err }
2899                 };
2900                 Self {
2901                         contents,
2902                         result_ok: o.result_ok,
2903                 }
2904         }
2905 }
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907         fn clone(&self) -> Self {
2908                 if self.result_ok {
2909                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2911                         } }
2912                 } else {
2913                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2915                         } }
2916                 }
2917         }
2918 }
2919 #[no_mangle]
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2923 #[repr(C)]
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926         /// The element at position 0
2927         pub a: usize,
2928         /// The element at position 1
2929         pub b: crate::c_types::Transaction,
2930 }
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2933                 Self {
2934                         a: tup.0,
2935                         b: tup.1,
2936                 }
2937         }
2938 }
2939 impl C2Tuple_usizeTransactionZ {
2940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2941                 (self.a, self.b)
2942         }
2943 }
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945         fn clone(&self) -> Self {
2946                 Self {
2947                         a: Clone::clone(&self.a),
2948                         b: Clone::clone(&self.b),
2949                 }
2950         }
2951 }
2952 #[no_mangle]
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2957 #[no_mangle]
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959         C2Tuple_usizeTransactionZ { a, b, }
2960 }
2961
2962 #[no_mangle]
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2965 #[repr(C)]
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969         /// The elements in the array.
2970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972         /// The number of elements pointed to by `data`.
2973         pub datalen: usize
2974 }
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977                 if self.datalen == 0 { return Vec::new(); }
2978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979                 self.data = core::ptr::null_mut();
2980                 self.datalen = 0;
2981                 ret
2982         }
2983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2985         }
2986 }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989                 let datalen = v.len();
2990                 let data = Box::into_raw(v.into_boxed_slice());
2991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2992         }
2993 }
2994 #[no_mangle]
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998         fn drop(&mut self) {
2999                 if self.datalen == 0 { return; }
3000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3001         }
3002 }
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004         fn clone(&self) -> Self {
3005                 let mut res = Vec::new();
3006                 if self.datalen == 0 { return Self::from(res); }
3007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3008                 Self::from(res)
3009         }
3010 }
3011 #[repr(C)]
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015         /// The elements in the array.
3016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017         pub data: *mut crate::c_types::ThirtyTwoBytes,
3018         /// The number of elements pointed to by `data`.
3019         pub datalen: usize
3020 }
3021 impl CVec_TxidZ {
3022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023                 if self.datalen == 0 { return Vec::new(); }
3024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025                 self.data = core::ptr::null_mut();
3026                 self.datalen = 0;
3027                 ret
3028         }
3029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3031         }
3032 }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035                 let datalen = v.len();
3036                 let data = Box::into_raw(v.into_boxed_slice());
3037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3038         }
3039 }
3040 #[no_mangle]
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044         fn drop(&mut self) {
3045                 if self.datalen == 0 { return; }
3046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3047         }
3048 }
3049 impl Clone for CVec_TxidZ {
3050         fn clone(&self) -> Self {
3051                 let mut res = Vec::new();
3052                 if self.datalen == 0 { return Self::from(res); }
3053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3054                 Self::from(res)
3055         }
3056 }
3057 #[repr(C)]
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060         /// Note that this value is always NULL, as there are no contents in the OK variant
3061         pub result: *mut core::ffi::c_void,
3062         /// A pointer to the contents in the error state.
3063         /// Reading from this pointer when `result_ok` is set is undefined.
3064         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3065 }
3066 #[repr(C)]
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072         /// `err` or `result` depending on the state of `result_ok`.
3073         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075         pub result_ok: bool,
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080         CResult_NoneChannelMonitorUpdateErrZ {
3081                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082                         result: core::ptr::null_mut(),
3083                 },
3084                 result_ok: true,
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090         CResult_NoneChannelMonitorUpdateErrZ {
3091                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092                         err: Box::into_raw(Box::new(e)),
3093                 },
3094                 result_ok: false,
3095         }
3096 }
3097 /// Checks if the given object is currently in the success state
3098 #[no_mangle]
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3100         o.result_ok
3101 }
3102 #[no_mangle]
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106         fn drop(&mut self) {
3107                 if self.result_ok {
3108                 } else {
3109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3111                         }
3112                 }
3113         }
3114 }
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117                 let contents = if o.result_ok {
3118                         let _ = unsafe { Box::from_raw(o.contents.result) };
3119                         o.contents.result = core::ptr::null_mut();
3120                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3121                 } else {
3122                         let err = unsafe { o.contents.err };
3123                         unsafe { o.contents.err = core::ptr::null_mut(); }
3124                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3125                 };
3126                 Self {
3127                         contents,
3128                         result_ok: o.result_ok,
3129                 }
3130         }
3131 }
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133         fn clone(&self) -> Self {
3134                 if self.result_ok {
3135                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136                                 result: core::ptr::null_mut()
3137                         } }
3138                 } else {
3139                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3141                         } }
3142                 }
3143         }
3144 }
3145 #[no_mangle]
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3149 #[repr(C)]
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153         /// The elements in the array.
3154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156         /// The number of elements pointed to by `data`.
3157         pub datalen: usize
3158 }
3159 impl CVec_MonitorEventZ {
3160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161                 if self.datalen == 0 { return Vec::new(); }
3162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163                 self.data = core::ptr::null_mut();
3164                 self.datalen = 0;
3165                 ret
3166         }
3167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3169         }
3170 }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173                 let datalen = v.len();
3174                 let data = Box::into_raw(v.into_boxed_slice());
3175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176         }
3177 }
3178 #[no_mangle]
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182         fn drop(&mut self) {
3183                 if self.datalen == 0 { return; }
3184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3185         }
3186 }
3187 impl Clone for CVec_MonitorEventZ {
3188         fn clone(&self) -> Self {
3189                 let mut res = Vec::new();
3190                 if self.datalen == 0 { return Self::from(res); }
3191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3192                 Self::from(res)
3193         }
3194 }
3195 #[repr(C)]
3196 #[derive(Clone)]
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3202         None
3203 }
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206                 if let Self::None = self { false } else { true }
3207         }
3208         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3209                 !self.is_some()
3210         }
3211         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212                 if let Self::Some(v) = self { v } else { unreachable!() }
3213         }
3214 }
3215 #[no_mangle]
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218         COption_C2Tuple_usizeTransactionZZ::Some(o)
3219 }
3220 #[no_mangle]
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223         COption_C2Tuple_usizeTransactionZZ::None
3224 }
3225 #[no_mangle]
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3228 #[no_mangle]
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3232 #[repr(C)]
3233 #[derive(Clone)]
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237         Some(crate::lightning::util::events::ClosureReason),
3238         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3239         None
3240 }
3241 impl COption_ClosureReasonZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255         COption_ClosureReasonZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260         COption_ClosureReasonZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3265 #[no_mangle]
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3269 #[repr(C)]
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272         /// A pointer to the contents in the success state.
3273         /// Reading from this pointer when `result_ok` is not set is undefined.
3274         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275         /// A pointer to the contents in the error state.
3276         /// Reading from this pointer when `result_ok` is set is undefined.
3277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3278 }
3279 #[repr(C)]
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285         /// `err` or `result` depending on the state of `result_ok`.
3286         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288         pub result_ok: bool,
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293         CResult_COption_ClosureReasonZDecodeErrorZ {
3294                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                         result: Box::into_raw(Box::new(o)),
3296                 },
3297                 result_ok: true,
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303         CResult_COption_ClosureReasonZDecodeErrorZ {
3304                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305                         err: Box::into_raw(Box::new(e)),
3306                 },
3307                 result_ok: false,
3308         }
3309 }
3310 /// Checks if the given object is currently in the success state
3311 #[no_mangle]
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3313         o.result_ok
3314 }
3315 #[no_mangle]
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319         fn drop(&mut self) {
3320                 if self.result_ok {
3321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3323                         }
3324                 } else {
3325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3327                         }
3328                 }
3329         }
3330 }
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333                 let contents = if o.result_ok {
3334                         let result = unsafe { o.contents.result };
3335                         unsafe { o.contents.result = core::ptr::null_mut() };
3336                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3337                 } else {
3338                         let err = unsafe { o.contents.err };
3339                         unsafe { o.contents.err = core::ptr::null_mut(); }
3340                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3341                 };
3342                 Self {
3343                         contents,
3344                         result_ok: o.result_ok,
3345                 }
3346         }
3347 }
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349         fn clone(&self) -> Self {
3350                 if self.result_ok {
3351                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3353                         } }
3354                 } else {
3355                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3357                         } }
3358                 }
3359         }
3360 }
3361 #[no_mangle]
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3372         None
3373 }
3374 impl COption_NetworkUpdateZ {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388         COption_NetworkUpdateZ::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393         COption_NetworkUpdateZ::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3398 #[no_mangle]
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_SpendableOutputDescriptorZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 #[derive(Clone)]
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453         Some(crate::lightning::util::events::Event),
3454         /// When we're in this state, this COption_EventZ contains nothing
3455         None
3456 }
3457 impl COption_EventZ {
3458         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459                 if let Self::None = self { false } else { true }
3460         }
3461         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3462                 !self.is_some()
3463         }
3464         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465                 if let Self::Some(v) = self { v } else { unreachable!() }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471         COption_EventZ::Some(o)
3472 }
3473 #[no_mangle]
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476         COption_EventZ::None
3477 }
3478 #[no_mangle]
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3481 #[no_mangle]
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3485 #[repr(C)]
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488         /// A pointer to the contents in the success state.
3489         /// Reading from this pointer when `result_ok` is not set is undefined.
3490         pub result: *mut crate::c_types::derived::COption_EventZ,
3491         /// A pointer to the contents in the error state.
3492         /// Reading from this pointer when `result_ok` is set is undefined.
3493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3494 }
3495 #[repr(C)]
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501         /// `err` or `result` depending on the state of `result_ok`.
3502         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504         pub result_ok: bool,
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509         CResult_COption_EventZDecodeErrorZ {
3510                 contents: CResult_COption_EventZDecodeErrorZPtr {
3511                         result: Box::into_raw(Box::new(o)),
3512                 },
3513                 result_ok: true,
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519         CResult_COption_EventZDecodeErrorZ {
3520                 contents: CResult_COption_EventZDecodeErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 /// Checks if the given object is currently in the success state
3527 #[no_mangle]
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3529         o.result_ok
3530 }
3531 #[no_mangle]
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535         fn drop(&mut self) {
3536                 if self.result_ok {
3537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3539                         }
3540                 } else {
3541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3543                         }
3544                 }
3545         }
3546 }
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549                 let contents = if o.result_ok {
3550                         let result = unsafe { o.contents.result };
3551                         unsafe { o.contents.result = core::ptr::null_mut() };
3552                         CResult_COption_EventZDecodeErrorZPtr { result }
3553                 } else {
3554                         let err = unsafe { o.contents.err };
3555                         unsafe { o.contents.err = core::ptr::null_mut(); }
3556                         CResult_COption_EventZDecodeErrorZPtr { err }
3557                 };
3558                 Self {
3559                         contents,
3560                         result_ok: o.result_ok,
3561                 }
3562         }
3563 }
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565         fn clone(&self) -> Self {
3566                 if self.result_ok {
3567                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3569                         } }
3570                 } else {
3571                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3573                         } }
3574                 }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3581 #[repr(C)]
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585         /// The elements in the array.
3586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588         /// The number of elements pointed to by `data`.
3589         pub datalen: usize
3590 }
3591 impl CVec_MessageSendEventZ {
3592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593                 if self.datalen == 0 { return Vec::new(); }
3594                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595                 self.data = core::ptr::null_mut();
3596                 self.datalen = 0;
3597                 ret
3598         }
3599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3601         }
3602 }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605                 let datalen = v.len();
3606                 let data = Box::into_raw(v.into_boxed_slice());
3607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614         fn drop(&mut self) {
3615                 if self.datalen == 0 { return; }
3616                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3617         }
3618 }
3619 impl Clone for CVec_MessageSendEventZ {
3620         fn clone(&self) -> Self {
3621                 let mut res = Vec::new();
3622                 if self.datalen == 0 { return Self::from(res); }
3623                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3624                 Self::from(res)
3625         }
3626 }
3627 #[repr(C)]
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630         /// A pointer to the contents in the success state.
3631         /// Reading from this pointer when `result_ok` is not set is undefined.
3632         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633         /// A pointer to the contents in the error state.
3634         /// Reading from this pointer when `result_ok` is set is undefined.
3635         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3636 }
3637 #[repr(C)]
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643         /// `err` or `result` depending on the state of `result_ok`.
3644         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646         pub result_ok: bool,
3647 }
3648 #[no_mangle]
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651         CResult_FixedPenaltyScorerDecodeErrorZ {
3652                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653                         result: Box::into_raw(Box::new(o)),
3654                 },
3655                 result_ok: true,
3656         }
3657 }
3658 #[no_mangle]
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661         CResult_FixedPenaltyScorerDecodeErrorZ {
3662                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663                         err: Box::into_raw(Box::new(e)),
3664                 },
3665                 result_ok: false,
3666         }
3667 }
3668 /// Checks if the given object is currently in the success state
3669 #[no_mangle]
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3671         o.result_ok
3672 }
3673 #[no_mangle]
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3681                         }
3682                 } else {
3683                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3685                         }
3686                 }
3687         }
3688 }
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691                 let contents = if o.result_ok {
3692                         let result = unsafe { o.contents.result };
3693                         unsafe { o.contents.result = core::ptr::null_mut() };
3694                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3695                 } else {
3696                         let err = unsafe { o.contents.err };
3697                         unsafe { o.contents.err = core::ptr::null_mut(); }
3698                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3699                 };
3700                 Self {
3701                         contents,
3702                         result_ok: o.result_ok,
3703                 }
3704         }
3705 }
3706 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3707         fn clone(&self) -> Self {
3708                 if self.result_ok {
3709                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3710                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3711                         } }
3712                 } else {
3713                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3714                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3715                         } }
3716                 }
3717         }
3718 }
3719 #[no_mangle]
3720 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3721 /// but with all dynamically-allocated buffers duplicated in new buffers.
3722 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3723 #[repr(C)]
3724 /// The contents of CResult_ScoringParametersDecodeErrorZ
3725 pub union CResult_ScoringParametersDecodeErrorZPtr {
3726         /// A pointer to the contents in the success state.
3727         /// Reading from this pointer when `result_ok` is not set is undefined.
3728         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3729         /// A pointer to the contents in the error state.
3730         /// Reading from this pointer when `result_ok` is set is undefined.
3731         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3732 }
3733 #[repr(C)]
3734 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3735 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3737 pub struct CResult_ScoringParametersDecodeErrorZ {
3738         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3739         /// `err` or `result` depending on the state of `result_ok`.
3740         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3741         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3742         pub result_ok: bool,
3743 }
3744 #[no_mangle]
3745 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3746 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3747         CResult_ScoringParametersDecodeErrorZ {
3748                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3749                         result: Box::into_raw(Box::new(o)),
3750                 },
3751                 result_ok: true,
3752         }
3753 }
3754 #[no_mangle]
3755 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3756 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3757         CResult_ScoringParametersDecodeErrorZ {
3758                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3759                         err: Box::into_raw(Box::new(e)),
3760                 },
3761                 result_ok: false,
3762         }
3763 }
3764 /// Checks if the given object is currently in the success state
3765 #[no_mangle]
3766 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3767         o.result_ok
3768 }
3769 #[no_mangle]
3770 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3771 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3772 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3773         fn drop(&mut self) {
3774                 if self.result_ok {
3775                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3776                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3777                         }
3778                 } else {
3779                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3780                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3781                         }
3782                 }
3783         }
3784 }
3785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3786         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3787                 let contents = if o.result_ok {
3788                         let result = unsafe { o.contents.result };
3789                         unsafe { o.contents.result = core::ptr::null_mut() };
3790                         CResult_ScoringParametersDecodeErrorZPtr { result }
3791                 } else {
3792                         let err = unsafe { o.contents.err };
3793                         unsafe { o.contents.err = core::ptr::null_mut(); }
3794                         CResult_ScoringParametersDecodeErrorZPtr { err }
3795                 };
3796                 Self {
3797                         contents,
3798                         result_ok: o.result_ok,
3799                 }
3800         }
3801 }
3802 impl Clone for CResult_ScoringParametersDecodeErrorZ {
3803         fn clone(&self) -> Self {
3804                 if self.result_ok {
3805                         Self { result_ok: true, contents: CResult_ScoringParametersDecodeErrorZPtr {
3806                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ScoringParameters>::clone(unsafe { &*self.contents.result })))
3807                         } }
3808                 } else {
3809                         Self { result_ok: false, contents: CResult_ScoringParametersDecodeErrorZPtr {
3810                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3811                         } }
3812                 }
3813         }
3814 }
3815 #[no_mangle]
3816 /// Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
3817 /// but with all dynamically-allocated buffers duplicated in new buffers.
3818 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_clone(orig: &CResult_ScoringParametersDecodeErrorZ) -> CResult_ScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3819 #[repr(C)]
3820 /// The contents of CResult_ScorerDecodeErrorZ
3821 pub union CResult_ScorerDecodeErrorZPtr {
3822         /// A pointer to the contents in the success state.
3823         /// Reading from this pointer when `result_ok` is not set is undefined.
3824         pub result: *mut crate::lightning::routing::scoring::Scorer,
3825         /// A pointer to the contents in the error state.
3826         /// Reading from this pointer when `result_ok` is set is undefined.
3827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3828 }
3829 #[repr(C)]
3830 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3831 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3833 pub struct CResult_ScorerDecodeErrorZ {
3834         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3835         /// `err` or `result` depending on the state of `result_ok`.
3836         pub contents: CResult_ScorerDecodeErrorZPtr,
3837         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3838         pub result_ok: bool,
3839 }
3840 #[no_mangle]
3841 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3842 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3843         CResult_ScorerDecodeErrorZ {
3844                 contents: CResult_ScorerDecodeErrorZPtr {
3845                         result: Box::into_raw(Box::new(o)),
3846                 },
3847                 result_ok: true,
3848         }
3849 }
3850 #[no_mangle]
3851 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3852 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3853         CResult_ScorerDecodeErrorZ {
3854                 contents: CResult_ScorerDecodeErrorZPtr {
3855                         err: Box::into_raw(Box::new(e)),
3856                 },
3857                 result_ok: false,
3858         }
3859 }
3860 /// Checks if the given object is currently in the success state
3861 #[no_mangle]
3862 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3863         o.result_ok
3864 }
3865 #[no_mangle]
3866 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3867 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3868 impl Drop for CResult_ScorerDecodeErrorZ {
3869         fn drop(&mut self) {
3870                 if self.result_ok {
3871                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3872                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3873                         }
3874                 } else {
3875                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3876                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3877                         }
3878                 }
3879         }
3880 }
3881 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3882         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3883                 let contents = if o.result_ok {
3884                         let result = unsafe { o.contents.result };
3885                         unsafe { o.contents.result = core::ptr::null_mut() };
3886                         CResult_ScorerDecodeErrorZPtr { result }
3887                 } else {
3888                         let err = unsafe { o.contents.err };
3889                         unsafe { o.contents.err = core::ptr::null_mut(); }
3890                         CResult_ScorerDecodeErrorZPtr { err }
3891                 };
3892                 Self {
3893                         contents,
3894                         result_ok: o.result_ok,
3895                 }
3896         }
3897 }
3898 #[repr(C)]
3899 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3900 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3901         /// A pointer to the contents in the success state.
3902         /// Reading from this pointer when `result_ok` is not set is undefined.
3903         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3904         /// A pointer to the contents in the error state.
3905         /// Reading from this pointer when `result_ok` is set is undefined.
3906         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3907 }
3908 #[repr(C)]
3909 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3910 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3912 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3913         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3914         /// `err` or `result` depending on the state of `result_ok`.
3915         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3916         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3917         pub result_ok: bool,
3918 }
3919 #[no_mangle]
3920 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3921 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3922         CResult_ProbabilisticScorerDecodeErrorZ {
3923                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3924                         result: Box::into_raw(Box::new(o)),
3925                 },
3926                 result_ok: true,
3927         }
3928 }
3929 #[no_mangle]
3930 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3931 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3932         CResult_ProbabilisticScorerDecodeErrorZ {
3933                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3934                         err: Box::into_raw(Box::new(e)),
3935                 },
3936                 result_ok: false,
3937         }
3938 }
3939 /// Checks if the given object is currently in the success state
3940 #[no_mangle]
3941 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
3942         o.result_ok
3943 }
3944 #[no_mangle]
3945 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
3946 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
3947 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
3948         fn drop(&mut self) {
3949                 if self.result_ok {
3950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3952                         }
3953                 } else {
3954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3956                         }
3957                 }
3958         }
3959 }
3960 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
3961         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3962                 let contents = if o.result_ok {
3963                         let result = unsafe { o.contents.result };
3964                         unsafe { o.contents.result = core::ptr::null_mut() };
3965                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
3966                 } else {
3967                         let err = unsafe { o.contents.err };
3968                         unsafe { o.contents.err = core::ptr::null_mut(); }
3969                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
3970                 };
3971                 Self {
3972                         contents,
3973                         result_ok: o.result_ok,
3974                 }
3975         }
3976 }
3977 #[repr(C)]
3978 /// The contents of CResult_InitFeaturesDecodeErrorZ
3979 pub union CResult_InitFeaturesDecodeErrorZPtr {
3980         /// A pointer to the contents in the success state.
3981         /// Reading from this pointer when `result_ok` is not set is undefined.
3982         pub result: *mut crate::lightning::ln::features::InitFeatures,
3983         /// A pointer to the contents in the error state.
3984         /// Reading from this pointer when `result_ok` is set is undefined.
3985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3986 }
3987 #[repr(C)]
3988 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3989 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3991 pub struct CResult_InitFeaturesDecodeErrorZ {
3992         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3993         /// `err` or `result` depending on the state of `result_ok`.
3994         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3995         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3996         pub result_ok: bool,
3997 }
3998 #[no_mangle]
3999 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4000 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4001         CResult_InitFeaturesDecodeErrorZ {
4002                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4003                         result: Box::into_raw(Box::new(o)),
4004                 },
4005                 result_ok: true,
4006         }
4007 }
4008 #[no_mangle]
4009 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4010 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4011         CResult_InitFeaturesDecodeErrorZ {
4012                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4013                         err: Box::into_raw(Box::new(e)),
4014                 },
4015                 result_ok: false,
4016         }
4017 }
4018 /// Checks if the given object is currently in the success state
4019 #[no_mangle]
4020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4021         o.result_ok
4022 }
4023 #[no_mangle]
4024 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4025 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4026 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4027         fn drop(&mut self) {
4028                 if self.result_ok {
4029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4031                         }
4032                 } else {
4033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4035                         }
4036                 }
4037         }
4038 }
4039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4041                 let contents = if o.result_ok {
4042                         let result = unsafe { o.contents.result };
4043                         unsafe { o.contents.result = core::ptr::null_mut() };
4044                         CResult_InitFeaturesDecodeErrorZPtr { result }
4045                 } else {
4046                         let err = unsafe { o.contents.err };
4047                         unsafe { o.contents.err = core::ptr::null_mut(); }
4048                         CResult_InitFeaturesDecodeErrorZPtr { err }
4049                 };
4050                 Self {
4051                         contents,
4052                         result_ok: o.result_ok,
4053                 }
4054         }
4055 }
4056 #[repr(C)]
4057 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4058 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4059         /// A pointer to the contents in the success state.
4060         /// Reading from this pointer when `result_ok` is not set is undefined.
4061         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4062         /// A pointer to the contents in the error state.
4063         /// Reading from this pointer when `result_ok` is set is undefined.
4064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4065 }
4066 #[repr(C)]
4067 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4068 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4070 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4071         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4072         /// `err` or `result` depending on the state of `result_ok`.
4073         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4074         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4075         pub result_ok: bool,
4076 }
4077 #[no_mangle]
4078 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4079 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4080         CResult_ChannelFeaturesDecodeErrorZ {
4081                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4082                         result: Box::into_raw(Box::new(o)),
4083                 },
4084                 result_ok: true,
4085         }
4086 }
4087 #[no_mangle]
4088 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4089 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4090         CResult_ChannelFeaturesDecodeErrorZ {
4091                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4092                         err: Box::into_raw(Box::new(e)),
4093                 },
4094                 result_ok: false,
4095         }
4096 }
4097 /// Checks if the given object is currently in the success state
4098 #[no_mangle]
4099 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4100         o.result_ok
4101 }
4102 #[no_mangle]
4103 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4104 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4105 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4106         fn drop(&mut self) {
4107                 if self.result_ok {
4108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4110                         }
4111                 } else {
4112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4114                         }
4115                 }
4116         }
4117 }
4118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4120                 let contents = if o.result_ok {
4121                         let result = unsafe { o.contents.result };
4122                         unsafe { o.contents.result = core::ptr::null_mut() };
4123                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4124                 } else {
4125                         let err = unsafe { o.contents.err };
4126                         unsafe { o.contents.err = core::ptr::null_mut(); }
4127                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4128                 };
4129                 Self {
4130                         contents,
4131                         result_ok: o.result_ok,
4132                 }
4133         }
4134 }
4135 #[repr(C)]
4136 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4137 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4138         /// A pointer to the contents in the success state.
4139         /// Reading from this pointer when `result_ok` is not set is undefined.
4140         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4141         /// A pointer to the contents in the error state.
4142         /// Reading from this pointer when `result_ok` is set is undefined.
4143         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4144 }
4145 #[repr(C)]
4146 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4147 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4149 pub struct CResult_NodeFeaturesDecodeErrorZ {
4150         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4151         /// `err` or `result` depending on the state of `result_ok`.
4152         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4153         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4154         pub result_ok: bool,
4155 }
4156 #[no_mangle]
4157 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4158 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4159         CResult_NodeFeaturesDecodeErrorZ {
4160                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4161                         result: Box::into_raw(Box::new(o)),
4162                 },
4163                 result_ok: true,
4164         }
4165 }
4166 #[no_mangle]
4167 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4168 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4169         CResult_NodeFeaturesDecodeErrorZ {
4170                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4171                         err: Box::into_raw(Box::new(e)),
4172                 },
4173                 result_ok: false,
4174         }
4175 }
4176 /// Checks if the given object is currently in the success state
4177 #[no_mangle]
4178 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4179         o.result_ok
4180 }
4181 #[no_mangle]
4182 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4183 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4184 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4185         fn drop(&mut self) {
4186                 if self.result_ok {
4187                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4189                         }
4190                 } else {
4191                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4193                         }
4194                 }
4195         }
4196 }
4197 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4198         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4199                 let contents = if o.result_ok {
4200                         let result = unsafe { o.contents.result };
4201                         unsafe { o.contents.result = core::ptr::null_mut() };
4202                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4203                 } else {
4204                         let err = unsafe { o.contents.err };
4205                         unsafe { o.contents.err = core::ptr::null_mut(); }
4206                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4207                 };
4208                 Self {
4209                         contents,
4210                         result_ok: o.result_ok,
4211                 }
4212         }
4213 }
4214 #[repr(C)]
4215 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4216 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4217         /// A pointer to the contents in the success state.
4218         /// Reading from this pointer when `result_ok` is not set is undefined.
4219         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4220         /// A pointer to the contents in the error state.
4221         /// Reading from this pointer when `result_ok` is set is undefined.
4222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4223 }
4224 #[repr(C)]
4225 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4226 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4228 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4229         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4230         /// `err` or `result` depending on the state of `result_ok`.
4231         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4232         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4233         pub result_ok: bool,
4234 }
4235 #[no_mangle]
4236 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4237 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4238         CResult_InvoiceFeaturesDecodeErrorZ {
4239                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4240                         result: Box::into_raw(Box::new(o)),
4241                 },
4242                 result_ok: true,
4243         }
4244 }
4245 #[no_mangle]
4246 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4247 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4248         CResult_InvoiceFeaturesDecodeErrorZ {
4249                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4250                         err: Box::into_raw(Box::new(e)),
4251                 },
4252                 result_ok: false,
4253         }
4254 }
4255 /// Checks if the given object is currently in the success state
4256 #[no_mangle]
4257 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4258         o.result_ok
4259 }
4260 #[no_mangle]
4261 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4262 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4263 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4264         fn drop(&mut self) {
4265                 if self.result_ok {
4266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4268                         }
4269                 } else {
4270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4272                         }
4273                 }
4274         }
4275 }
4276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4277         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4278                 let contents = if o.result_ok {
4279                         let result = unsafe { o.contents.result };
4280                         unsafe { o.contents.result = core::ptr::null_mut() };
4281                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4282                 } else {
4283                         let err = unsafe { o.contents.err };
4284                         unsafe { o.contents.err = core::ptr::null_mut(); }
4285                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4286                 };
4287                 Self {
4288                         contents,
4289                         result_ok: o.result_ok,
4290                 }
4291         }
4292 }
4293 #[repr(C)]
4294 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4295 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4296         /// A pointer to the contents in the success state.
4297         /// Reading from this pointer when `result_ok` is not set is undefined.
4298         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4299         /// A pointer to the contents in the error state.
4300         /// Reading from this pointer when `result_ok` is set is undefined.
4301         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4302 }
4303 #[repr(C)]
4304 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4308         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4309         /// `err` or `result` depending on the state of `result_ok`.
4310         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4311         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4312         pub result_ok: bool,
4313 }
4314 #[no_mangle]
4315 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4317         CResult_ChannelTypeFeaturesDecodeErrorZ {
4318                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4319                         result: Box::into_raw(Box::new(o)),
4320                 },
4321                 result_ok: true,
4322         }
4323 }
4324 #[no_mangle]
4325 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4327         CResult_ChannelTypeFeaturesDecodeErrorZ {
4328                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4329                         err: Box::into_raw(Box::new(e)),
4330                 },
4331                 result_ok: false,
4332         }
4333 }
4334 /// Checks if the given object is currently in the success state
4335 #[no_mangle]
4336 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4337         o.result_ok
4338 }
4339 #[no_mangle]
4340 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4341 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4342 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4343         fn drop(&mut self) {
4344                 if self.result_ok {
4345                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4347                         }
4348                 } else {
4349                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4351                         }
4352                 }
4353         }
4354 }
4355 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4356         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357                 let contents = if o.result_ok {
4358                         let result = unsafe { o.contents.result };
4359                         unsafe { o.contents.result = core::ptr::null_mut() };
4360                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4361                 } else {
4362                         let err = unsafe { o.contents.err };
4363                         unsafe { o.contents.err = core::ptr::null_mut(); }
4364                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4365                 };
4366                 Self {
4367                         contents,
4368                         result_ok: o.result_ok,
4369                 }
4370         }
4371 }
4372 #[repr(C)]
4373 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4374 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4375         /// A pointer to the contents in the success state.
4376         /// Reading from this pointer when `result_ok` is not set is undefined.
4377         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4378         /// A pointer to the contents in the error state.
4379         /// Reading from this pointer when `result_ok` is set is undefined.
4380         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4381 }
4382 #[repr(C)]
4383 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4384 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4385 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4386 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4387         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4388         /// `err` or `result` depending on the state of `result_ok`.
4389         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4390         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4391         pub result_ok: bool,
4392 }
4393 #[no_mangle]
4394 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4395 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4396         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4397                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4398                         result: Box::into_raw(Box::new(o)),
4399                 },
4400                 result_ok: true,
4401         }
4402 }
4403 #[no_mangle]
4404 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4405 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4406         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4407                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4408                         err: Box::into_raw(Box::new(e)),
4409                 },
4410                 result_ok: false,
4411         }
4412 }
4413 /// Checks if the given object is currently in the success state
4414 #[no_mangle]
4415 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4416         o.result_ok
4417 }
4418 #[no_mangle]
4419 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4420 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4421 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4422         fn drop(&mut self) {
4423                 if self.result_ok {
4424                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4425                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4426                         }
4427                 } else {
4428                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4429                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4430                         }
4431                 }
4432         }
4433 }
4434 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4435         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4436                 let contents = if o.result_ok {
4437                         let result = unsafe { o.contents.result };
4438                         unsafe { o.contents.result = core::ptr::null_mut() };
4439                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4440                 } else {
4441                         let err = unsafe { o.contents.err };
4442                         unsafe { o.contents.err = core::ptr::null_mut(); }
4443                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4444                 };
4445                 Self {
4446                         contents,
4447                         result_ok: o.result_ok,
4448                 }
4449         }
4450 }
4451 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4452         fn clone(&self) -> Self {
4453                 if self.result_ok {
4454                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4455                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4456                         } }
4457                 } else {
4458                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4459                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4460                         } }
4461                 }
4462         }
4463 }
4464 #[no_mangle]
4465 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4466 /// but with all dynamically-allocated buffers duplicated in new buffers.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4468 #[repr(C)]
4469 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4470 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4471         /// A pointer to the contents in the success state.
4472         /// Reading from this pointer when `result_ok` is not set is undefined.
4473         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4474         /// A pointer to the contents in the error state.
4475         /// Reading from this pointer when `result_ok` is set is undefined.
4476         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4477 }
4478 #[repr(C)]
4479 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4480 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4482 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4483         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4484         /// `err` or `result` depending on the state of `result_ok`.
4485         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4486         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4487         pub result_ok: bool,
4488 }
4489 #[no_mangle]
4490 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4491 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4492         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4493                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4494                         result: Box::into_raw(Box::new(o)),
4495                 },
4496                 result_ok: true,
4497         }
4498 }
4499 #[no_mangle]
4500 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4501 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4502         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4503                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4504                         err: Box::into_raw(Box::new(e)),
4505                 },
4506                 result_ok: false,
4507         }
4508 }
4509 /// Checks if the given object is currently in the success state
4510 #[no_mangle]
4511 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4512         o.result_ok
4513 }
4514 #[no_mangle]
4515 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4516 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4517 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4518         fn drop(&mut self) {
4519                 if self.result_ok {
4520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4522                         }
4523                 } else {
4524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4526                         }
4527                 }
4528         }
4529 }
4530 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4532                 let contents = if o.result_ok {
4533                         let result = unsafe { o.contents.result };
4534                         unsafe { o.contents.result = core::ptr::null_mut() };
4535                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4536                 } else {
4537                         let err = unsafe { o.contents.err };
4538                         unsafe { o.contents.err = core::ptr::null_mut(); }
4539                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4540                 };
4541                 Self {
4542                         contents,
4543                         result_ok: o.result_ok,
4544                 }
4545         }
4546 }
4547 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4548         fn clone(&self) -> Self {
4549                 if self.result_ok {
4550                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4551                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4552                         } }
4553                 } else {
4554                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4556                         } }
4557                 }
4558         }
4559 }
4560 #[no_mangle]
4561 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4562 /// but with all dynamically-allocated buffers duplicated in new buffers.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4564 #[repr(C)]
4565 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4566 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4567         /// A pointer to the contents in the success state.
4568         /// Reading from this pointer when `result_ok` is not set is undefined.
4569         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4570         /// A pointer to the contents in the error state.
4571         /// Reading from this pointer when `result_ok` is set is undefined.
4572         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4573 }
4574 #[repr(C)]
4575 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4576 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4578 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4579         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4580         /// `err` or `result` depending on the state of `result_ok`.
4581         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4582         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4583         pub result_ok: bool,
4584 }
4585 #[no_mangle]
4586 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4587 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4588         CResult_SpendableOutputDescriptorDecodeErrorZ {
4589                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4590                         result: Box::into_raw(Box::new(o)),
4591                 },
4592                 result_ok: true,
4593         }
4594 }
4595 #[no_mangle]
4596 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4597 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4598         CResult_SpendableOutputDescriptorDecodeErrorZ {
4599                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4600                         err: Box::into_raw(Box::new(e)),
4601                 },
4602                 result_ok: false,
4603         }
4604 }
4605 /// Checks if the given object is currently in the success state
4606 #[no_mangle]
4607 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4608         o.result_ok
4609 }
4610 #[no_mangle]
4611 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4612 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4613 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4614         fn drop(&mut self) {
4615                 if self.result_ok {
4616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4618                         }
4619                 } else {
4620                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4621                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4622                         }
4623                 }
4624         }
4625 }
4626 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4627         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4628                 let contents = if o.result_ok {
4629                         let result = unsafe { o.contents.result };
4630                         unsafe { o.contents.result = core::ptr::null_mut() };
4631                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4632                 } else {
4633                         let err = unsafe { o.contents.err };
4634                         unsafe { o.contents.err = core::ptr::null_mut(); }
4635                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4636                 };
4637                 Self {
4638                         contents,
4639                         result_ok: o.result_ok,
4640                 }
4641         }
4642 }
4643 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4644         fn clone(&self) -> Self {
4645                 if self.result_ok {
4646                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4647                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4648                         } }
4649                 } else {
4650                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4651                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4652                         } }
4653                 }
4654         }
4655 }
4656 #[no_mangle]
4657 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4658 /// but with all dynamically-allocated buffers duplicated in new buffers.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4660 #[repr(C)]
4661 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4662 /// This corresponds to std::vector in C++
4663 pub struct CVec_PaymentPreimageZ {
4664         /// The elements in the array.
4665         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4666         pub data: *mut crate::c_types::ThirtyTwoBytes,
4667         /// The number of elements pointed to by `data`.
4668         pub datalen: usize
4669 }
4670 impl CVec_PaymentPreimageZ {
4671         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4672                 if self.datalen == 0 { return Vec::new(); }
4673                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4674                 self.data = core::ptr::null_mut();
4675                 self.datalen = 0;
4676                 ret
4677         }
4678         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4679                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4680         }
4681 }
4682 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4683         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4684                 let datalen = v.len();
4685                 let data = Box::into_raw(v.into_boxed_slice());
4686                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4687         }
4688 }
4689 #[no_mangle]
4690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4691 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4692 impl Drop for CVec_PaymentPreimageZ {
4693         fn drop(&mut self) {
4694                 if self.datalen == 0 { return; }
4695                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4696         }
4697 }
4698 impl Clone for CVec_PaymentPreimageZ {
4699         fn clone(&self) -> Self {
4700                 let mut res = Vec::new();
4701                 if self.datalen == 0 { return Self::from(res); }
4702                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4703                 Self::from(res)
4704         }
4705 }
4706 #[repr(C)]
4707 /// A tuple of 2 elements. See the individual fields for the types contained.
4708 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4709         /// The element at position 0
4710         pub a: crate::c_types::Signature,
4711         /// The element at position 1
4712         pub b: crate::c_types::derived::CVec_SignatureZ,
4713 }
4714 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4715         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4716                 Self {
4717                         a: tup.0,
4718                         b: tup.1,
4719                 }
4720         }
4721 }
4722 impl C2Tuple_SignatureCVec_SignatureZZ {
4723         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4724                 (self.a, self.b)
4725         }
4726 }
4727 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4728         fn clone(&self) -> Self {
4729                 Self {
4730                         a: Clone::clone(&self.a),
4731                         b: Clone::clone(&self.b),
4732                 }
4733         }
4734 }
4735 #[no_mangle]
4736 /// Creates a new tuple which has the same data as `orig`
4737 /// but with all dynamically-allocated buffers duplicated in new buffers.
4738 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4739 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4740 #[no_mangle]
4741 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4742         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4743 }
4744
4745 #[no_mangle]
4746 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4747 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4748 #[repr(C)]
4749 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4750 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4751         /// A pointer to the contents in the success state.
4752         /// Reading from this pointer when `result_ok` is not set is undefined.
4753         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4754         /// Note that this value is always NULL, as there are no contents in the Err variant
4755         pub err: *mut core::ffi::c_void,
4756 }
4757 #[repr(C)]
4758 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4759 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4761 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4762         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4763         /// `err` or `result` depending on the state of `result_ok`.
4764         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4765         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4766         pub result_ok: bool,
4767 }
4768 #[no_mangle]
4769 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4770 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4771         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4772                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4773                         result: Box::into_raw(Box::new(o)),
4774                 },
4775                 result_ok: true,
4776         }
4777 }
4778 #[no_mangle]
4779 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4780 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4781         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4782                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4783                         err: core::ptr::null_mut(),
4784                 },
4785                 result_ok: false,
4786         }
4787 }
4788 /// Checks if the given object is currently in the success state
4789 #[no_mangle]
4790 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4791         o.result_ok
4792 }
4793 #[no_mangle]
4794 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4795 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4796 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4797         fn drop(&mut self) {
4798                 if self.result_ok {
4799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4801                         }
4802                 } else {
4803                 }
4804         }
4805 }
4806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4807         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4808                 let contents = if o.result_ok {
4809                         let result = unsafe { o.contents.result };
4810                         unsafe { o.contents.result = core::ptr::null_mut() };
4811                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4812                 } else {
4813                         let _ = unsafe { Box::from_raw(o.contents.err) };
4814                         o.contents.err = core::ptr::null_mut();
4815                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4816                 };
4817                 Self {
4818                         contents,
4819                         result_ok: o.result_ok,
4820                 }
4821         }
4822 }
4823 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824         fn clone(&self) -> Self {
4825                 if self.result_ok {
4826                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4827                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4828                         } }
4829                 } else {
4830                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4831                                 err: core::ptr::null_mut()
4832                         } }
4833                 }
4834         }
4835 }
4836 #[no_mangle]
4837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4838 /// but with all dynamically-allocated buffers duplicated in new buffers.
4839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4840 #[repr(C)]
4841 /// The contents of CResult_SignatureNoneZ
4842 pub union CResult_SignatureNoneZPtr {
4843         /// A pointer to the contents in the success state.
4844         /// Reading from this pointer when `result_ok` is not set is undefined.
4845         pub result: *mut crate::c_types::Signature,
4846         /// Note that this value is always NULL, as there are no contents in the Err variant
4847         pub err: *mut core::ffi::c_void,
4848 }
4849 #[repr(C)]
4850 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::Signature on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_SignatureNoneZ {
4854         /// The contents of this CResult_SignatureNoneZ, accessible via either
4855         /// `err` or `result` depending on the state of `result_ok`.
4856         pub contents: CResult_SignatureNoneZPtr,
4857         /// Whether this CResult_SignatureNoneZ represents a success state.
4858         pub result_ok: bool,
4859 }
4860 #[no_mangle]
4861 /// Creates a new CResult_SignatureNoneZ in the success state.
4862 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4863         CResult_SignatureNoneZ {
4864                 contents: CResult_SignatureNoneZPtr {
4865                         result: Box::into_raw(Box::new(o)),
4866                 },
4867                 result_ok: true,
4868         }
4869 }
4870 #[no_mangle]
4871 /// Creates a new CResult_SignatureNoneZ in the error state.
4872 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4873         CResult_SignatureNoneZ {
4874                 contents: CResult_SignatureNoneZPtr {
4875                         err: core::ptr::null_mut(),
4876                 },
4877                 result_ok: false,
4878         }
4879 }
4880 /// Checks if the given object is currently in the success state
4881 #[no_mangle]
4882 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4883         o.result_ok
4884 }
4885 #[no_mangle]
4886 /// Frees any resources used by the CResult_SignatureNoneZ.
4887 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4888 impl Drop for CResult_SignatureNoneZ {
4889         fn drop(&mut self) {
4890                 if self.result_ok {
4891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4893                         }
4894                 } else {
4895                 }
4896         }
4897 }
4898 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4899         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4900                 let contents = if o.result_ok {
4901                         let result = unsafe { o.contents.result };
4902                         unsafe { o.contents.result = core::ptr::null_mut() };
4903                         CResult_SignatureNoneZPtr { result }
4904                 } else {
4905                         let _ = unsafe { Box::from_raw(o.contents.err) };
4906                         o.contents.err = core::ptr::null_mut();
4907                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4908                 };
4909                 Self {
4910                         contents,
4911                         result_ok: o.result_ok,
4912                 }
4913         }
4914 }
4915 impl Clone for CResult_SignatureNoneZ {
4916         fn clone(&self) -> Self {
4917                 if self.result_ok {
4918                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4919                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4920                         } }
4921                 } else {
4922                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4923                                 err: core::ptr::null_mut()
4924                         } }
4925                 }
4926         }
4927 }
4928 #[no_mangle]
4929 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4932 #[repr(C)]
4933 /// A tuple of 2 elements. See the individual fields for the types contained.
4934 pub struct C2Tuple_SignatureSignatureZ {
4935         /// The element at position 0
4936         pub a: crate::c_types::Signature,
4937         /// The element at position 1
4938         pub b: crate::c_types::Signature,
4939 }
4940 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4941         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4942                 Self {
4943                         a: tup.0,
4944                         b: tup.1,
4945                 }
4946         }
4947 }
4948 impl C2Tuple_SignatureSignatureZ {
4949         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4950                 (self.a, self.b)
4951         }
4952 }
4953 impl Clone for C2Tuple_SignatureSignatureZ {
4954         fn clone(&self) -> Self {
4955                 Self {
4956                         a: Clone::clone(&self.a),
4957                         b: Clone::clone(&self.b),
4958                 }
4959         }
4960 }
4961 #[no_mangle]
4962 /// Creates a new tuple which has the same data as `orig`
4963 /// but with all dynamically-allocated buffers duplicated in new buffers.
4964 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4965 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4966 #[no_mangle]
4967 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4968         C2Tuple_SignatureSignatureZ { a, b, }
4969 }
4970
4971 #[no_mangle]
4972 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4973 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4974 #[repr(C)]
4975 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4976 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4977         /// A pointer to the contents in the success state.
4978         /// Reading from this pointer when `result_ok` is not set is undefined.
4979         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4980         /// Note that this value is always NULL, as there are no contents in the Err variant
4981         pub err: *mut core::ffi::c_void,
4982 }
4983 #[repr(C)]
4984 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4985 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4987 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4988         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4989         /// `err` or `result` depending on the state of `result_ok`.
4990         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4991         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4992         pub result_ok: bool,
4993 }
4994 #[no_mangle]
4995 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4996 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4997         CResult_C2Tuple_SignatureSignatureZNoneZ {
4998                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4999                         result: Box::into_raw(Box::new(o)),
5000                 },
5001                 result_ok: true,
5002         }
5003 }
5004 #[no_mangle]
5005 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5006 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5007         CResult_C2Tuple_SignatureSignatureZNoneZ {
5008                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5009                         err: core::ptr::null_mut(),
5010                 },
5011                 result_ok: false,
5012         }
5013 }
5014 /// Checks if the given object is currently in the success state
5015 #[no_mangle]
5016 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5017         o.result_ok
5018 }
5019 #[no_mangle]
5020 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5021 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5022 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5023         fn drop(&mut self) {
5024                 if self.result_ok {
5025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5027                         }
5028                 } else {
5029                 }
5030         }
5031 }
5032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5033         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5034                 let contents = if o.result_ok {
5035                         let result = unsafe { o.contents.result };
5036                         unsafe { o.contents.result = core::ptr::null_mut() };
5037                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5038                 } else {
5039                         let _ = unsafe { Box::from_raw(o.contents.err) };
5040                         o.contents.err = core::ptr::null_mut();
5041                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5042                 };
5043                 Self {
5044                         contents,
5045                         result_ok: o.result_ok,
5046                 }
5047         }
5048 }
5049 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5050         fn clone(&self) -> Self {
5051                 if self.result_ok {
5052                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5053                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5054                         } }
5055                 } else {
5056                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5057                                 err: core::ptr::null_mut()
5058                         } }
5059                 }
5060         }
5061 }
5062 #[no_mangle]
5063 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5064 /// but with all dynamically-allocated buffers duplicated in new buffers.
5065 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5066 #[repr(C)]
5067 /// The contents of CResult_SecretKeyNoneZ
5068 pub union CResult_SecretKeyNoneZPtr {
5069         /// A pointer to the contents in the success state.
5070         /// Reading from this pointer when `result_ok` is not set is undefined.
5071         pub result: *mut crate::c_types::SecretKey,
5072         /// Note that this value is always NULL, as there are no contents in the Err variant
5073         pub err: *mut core::ffi::c_void,
5074 }
5075 #[repr(C)]
5076 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::SecretKey on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_SecretKeyNoneZ {
5080         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5081         /// `err` or `result` depending on the state of `result_ok`.
5082         pub contents: CResult_SecretKeyNoneZPtr,
5083         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5084         pub result_ok: bool,
5085 }
5086 #[no_mangle]
5087 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5088 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5089         CResult_SecretKeyNoneZ {
5090                 contents: CResult_SecretKeyNoneZPtr {
5091                         result: Box::into_raw(Box::new(o)),
5092                 },
5093                 result_ok: true,
5094         }
5095 }
5096 #[no_mangle]
5097 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5098 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5099         CResult_SecretKeyNoneZ {
5100                 contents: CResult_SecretKeyNoneZPtr {
5101                         err: core::ptr::null_mut(),
5102                 },
5103                 result_ok: false,
5104         }
5105 }
5106 /// Checks if the given object is currently in the success state
5107 #[no_mangle]
5108 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5109         o.result_ok
5110 }
5111 #[no_mangle]
5112 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5113 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5114 impl Drop for CResult_SecretKeyNoneZ {
5115         fn drop(&mut self) {
5116                 if self.result_ok {
5117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5119                         }
5120                 } else {
5121                 }
5122         }
5123 }
5124 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5125         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5126                 let contents = if o.result_ok {
5127                         let result = unsafe { o.contents.result };
5128                         unsafe { o.contents.result = core::ptr::null_mut() };
5129                         CResult_SecretKeyNoneZPtr { result }
5130                 } else {
5131                         let _ = unsafe { Box::from_raw(o.contents.err) };
5132                         o.contents.err = core::ptr::null_mut();
5133                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5134                 };
5135                 Self {
5136                         contents,
5137                         result_ok: o.result_ok,
5138                 }
5139         }
5140 }
5141 impl Clone for CResult_SecretKeyNoneZ {
5142         fn clone(&self) -> Self {
5143                 if self.result_ok {
5144                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5145                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5146                         } }
5147                 } else {
5148                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5149                                 err: core::ptr::null_mut()
5150                         } }
5151                 }
5152         }
5153 }
5154 #[no_mangle]
5155 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5158 #[repr(C)]
5159 /// The contents of CResult_SignDecodeErrorZ
5160 pub union CResult_SignDecodeErrorZPtr {
5161         /// A pointer to the contents in the success state.
5162         /// Reading from this pointer when `result_ok` is not set is undefined.
5163         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5164         /// A pointer to the contents in the error state.
5165         /// Reading from this pointer when `result_ok` is set is undefined.
5166         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5167 }
5168 #[repr(C)]
5169 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SignDecodeErrorZ {
5173         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5174         /// `err` or `result` depending on the state of `result_ok`.
5175         pub contents: CResult_SignDecodeErrorZPtr,
5176         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5177         pub result_ok: bool,
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5182         CResult_SignDecodeErrorZ {
5183                 contents: CResult_SignDecodeErrorZPtr {
5184                         result: Box::into_raw(Box::new(o)),
5185                 },
5186                 result_ok: true,
5187         }
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5192         CResult_SignDecodeErrorZ {
5193                 contents: CResult_SignDecodeErrorZPtr {
5194                         err: Box::into_raw(Box::new(e)),
5195                 },
5196                 result_ok: false,
5197         }
5198 }
5199 /// Checks if the given object is currently in the success state
5200 #[no_mangle]
5201 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5202         o.result_ok
5203 }
5204 #[no_mangle]
5205 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5206 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5207 impl Drop for CResult_SignDecodeErrorZ {
5208         fn drop(&mut self) {
5209                 if self.result_ok {
5210                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5212                         }
5213                 } else {
5214                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5216                         }
5217                 }
5218         }
5219 }
5220 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5221         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222                 let contents = if o.result_ok {
5223                         let result = unsafe { o.contents.result };
5224                         unsafe { o.contents.result = core::ptr::null_mut() };
5225                         CResult_SignDecodeErrorZPtr { result }
5226                 } else {
5227                         let err = unsafe { o.contents.err };
5228                         unsafe { o.contents.err = core::ptr::null_mut(); }
5229                         CResult_SignDecodeErrorZPtr { err }
5230                 };
5231                 Self {
5232                         contents,
5233                         result_ok: o.result_ok,
5234                 }
5235         }
5236 }
5237 impl Clone for CResult_SignDecodeErrorZ {
5238         fn clone(&self) -> Self {
5239                 if self.result_ok {
5240                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5241                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5242                         } }
5243                 } else {
5244                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5245                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5246                         } }
5247                 }
5248         }
5249 }
5250 #[no_mangle]
5251 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5254 #[repr(C)]
5255 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5256 /// This corresponds to std::vector in C++
5257 pub struct CVec_u5Z {
5258         /// The elements in the array.
5259         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5260         pub data: *mut crate::c_types::u5,
5261         /// The number of elements pointed to by `data`.
5262         pub datalen: usize
5263 }
5264 impl CVec_u5Z {
5265         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5266                 if self.datalen == 0 { return Vec::new(); }
5267                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5268                 self.data = core::ptr::null_mut();
5269                 self.datalen = 0;
5270                 ret
5271         }
5272         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5273                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5274         }
5275 }
5276 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5277         fn from(v: Vec<crate::c_types::u5>) -> Self {
5278                 let datalen = v.len();
5279                 let data = Box::into_raw(v.into_boxed_slice());
5280                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5281         }
5282 }
5283 #[no_mangle]
5284 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5285 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5286 impl Drop for CVec_u5Z {
5287         fn drop(&mut self) {
5288                 if self.datalen == 0 { return; }
5289                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5290         }
5291 }
5292 impl Clone for CVec_u5Z {
5293         fn clone(&self) -> Self {
5294                 let mut res = Vec::new();
5295                 if self.datalen == 0 { return Self::from(res); }
5296                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5297                 Self::from(res)
5298         }
5299 }
5300 #[repr(C)]
5301 /// The contents of CResult_RecoverableSignatureNoneZ
5302 pub union CResult_RecoverableSignatureNoneZPtr {
5303         /// A pointer to the contents in the success state.
5304         /// Reading from this pointer when `result_ok` is not set is undefined.
5305         pub result: *mut crate::c_types::RecoverableSignature,
5306         /// Note that this value is always NULL, as there are no contents in the Err variant
5307         pub err: *mut core::ffi::c_void,
5308 }
5309 #[repr(C)]
5310 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5311 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5312 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5313 pub struct CResult_RecoverableSignatureNoneZ {
5314         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5315         /// `err` or `result` depending on the state of `result_ok`.
5316         pub contents: CResult_RecoverableSignatureNoneZPtr,
5317         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5318         pub result_ok: bool,
5319 }
5320 #[no_mangle]
5321 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5322 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5323         CResult_RecoverableSignatureNoneZ {
5324                 contents: CResult_RecoverableSignatureNoneZPtr {
5325                         result: Box::into_raw(Box::new(o)),
5326                 },
5327                 result_ok: true,
5328         }
5329 }
5330 #[no_mangle]
5331 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5332 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5333         CResult_RecoverableSignatureNoneZ {
5334                 contents: CResult_RecoverableSignatureNoneZPtr {
5335                         err: core::ptr::null_mut(),
5336                 },
5337                 result_ok: false,
5338         }
5339 }
5340 /// Checks if the given object is currently in the success state
5341 #[no_mangle]
5342 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5343         o.result_ok
5344 }
5345 #[no_mangle]
5346 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5347 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5348 impl Drop for CResult_RecoverableSignatureNoneZ {
5349         fn drop(&mut self) {
5350                 if self.result_ok {
5351                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5352                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5353                         }
5354                 } else {
5355                 }
5356         }
5357 }
5358 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5359         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5360                 let contents = if o.result_ok {
5361                         let result = unsafe { o.contents.result };
5362                         unsafe { o.contents.result = core::ptr::null_mut() };
5363                         CResult_RecoverableSignatureNoneZPtr { result }
5364                 } else {
5365                         let _ = unsafe { Box::from_raw(o.contents.err) };
5366                         o.contents.err = core::ptr::null_mut();
5367                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5368                 };
5369                 Self {
5370                         contents,
5371                         result_ok: o.result_ok,
5372                 }
5373         }
5374 }
5375 impl Clone for CResult_RecoverableSignatureNoneZ {
5376         fn clone(&self) -> Self {
5377                 if self.result_ok {
5378                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5379                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5380                         } }
5381                 } else {
5382                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5383                                 err: core::ptr::null_mut()
5384                         } }
5385                 }
5386         }
5387 }
5388 #[no_mangle]
5389 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5390 /// but with all dynamically-allocated buffers duplicated in new buffers.
5391 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5392 #[repr(C)]
5393 /// A dynamically-allocated array of u8s of arbitrary size.
5394 /// This corresponds to std::vector in C++
5395 pub struct CVec_u8Z {
5396         /// The elements in the array.
5397         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5398         pub data: *mut u8,
5399         /// The number of elements pointed to by `data`.
5400         pub datalen: usize
5401 }
5402 impl CVec_u8Z {
5403         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5404                 if self.datalen == 0 { return Vec::new(); }
5405                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5406                 self.data = core::ptr::null_mut();
5407                 self.datalen = 0;
5408                 ret
5409         }
5410         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5411                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5412         }
5413 }
5414 impl From<Vec<u8>> for CVec_u8Z {
5415         fn from(v: Vec<u8>) -> Self {
5416                 let datalen = v.len();
5417                 let data = Box::into_raw(v.into_boxed_slice());
5418                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5419         }
5420 }
5421 #[no_mangle]
5422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5423 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5424 impl Drop for CVec_u8Z {
5425         fn drop(&mut self) {
5426                 if self.datalen == 0 { return; }
5427                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5428         }
5429 }
5430 impl Clone for CVec_u8Z {
5431         fn clone(&self) -> Self {
5432                 let mut res = Vec::new();
5433                 if self.datalen == 0 { return Self::from(res); }
5434                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5435                 Self::from(res)
5436         }
5437 }
5438 #[repr(C)]
5439 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5440 /// This corresponds to std::vector in C++
5441 pub struct CVec_CVec_u8ZZ {
5442         /// The elements in the array.
5443         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5444         pub data: *mut crate::c_types::derived::CVec_u8Z,
5445         /// The number of elements pointed to by `data`.
5446         pub datalen: usize
5447 }
5448 impl CVec_CVec_u8ZZ {
5449         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5450                 if self.datalen == 0 { return Vec::new(); }
5451                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5452                 self.data = core::ptr::null_mut();
5453                 self.datalen = 0;
5454                 ret
5455         }
5456         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5457                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5458         }
5459 }
5460 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5461         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5462                 let datalen = v.len();
5463                 let data = Box::into_raw(v.into_boxed_slice());
5464                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5465         }
5466 }
5467 #[no_mangle]
5468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5469 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5470 impl Drop for CVec_CVec_u8ZZ {
5471         fn drop(&mut self) {
5472                 if self.datalen == 0 { return; }
5473                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5474         }
5475 }
5476 impl Clone for CVec_CVec_u8ZZ {
5477         fn clone(&self) -> Self {
5478                 let mut res = Vec::new();
5479                 if self.datalen == 0 { return Self::from(res); }
5480                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5481                 Self::from(res)
5482         }
5483 }
5484 #[repr(C)]
5485 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5486 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5487         /// A pointer to the contents in the success state.
5488         /// Reading from this pointer when `result_ok` is not set is undefined.
5489         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5490         /// Note that this value is always NULL, as there are no contents in the Err variant
5491         pub err: *mut core::ffi::c_void,
5492 }
5493 #[repr(C)]
5494 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5495 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5497 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5498         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5499         /// `err` or `result` depending on the state of `result_ok`.
5500         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5501         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5502         pub result_ok: bool,
5503 }
5504 #[no_mangle]
5505 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5506 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5507         CResult_CVec_CVec_u8ZZNoneZ {
5508                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5509                         result: Box::into_raw(Box::new(o)),
5510                 },
5511                 result_ok: true,
5512         }
5513 }
5514 #[no_mangle]
5515 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5516 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5517         CResult_CVec_CVec_u8ZZNoneZ {
5518                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5519                         err: core::ptr::null_mut(),
5520                 },
5521                 result_ok: false,
5522         }
5523 }
5524 /// Checks if the given object is currently in the success state
5525 #[no_mangle]
5526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5527         o.result_ok
5528 }
5529 #[no_mangle]
5530 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5531 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5532 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5533         fn drop(&mut self) {
5534                 if self.result_ok {
5535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5537                         }
5538                 } else {
5539                 }
5540         }
5541 }
5542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5543         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5544                 let contents = if o.result_ok {
5545                         let result = unsafe { o.contents.result };
5546                         unsafe { o.contents.result = core::ptr::null_mut() };
5547                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5548                 } else {
5549                         let _ = unsafe { Box::from_raw(o.contents.err) };
5550                         o.contents.err = core::ptr::null_mut();
5551                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5552                 };
5553                 Self {
5554                         contents,
5555                         result_ok: o.result_ok,
5556                 }
5557         }
5558 }
5559 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5560         fn clone(&self) -> Self {
5561                 if self.result_ok {
5562                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5563                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5564                         } }
5565                 } else {
5566                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5567                                 err: core::ptr::null_mut()
5568                         } }
5569                 }
5570         }
5571 }
5572 #[no_mangle]
5573 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5576 #[repr(C)]
5577 /// The contents of CResult_InMemorySignerDecodeErrorZ
5578 pub union CResult_InMemorySignerDecodeErrorZPtr {
5579         /// A pointer to the contents in the success state.
5580         /// Reading from this pointer when `result_ok` is not set is undefined.
5581         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5582         /// A pointer to the contents in the error state.
5583         /// Reading from this pointer when `result_ok` is set is undefined.
5584         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5585 }
5586 #[repr(C)]
5587 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5588 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5590 pub struct CResult_InMemorySignerDecodeErrorZ {
5591         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5592         /// `err` or `result` depending on the state of `result_ok`.
5593         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5594         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5595         pub result_ok: bool,
5596 }
5597 #[no_mangle]
5598 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5599 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5600         CResult_InMemorySignerDecodeErrorZ {
5601                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5602                         result: Box::into_raw(Box::new(o)),
5603                 },
5604                 result_ok: true,
5605         }
5606 }
5607 #[no_mangle]
5608 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5610         CResult_InMemorySignerDecodeErrorZ {
5611                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5612                         err: Box::into_raw(Box::new(e)),
5613                 },
5614                 result_ok: false,
5615         }
5616 }
5617 /// Checks if the given object is currently in the success state
5618 #[no_mangle]
5619 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5620         o.result_ok
5621 }
5622 #[no_mangle]
5623 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5625 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5626         fn drop(&mut self) {
5627                 if self.result_ok {
5628                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5630                         }
5631                 } else {
5632                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5634                         }
5635                 }
5636         }
5637 }
5638 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5639         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5640                 let contents = if o.result_ok {
5641                         let result = unsafe { o.contents.result };
5642                         unsafe { o.contents.result = core::ptr::null_mut() };
5643                         CResult_InMemorySignerDecodeErrorZPtr { result }
5644                 } else {
5645                         let err = unsafe { o.contents.err };
5646                         unsafe { o.contents.err = core::ptr::null_mut(); }
5647                         CResult_InMemorySignerDecodeErrorZPtr { err }
5648                 };
5649                 Self {
5650                         contents,
5651                         result_ok: o.result_ok,
5652                 }
5653         }
5654 }
5655 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5656         fn clone(&self) -> Self {
5657                 if self.result_ok {
5658                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5659                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5660                         } }
5661                 } else {
5662                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5663                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5664                         } }
5665                 }
5666         }
5667 }
5668 #[no_mangle]
5669 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5670 /// but with all dynamically-allocated buffers duplicated in new buffers.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5672 #[repr(C)]
5673 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5674 /// This corresponds to std::vector in C++
5675 pub struct CVec_TxOutZ {
5676         /// The elements in the array.
5677         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5678         pub data: *mut crate::c_types::TxOut,
5679         /// The number of elements pointed to by `data`.
5680         pub datalen: usize
5681 }
5682 impl CVec_TxOutZ {
5683         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5684                 if self.datalen == 0 { return Vec::new(); }
5685                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5686                 self.data = core::ptr::null_mut();
5687                 self.datalen = 0;
5688                 ret
5689         }
5690         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5691                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5692         }
5693 }
5694 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5695         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5696                 let datalen = v.len();
5697                 let data = Box::into_raw(v.into_boxed_slice());
5698                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5699         }
5700 }
5701 #[no_mangle]
5702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5703 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5704 impl Drop for CVec_TxOutZ {
5705         fn drop(&mut self) {
5706                 if self.datalen == 0 { return; }
5707                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5708         }
5709 }
5710 impl Clone for CVec_TxOutZ {
5711         fn clone(&self) -> Self {
5712                 let mut res = Vec::new();
5713                 if self.datalen == 0 { return Self::from(res); }
5714                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5715                 Self::from(res)
5716         }
5717 }
5718 #[repr(C)]
5719 /// The contents of CResult_TransactionNoneZ
5720 pub union CResult_TransactionNoneZPtr {
5721         /// A pointer to the contents in the success state.
5722         /// Reading from this pointer when `result_ok` is not set is undefined.
5723         pub result: *mut crate::c_types::Transaction,
5724         /// Note that this value is always NULL, as there are no contents in the Err variant
5725         pub err: *mut core::ffi::c_void,
5726 }
5727 #[repr(C)]
5728 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5729 /// containing a crate::c_types::Transaction on success and a () on failure.
5730 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5731 pub struct CResult_TransactionNoneZ {
5732         /// The contents of this CResult_TransactionNoneZ, accessible via either
5733         /// `err` or `result` depending on the state of `result_ok`.
5734         pub contents: CResult_TransactionNoneZPtr,
5735         /// Whether this CResult_TransactionNoneZ represents a success state.
5736         pub result_ok: bool,
5737 }
5738 #[no_mangle]
5739 /// Creates a new CResult_TransactionNoneZ in the success state.
5740 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5741         CResult_TransactionNoneZ {
5742                 contents: CResult_TransactionNoneZPtr {
5743                         result: Box::into_raw(Box::new(o)),
5744                 },
5745                 result_ok: true,
5746         }
5747 }
5748 #[no_mangle]
5749 /// Creates a new CResult_TransactionNoneZ in the error state.
5750 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5751         CResult_TransactionNoneZ {
5752                 contents: CResult_TransactionNoneZPtr {
5753                         err: core::ptr::null_mut(),
5754                 },
5755                 result_ok: false,
5756         }
5757 }
5758 /// Checks if the given object is currently in the success state
5759 #[no_mangle]
5760 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5761         o.result_ok
5762 }
5763 #[no_mangle]
5764 /// Frees any resources used by the CResult_TransactionNoneZ.
5765 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5766 impl Drop for CResult_TransactionNoneZ {
5767         fn drop(&mut self) {
5768                 if self.result_ok {
5769                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5770                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5771                         }
5772                 } else {
5773                 }
5774         }
5775 }
5776 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5777         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5778                 let contents = if o.result_ok {
5779                         let result = unsafe { o.contents.result };
5780                         unsafe { o.contents.result = core::ptr::null_mut() };
5781                         CResult_TransactionNoneZPtr { result }
5782                 } else {
5783                         let _ = unsafe { Box::from_raw(o.contents.err) };
5784                         o.contents.err = core::ptr::null_mut();
5785                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5786                 };
5787                 Self {
5788                         contents,
5789                         result_ok: o.result_ok,
5790                 }
5791         }
5792 }
5793 impl Clone for CResult_TransactionNoneZ {
5794         fn clone(&self) -> Self {
5795                 if self.result_ok {
5796                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5797                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5798                         } }
5799                 } else {
5800                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5801                                 err: core::ptr::null_mut()
5802                         } }
5803                 }
5804         }
5805 }
5806 #[no_mangle]
5807 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5808 /// but with all dynamically-allocated buffers duplicated in new buffers.
5809 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5810 #[repr(C)]
5811 /// A tuple of 2 elements. See the individual fields for the types contained.
5812 pub struct C2Tuple_BlockHashChannelMonitorZ {
5813         /// The element at position 0
5814         pub a: crate::c_types::ThirtyTwoBytes,
5815         /// The element at position 1
5816         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5817 }
5818 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5819         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5820                 Self {
5821                         a: tup.0,
5822                         b: tup.1,
5823                 }
5824         }
5825 }
5826 impl C2Tuple_BlockHashChannelMonitorZ {
5827         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5828                 (self.a, self.b)
5829         }
5830 }
5831 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5832 #[no_mangle]
5833 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5834         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5835 }
5836
5837 #[no_mangle]
5838 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5839 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5840 #[repr(C)]
5841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5842 /// This corresponds to std::vector in C++
5843 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5844         /// The elements in the array.
5845         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5846         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5847         /// The number of elements pointed to by `data`.
5848         pub datalen: usize
5849 }
5850 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5851         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5852                 if self.datalen == 0 { return Vec::new(); }
5853                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5854                 self.data = core::ptr::null_mut();
5855                 self.datalen = 0;
5856                 ret
5857         }
5858         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5859                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5860         }
5861 }
5862 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5863         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5864                 let datalen = v.len();
5865                 let data = Box::into_raw(v.into_boxed_slice());
5866                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5867         }
5868 }
5869 #[no_mangle]
5870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5871 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5872 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5873         fn drop(&mut self) {
5874                 if self.datalen == 0 { return; }
5875                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5876         }
5877 }
5878 #[repr(C)]
5879 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5880 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5881         /// A pointer to the contents in the success state.
5882         /// Reading from this pointer when `result_ok` is not set is undefined.
5883         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5884         /// A pointer to the contents in the error state.
5885         /// Reading from this pointer when `result_ok` is set is undefined.
5886         pub err: *mut crate::c_types::IOError,
5887 }
5888 #[repr(C)]
5889 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5890 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5893         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5894         /// `err` or `result` depending on the state of `result_ok`.
5895         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5896         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5897         pub result_ok: bool,
5898 }
5899 #[no_mangle]
5900 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5901 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5902         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5903                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5904                         result: Box::into_raw(Box::new(o)),
5905                 },
5906                 result_ok: true,
5907         }
5908 }
5909 #[no_mangle]
5910 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5911 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5912         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5913                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5914                         err: Box::into_raw(Box::new(e)),
5915                 },
5916                 result_ok: false,
5917         }
5918 }
5919 /// Checks if the given object is currently in the success state
5920 #[no_mangle]
5921 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5922         o.result_ok
5923 }
5924 #[no_mangle]
5925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5928         fn drop(&mut self) {
5929                 if self.result_ok {
5930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5932                         }
5933                 } else {
5934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5936                         }
5937                 }
5938         }
5939 }
5940 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5941         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5942                 let contents = if o.result_ok {
5943                         let result = unsafe { o.contents.result };
5944                         unsafe { o.contents.result = core::ptr::null_mut() };
5945                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5946                 } else {
5947                         let err = unsafe { o.contents.err };
5948                         unsafe { o.contents.err = core::ptr::null_mut(); }
5949                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5950                 };
5951                 Self {
5952                         contents,
5953                         result_ok: o.result_ok,
5954                 }
5955         }
5956 }
5957 #[repr(C)]
5958 #[derive(Clone)]
5959 /// An enum which can either contain a u16 or not
5960 pub enum COption_u16Z {
5961         /// When we're in this state, this COption_u16Z contains a u16
5962         Some(u16),
5963         /// When we're in this state, this COption_u16Z contains nothing
5964         None
5965 }
5966 impl COption_u16Z {
5967         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5968                 if let Self::None = self { false } else { true }
5969         }
5970         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5971                 !self.is_some()
5972         }
5973         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5974                 if let Self::Some(v) = self { v } else { unreachable!() }
5975         }
5976 }
5977 #[no_mangle]
5978 /// Constructs a new COption_u16Z containing a u16
5979 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5980         COption_u16Z::Some(o)
5981 }
5982 #[no_mangle]
5983 /// Constructs a new COption_u16Z containing nothing
5984 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5985         COption_u16Z::None
5986 }
5987 #[no_mangle]
5988 /// Frees any resources associated with the u16, if we are in the Some state
5989 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5990 #[no_mangle]
5991 /// Creates a new COption_u16Z which has the same data as `orig`
5992 /// but with all dynamically-allocated buffers duplicated in new buffers.
5993 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5994 #[repr(C)]
5995 /// The contents of CResult_NoneAPIErrorZ
5996 pub union CResult_NoneAPIErrorZPtr {
5997         /// Note that this value is always NULL, as there are no contents in the OK variant
5998         pub result: *mut core::ffi::c_void,
5999         /// A pointer to the contents in the error state.
6000         /// Reading from this pointer when `result_ok` is set is undefined.
6001         pub err: *mut crate::lightning::util::errors::APIError,
6002 }
6003 #[repr(C)]
6004 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6005 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6007 pub struct CResult_NoneAPIErrorZ {
6008         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6009         /// `err` or `result` depending on the state of `result_ok`.
6010         pub contents: CResult_NoneAPIErrorZPtr,
6011         /// Whether this CResult_NoneAPIErrorZ represents a success state.
6012         pub result_ok: bool,
6013 }
6014 #[no_mangle]
6015 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6016 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6017         CResult_NoneAPIErrorZ {
6018                 contents: CResult_NoneAPIErrorZPtr {
6019                         result: core::ptr::null_mut(),
6020                 },
6021                 result_ok: true,
6022         }
6023 }
6024 #[no_mangle]
6025 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6026 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6027         CResult_NoneAPIErrorZ {
6028                 contents: CResult_NoneAPIErrorZPtr {
6029                         err: Box::into_raw(Box::new(e)),
6030                 },
6031                 result_ok: false,
6032         }
6033 }
6034 /// Checks if the given object is currently in the success state
6035 #[no_mangle]
6036 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6037         o.result_ok
6038 }
6039 #[no_mangle]
6040 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6041 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6042 impl Drop for CResult_NoneAPIErrorZ {
6043         fn drop(&mut self) {
6044                 if self.result_ok {
6045                 } else {
6046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6048                         }
6049                 }
6050         }
6051 }
6052 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6053         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6054                 let contents = if o.result_ok {
6055                         let _ = unsafe { Box::from_raw(o.contents.result) };
6056                         o.contents.result = core::ptr::null_mut();
6057                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6058                 } else {
6059                         let err = unsafe { o.contents.err };
6060                         unsafe { o.contents.err = core::ptr::null_mut(); }
6061                         CResult_NoneAPIErrorZPtr { err }
6062                 };
6063                 Self {
6064                         contents,
6065                         result_ok: o.result_ok,
6066                 }
6067         }
6068 }
6069 impl Clone for CResult_NoneAPIErrorZ {
6070         fn clone(&self) -> Self {
6071                 if self.result_ok {
6072                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6073                                 result: core::ptr::null_mut()
6074                         } }
6075                 } else {
6076                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6077                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6078                         } }
6079                 }
6080         }
6081 }
6082 #[no_mangle]
6083 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6086 #[repr(C)]
6087 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6088 /// This corresponds to std::vector in C++
6089 pub struct CVec_CResult_NoneAPIErrorZZ {
6090         /// The elements in the array.
6091         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6092         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6093         /// The number of elements pointed to by `data`.
6094         pub datalen: usize
6095 }
6096 impl CVec_CResult_NoneAPIErrorZZ {
6097         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6098                 if self.datalen == 0 { return Vec::new(); }
6099                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6100                 self.data = core::ptr::null_mut();
6101                 self.datalen = 0;
6102                 ret
6103         }
6104         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6105                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6106         }
6107 }
6108 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6109         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6110                 let datalen = v.len();
6111                 let data = Box::into_raw(v.into_boxed_slice());
6112                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6113         }
6114 }
6115 #[no_mangle]
6116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6117 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6118 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6119         fn drop(&mut self) {
6120                 if self.datalen == 0 { return; }
6121                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6122         }
6123 }
6124 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6125         fn clone(&self) -> Self {
6126                 let mut res = Vec::new();
6127                 if self.datalen == 0 { return Self::from(res); }
6128                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6129                 Self::from(res)
6130         }
6131 }
6132 #[repr(C)]
6133 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6134 /// This corresponds to std::vector in C++
6135 pub struct CVec_APIErrorZ {
6136         /// The elements in the array.
6137         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6138         pub data: *mut crate::lightning::util::errors::APIError,
6139         /// The number of elements pointed to by `data`.
6140         pub datalen: usize
6141 }
6142 impl CVec_APIErrorZ {
6143         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6144                 if self.datalen == 0 { return Vec::new(); }
6145                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6146                 self.data = core::ptr::null_mut();
6147                 self.datalen = 0;
6148                 ret
6149         }
6150         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6151                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6152         }
6153 }
6154 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6155         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6156                 let datalen = v.len();
6157                 let data = Box::into_raw(v.into_boxed_slice());
6158                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6159         }
6160 }
6161 #[no_mangle]
6162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6163 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6164 impl Drop for CVec_APIErrorZ {
6165         fn drop(&mut self) {
6166                 if self.datalen == 0 { return; }
6167                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6168         }
6169 }
6170 impl Clone for CVec_APIErrorZ {
6171         fn clone(&self) -> Self {
6172                 let mut res = Vec::new();
6173                 if self.datalen == 0 { return Self::from(res); }
6174                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6175                 Self::from(res)
6176         }
6177 }
6178 #[repr(C)]
6179 /// The contents of CResult__u832APIErrorZ
6180 pub union CResult__u832APIErrorZPtr {
6181         /// A pointer to the contents in the success state.
6182         /// Reading from this pointer when `result_ok` is not set is undefined.
6183         pub result: *mut crate::c_types::ThirtyTwoBytes,
6184         /// A pointer to the contents in the error state.
6185         /// Reading from this pointer when `result_ok` is set is undefined.
6186         pub err: *mut crate::lightning::util::errors::APIError,
6187 }
6188 #[repr(C)]
6189 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6190 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6192 pub struct CResult__u832APIErrorZ {
6193         /// The contents of this CResult__u832APIErrorZ, accessible via either
6194         /// `err` or `result` depending on the state of `result_ok`.
6195         pub contents: CResult__u832APIErrorZPtr,
6196         /// Whether this CResult__u832APIErrorZ represents a success state.
6197         pub result_ok: bool,
6198 }
6199 #[no_mangle]
6200 /// Creates a new CResult__u832APIErrorZ in the success state.
6201 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6202         CResult__u832APIErrorZ {
6203                 contents: CResult__u832APIErrorZPtr {
6204                         result: Box::into_raw(Box::new(o)),
6205                 },
6206                 result_ok: true,
6207         }
6208 }
6209 #[no_mangle]
6210 /// Creates a new CResult__u832APIErrorZ in the error state.
6211 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6212         CResult__u832APIErrorZ {
6213                 contents: CResult__u832APIErrorZPtr {
6214                         err: Box::into_raw(Box::new(e)),
6215                 },
6216                 result_ok: false,
6217         }
6218 }
6219 /// Checks if the given object is currently in the success state
6220 #[no_mangle]
6221 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6222         o.result_ok
6223 }
6224 #[no_mangle]
6225 /// Frees any resources used by the CResult__u832APIErrorZ.
6226 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6227 impl Drop for CResult__u832APIErrorZ {
6228         fn drop(&mut self) {
6229                 if self.result_ok {
6230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6232                         }
6233                 } else {
6234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6236                         }
6237                 }
6238         }
6239 }
6240 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6241         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6242                 let contents = if o.result_ok {
6243                         let result = unsafe { o.contents.result };
6244                         unsafe { o.contents.result = core::ptr::null_mut() };
6245                         CResult__u832APIErrorZPtr { result }
6246                 } else {
6247                         let err = unsafe { o.contents.err };
6248                         unsafe { o.contents.err = core::ptr::null_mut(); }
6249                         CResult__u832APIErrorZPtr { err }
6250                 };
6251                 Self {
6252                         contents,
6253                         result_ok: o.result_ok,
6254                 }
6255         }
6256 }
6257 impl Clone for CResult__u832APIErrorZ {
6258         fn clone(&self) -> Self {
6259                 if self.result_ok {
6260                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6261                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6262                         } }
6263                 } else {
6264                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6265                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6266                         } }
6267                 }
6268         }
6269 }
6270 #[no_mangle]
6271 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6272 /// but with all dynamically-allocated buffers duplicated in new buffers.
6273 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6274 #[repr(C)]
6275 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6276 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6277         /// A pointer to the contents in the success state.
6278         /// Reading from this pointer when `result_ok` is not set is undefined.
6279         pub result: *mut crate::c_types::ThirtyTwoBytes,
6280         /// A pointer to the contents in the error state.
6281         /// Reading from this pointer when `result_ok` is set is undefined.
6282         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6283 }
6284 #[repr(C)]
6285 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6286 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6288 pub struct CResult_PaymentIdPaymentSendFailureZ {
6289         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6290         /// `err` or `result` depending on the state of `result_ok`.
6291         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6292         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6293         pub result_ok: bool,
6294 }
6295 #[no_mangle]
6296 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6297 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6298         CResult_PaymentIdPaymentSendFailureZ {
6299                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6300                         result: Box::into_raw(Box::new(o)),
6301                 },
6302                 result_ok: true,
6303         }
6304 }
6305 #[no_mangle]
6306 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6307 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6308         CResult_PaymentIdPaymentSendFailureZ {
6309                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310                         err: Box::into_raw(Box::new(e)),
6311                 },
6312                 result_ok: false,
6313         }
6314 }
6315 /// Checks if the given object is currently in the success state
6316 #[no_mangle]
6317 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6318         o.result_ok
6319 }
6320 #[no_mangle]
6321 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6322 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6323 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6324         fn drop(&mut self) {
6325                 if self.result_ok {
6326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6328                         }
6329                 } else {
6330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6332                         }
6333                 }
6334         }
6335 }
6336 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6337         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6338                 let contents = if o.result_ok {
6339                         let result = unsafe { o.contents.result };
6340                         unsafe { o.contents.result = core::ptr::null_mut() };
6341                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6342                 } else {
6343                         let err = unsafe { o.contents.err };
6344                         unsafe { o.contents.err = core::ptr::null_mut(); }
6345                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6346                 };
6347                 Self {
6348                         contents,
6349                         result_ok: o.result_ok,
6350                 }
6351         }
6352 }
6353 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6354         fn clone(&self) -> Self {
6355                 if self.result_ok {
6356                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6357                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6358                         } }
6359                 } else {
6360                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6361                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6362                         } }
6363                 }
6364         }
6365 }
6366 #[no_mangle]
6367 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6368 /// but with all dynamically-allocated buffers duplicated in new buffers.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6370 #[repr(C)]
6371 /// The contents of CResult_NonePaymentSendFailureZ
6372 pub union CResult_NonePaymentSendFailureZPtr {
6373         /// Note that this value is always NULL, as there are no contents in the OK variant
6374         pub result: *mut core::ffi::c_void,
6375         /// A pointer to the contents in the error state.
6376         /// Reading from this pointer when `result_ok` is set is undefined.
6377         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6378 }
6379 #[repr(C)]
6380 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6381 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_NonePaymentSendFailureZ {
6384         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6385         /// `err` or `result` depending on the state of `result_ok`.
6386         pub contents: CResult_NonePaymentSendFailureZPtr,
6387         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6388         pub result_ok: bool,
6389 }
6390 #[no_mangle]
6391 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6392 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6393         CResult_NonePaymentSendFailureZ {
6394                 contents: CResult_NonePaymentSendFailureZPtr {
6395                         result: core::ptr::null_mut(),
6396                 },
6397                 result_ok: true,
6398         }
6399 }
6400 #[no_mangle]
6401 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6402 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6403         CResult_NonePaymentSendFailureZ {
6404                 contents: CResult_NonePaymentSendFailureZPtr {
6405                         err: Box::into_raw(Box::new(e)),
6406                 },
6407                 result_ok: false,
6408         }
6409 }
6410 /// Checks if the given object is currently in the success state
6411 #[no_mangle]
6412 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6413         o.result_ok
6414 }
6415 #[no_mangle]
6416 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6417 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6418 impl Drop for CResult_NonePaymentSendFailureZ {
6419         fn drop(&mut self) {
6420                 if self.result_ok {
6421                 } else {
6422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6424                         }
6425                 }
6426         }
6427 }
6428 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6429         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430                 let contents = if o.result_ok {
6431                         let _ = unsafe { Box::from_raw(o.contents.result) };
6432                         o.contents.result = core::ptr::null_mut();
6433                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6434                 } else {
6435                         let err = unsafe { o.contents.err };
6436                         unsafe { o.contents.err = core::ptr::null_mut(); }
6437                         CResult_NonePaymentSendFailureZPtr { err }
6438                 };
6439                 Self {
6440                         contents,
6441                         result_ok: o.result_ok,
6442                 }
6443         }
6444 }
6445 impl Clone for CResult_NonePaymentSendFailureZ {
6446         fn clone(&self) -> Self {
6447                 if self.result_ok {
6448                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6449                                 result: core::ptr::null_mut()
6450                         } }
6451                 } else {
6452                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6454                         } }
6455                 }
6456         }
6457 }
6458 #[no_mangle]
6459 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6462 #[repr(C)]
6463 /// A tuple of 2 elements. See the individual fields for the types contained.
6464 pub struct C2Tuple_PaymentHashPaymentIdZ {
6465         /// The element at position 0
6466         pub a: crate::c_types::ThirtyTwoBytes,
6467         /// The element at position 1
6468         pub b: crate::c_types::ThirtyTwoBytes,
6469 }
6470 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6471         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6472                 Self {
6473                         a: tup.0,
6474                         b: tup.1,
6475                 }
6476         }
6477 }
6478 impl C2Tuple_PaymentHashPaymentIdZ {
6479         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6480                 (self.a, self.b)
6481         }
6482 }
6483 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6484         fn clone(&self) -> Self {
6485                 Self {
6486                         a: Clone::clone(&self.a),
6487                         b: Clone::clone(&self.b),
6488                 }
6489         }
6490 }
6491 #[no_mangle]
6492 /// Creates a new tuple which has the same data as `orig`
6493 /// but with all dynamically-allocated buffers duplicated in new buffers.
6494 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6495 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6496 #[no_mangle]
6497 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6498         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6499 }
6500
6501 #[no_mangle]
6502 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6503 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6504 #[repr(C)]
6505 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6506 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6507         /// A pointer to the contents in the success state.
6508         /// Reading from this pointer when `result_ok` is not set is undefined.
6509         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6510         /// A pointer to the contents in the error state.
6511         /// Reading from this pointer when `result_ok` is set is undefined.
6512         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6513 }
6514 #[repr(C)]
6515 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6516 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6518 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6519         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6520         /// `err` or `result` depending on the state of `result_ok`.
6521         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6522         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6523         pub result_ok: bool,
6524 }
6525 #[no_mangle]
6526 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6527 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6528         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6529                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6530                         result: Box::into_raw(Box::new(o)),
6531                 },
6532                 result_ok: true,
6533         }
6534 }
6535 #[no_mangle]
6536 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6537 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6538         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6539                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540                         err: Box::into_raw(Box::new(e)),
6541                 },
6542                 result_ok: false,
6543         }
6544 }
6545 /// Checks if the given object is currently in the success state
6546 #[no_mangle]
6547 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6548         o.result_ok
6549 }
6550 #[no_mangle]
6551 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6553 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6554         fn drop(&mut self) {
6555                 if self.result_ok {
6556                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6557                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6558                         }
6559                 } else {
6560                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6561                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6562                         }
6563                 }
6564         }
6565 }
6566 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6567         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6568                 let contents = if o.result_ok {
6569                         let result = unsafe { o.contents.result };
6570                         unsafe { o.contents.result = core::ptr::null_mut() };
6571                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6572                 } else {
6573                         let err = unsafe { o.contents.err };
6574                         unsafe { o.contents.err = core::ptr::null_mut(); }
6575                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6576                 };
6577                 Self {
6578                         contents,
6579                         result_ok: o.result_ok,
6580                 }
6581         }
6582 }
6583 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6584         fn clone(&self) -> Self {
6585                 if self.result_ok {
6586                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6587                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6588                         } }
6589                 } else {
6590                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6591                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6592                         } }
6593                 }
6594         }
6595 }
6596 #[no_mangle]
6597 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6598 /// but with all dynamically-allocated buffers duplicated in new buffers.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6600 #[repr(C)]
6601 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6602 /// This corresponds to std::vector in C++
6603 pub struct CVec_NetAddressZ {
6604         /// The elements in the array.
6605         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6606         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6607         /// The number of elements pointed to by `data`.
6608         pub datalen: usize
6609 }
6610 impl CVec_NetAddressZ {
6611         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6612                 if self.datalen == 0 { return Vec::new(); }
6613                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6614                 self.data = core::ptr::null_mut();
6615                 self.datalen = 0;
6616                 ret
6617         }
6618         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6619                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6620         }
6621 }
6622 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6623         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6624                 let datalen = v.len();
6625                 let data = Box::into_raw(v.into_boxed_slice());
6626                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6627         }
6628 }
6629 #[no_mangle]
6630 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6631 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6632 impl Drop for CVec_NetAddressZ {
6633         fn drop(&mut self) {
6634                 if self.datalen == 0 { return; }
6635                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6636         }
6637 }
6638 impl Clone for CVec_NetAddressZ {
6639         fn clone(&self) -> Self {
6640                 let mut res = Vec::new();
6641                 if self.datalen == 0 { return Self::from(res); }
6642                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6643                 Self::from(res)
6644         }
6645 }
6646 #[repr(C)]
6647 /// A tuple of 2 elements. See the individual fields for the types contained.
6648 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6649         /// The element at position 0
6650         pub a: crate::c_types::ThirtyTwoBytes,
6651         /// The element at position 1
6652         pub b: crate::c_types::ThirtyTwoBytes,
6653 }
6654 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6655         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6656                 Self {
6657                         a: tup.0,
6658                         b: tup.1,
6659                 }
6660         }
6661 }
6662 impl C2Tuple_PaymentHashPaymentSecretZ {
6663         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6664                 (self.a, self.b)
6665         }
6666 }
6667 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6668         fn clone(&self) -> Self {
6669                 Self {
6670                         a: Clone::clone(&self.a),
6671                         b: Clone::clone(&self.b),
6672                 }
6673         }
6674 }
6675 #[no_mangle]
6676 /// Creates a new tuple which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6679 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6680 #[no_mangle]
6681 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6682         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6683 }
6684
6685 #[no_mangle]
6686 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6687 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6688 #[repr(C)]
6689 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6690 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6691         /// A pointer to the contents in the success state.
6692         /// Reading from this pointer when `result_ok` is not set is undefined.
6693         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6694         /// Note that this value is always NULL, as there are no contents in the Err variant
6695         pub err: *mut core::ffi::c_void,
6696 }
6697 #[repr(C)]
6698 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6699 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6701 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6702         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6703         /// `err` or `result` depending on the state of `result_ok`.
6704         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6705         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6706         pub result_ok: bool,
6707 }
6708 #[no_mangle]
6709 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6710 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6711         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6712                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6713                         result: Box::into_raw(Box::new(o)),
6714                 },
6715                 result_ok: true,
6716         }
6717 }
6718 #[no_mangle]
6719 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6720 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6721         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6722                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6723                         err: core::ptr::null_mut(),
6724                 },
6725                 result_ok: false,
6726         }
6727 }
6728 /// Checks if the given object is currently in the success state
6729 #[no_mangle]
6730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6731         o.result_ok
6732 }
6733 #[no_mangle]
6734 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6735 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6736 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6737         fn drop(&mut self) {
6738                 if self.result_ok {
6739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6741                         }
6742                 } else {
6743                 }
6744         }
6745 }
6746 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6747         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6748                 let contents = if o.result_ok {
6749                         let result = unsafe { o.contents.result };
6750                         unsafe { o.contents.result = core::ptr::null_mut() };
6751                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6752                 } else {
6753                         let _ = unsafe { Box::from_raw(o.contents.err) };
6754                         o.contents.err = core::ptr::null_mut();
6755                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6756                 };
6757                 Self {
6758                         contents,
6759                         result_ok: o.result_ok,
6760                 }
6761         }
6762 }
6763 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764         fn clone(&self) -> Self {
6765                 if self.result_ok {
6766                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6767                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6768                         } }
6769                 } else {
6770                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6771                                 err: core::ptr::null_mut()
6772                         } }
6773                 }
6774         }
6775 }
6776 #[no_mangle]
6777 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6780 #[repr(C)]
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6783         /// A pointer to the contents in the success state.
6784         /// Reading from this pointer when `result_ok` is not set is undefined.
6785         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6786         /// A pointer to the contents in the error state.
6787         /// Reading from this pointer when `result_ok` is set is undefined.
6788         pub err: *mut crate::lightning::util::errors::APIError,
6789 }
6790 #[repr(C)]
6791 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6792 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6795         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6796         /// `err` or `result` depending on the state of `result_ok`.
6797         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6798         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6799         pub result_ok: bool,
6800 }
6801 #[no_mangle]
6802 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6803 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6804         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6805                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6806                         result: Box::into_raw(Box::new(o)),
6807                 },
6808                 result_ok: true,
6809         }
6810 }
6811 #[no_mangle]
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6814         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6815                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6816                         err: Box::into_raw(Box::new(e)),
6817                 },
6818                 result_ok: false,
6819         }
6820 }
6821 /// Checks if the given object is currently in the success state
6822 #[no_mangle]
6823 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6824         o.result_ok
6825 }
6826 #[no_mangle]
6827 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6828 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6829 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6830         fn drop(&mut self) {
6831                 if self.result_ok {
6832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6834                         }
6835                 } else {
6836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6838                         }
6839                 }
6840         }
6841 }
6842 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6843         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6844                 let contents = if o.result_ok {
6845                         let result = unsafe { o.contents.result };
6846                         unsafe { o.contents.result = core::ptr::null_mut() };
6847                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6848                 } else {
6849                         let err = unsafe { o.contents.err };
6850                         unsafe { o.contents.err = core::ptr::null_mut(); }
6851                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6852                 };
6853                 Self {
6854                         contents,
6855                         result_ok: o.result_ok,
6856                 }
6857         }
6858 }
6859 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6860         fn clone(&self) -> Self {
6861                 if self.result_ok {
6862                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6863                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6864                         } }
6865                 } else {
6866                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6867                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6868                         } }
6869                 }
6870         }
6871 }
6872 #[no_mangle]
6873 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6876 #[repr(C)]
6877 /// The contents of CResult_PaymentSecretNoneZ
6878 pub union CResult_PaymentSecretNoneZPtr {
6879         /// A pointer to the contents in the success state.
6880         /// Reading from this pointer when `result_ok` is not set is undefined.
6881         pub result: *mut crate::c_types::ThirtyTwoBytes,
6882         /// Note that this value is always NULL, as there are no contents in the Err variant
6883         pub err: *mut core::ffi::c_void,
6884 }
6885 #[repr(C)]
6886 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6887 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_PaymentSecretNoneZ {
6890         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6891         /// `err` or `result` depending on the state of `result_ok`.
6892         pub contents: CResult_PaymentSecretNoneZPtr,
6893         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6894         pub result_ok: bool,
6895 }
6896 #[no_mangle]
6897 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6898 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6899         CResult_PaymentSecretNoneZ {
6900                 contents: CResult_PaymentSecretNoneZPtr {
6901                         result: Box::into_raw(Box::new(o)),
6902                 },
6903                 result_ok: true,
6904         }
6905 }
6906 #[no_mangle]
6907 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6908 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6909         CResult_PaymentSecretNoneZ {
6910                 contents: CResult_PaymentSecretNoneZPtr {
6911                         err: core::ptr::null_mut(),
6912                 },
6913                 result_ok: false,
6914         }
6915 }
6916 /// Checks if the given object is currently in the success state
6917 #[no_mangle]
6918 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6919         o.result_ok
6920 }
6921 #[no_mangle]
6922 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6923 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6924 impl Drop for CResult_PaymentSecretNoneZ {
6925         fn drop(&mut self) {
6926                 if self.result_ok {
6927                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6928                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6929                         }
6930                 } else {
6931                 }
6932         }
6933 }
6934 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6935         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6936                 let contents = if o.result_ok {
6937                         let result = unsafe { o.contents.result };
6938                         unsafe { o.contents.result = core::ptr::null_mut() };
6939                         CResult_PaymentSecretNoneZPtr { result }
6940                 } else {
6941                         let _ = unsafe { Box::from_raw(o.contents.err) };
6942                         o.contents.err = core::ptr::null_mut();
6943                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6944                 };
6945                 Self {
6946                         contents,
6947                         result_ok: o.result_ok,
6948                 }
6949         }
6950 }
6951 impl Clone for CResult_PaymentSecretNoneZ {
6952         fn clone(&self) -> Self {
6953                 if self.result_ok {
6954                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6955                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6956                         } }
6957                 } else {
6958                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6959                                 err: core::ptr::null_mut()
6960                         } }
6961                 }
6962         }
6963 }
6964 #[no_mangle]
6965 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6968 #[repr(C)]
6969 /// The contents of CResult_PaymentSecretAPIErrorZ
6970 pub union CResult_PaymentSecretAPIErrorZPtr {
6971         /// A pointer to the contents in the success state.
6972         /// Reading from this pointer when `result_ok` is not set is undefined.
6973         pub result: *mut crate::c_types::ThirtyTwoBytes,
6974         /// A pointer to the contents in the error state.
6975         /// Reading from this pointer when `result_ok` is set is undefined.
6976         pub err: *mut crate::lightning::util::errors::APIError,
6977 }
6978 #[repr(C)]
6979 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6980 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_PaymentSecretAPIErrorZ {
6983         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6984         /// `err` or `result` depending on the state of `result_ok`.
6985         pub contents: CResult_PaymentSecretAPIErrorZPtr,
6986         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6987         pub result_ok: bool,
6988 }
6989 #[no_mangle]
6990 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6991 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6992         CResult_PaymentSecretAPIErrorZ {
6993                 contents: CResult_PaymentSecretAPIErrorZPtr {
6994                         result: Box::into_raw(Box::new(o)),
6995                 },
6996                 result_ok: true,
6997         }
6998 }
6999 #[no_mangle]
7000 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7001 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7002         CResult_PaymentSecretAPIErrorZ {
7003                 contents: CResult_PaymentSecretAPIErrorZPtr {
7004                         err: Box::into_raw(Box::new(e)),
7005                 },
7006                 result_ok: false,
7007         }
7008 }
7009 /// Checks if the given object is currently in the success state
7010 #[no_mangle]
7011 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7012         o.result_ok
7013 }
7014 #[no_mangle]
7015 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7016 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7017 impl Drop for CResult_PaymentSecretAPIErrorZ {
7018         fn drop(&mut self) {
7019                 if self.result_ok {
7020                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7021                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7022                         }
7023                 } else {
7024                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7025                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7026                         }
7027                 }
7028         }
7029 }
7030 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7031         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7032                 let contents = if o.result_ok {
7033                         let result = unsafe { o.contents.result };
7034                         unsafe { o.contents.result = core::ptr::null_mut() };
7035                         CResult_PaymentSecretAPIErrorZPtr { result }
7036                 } else {
7037                         let err = unsafe { o.contents.err };
7038                         unsafe { o.contents.err = core::ptr::null_mut(); }
7039                         CResult_PaymentSecretAPIErrorZPtr { err }
7040                 };
7041                 Self {
7042                         contents,
7043                         result_ok: o.result_ok,
7044                 }
7045         }
7046 }
7047 impl Clone for CResult_PaymentSecretAPIErrorZ {
7048         fn clone(&self) -> Self {
7049                 if self.result_ok {
7050                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7051                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7052                         } }
7053                 } else {
7054                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7055                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7056                         } }
7057                 }
7058         }
7059 }
7060 #[no_mangle]
7061 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7062 /// but with all dynamically-allocated buffers duplicated in new buffers.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7064 #[repr(C)]
7065 /// The contents of CResult_PaymentPreimageAPIErrorZ
7066 pub union CResult_PaymentPreimageAPIErrorZPtr {
7067         /// A pointer to the contents in the success state.
7068         /// Reading from this pointer when `result_ok` is not set is undefined.
7069         pub result: *mut crate::c_types::ThirtyTwoBytes,
7070         /// A pointer to the contents in the error state.
7071         /// Reading from this pointer when `result_ok` is set is undefined.
7072         pub err: *mut crate::lightning::util::errors::APIError,
7073 }
7074 #[repr(C)]
7075 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_PaymentPreimageAPIErrorZ {
7079         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7080         /// `err` or `result` depending on the state of `result_ok`.
7081         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7082         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7083         pub result_ok: bool,
7084 }
7085 #[no_mangle]
7086 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7087 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7088         CResult_PaymentPreimageAPIErrorZ {
7089                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7090                         result: Box::into_raw(Box::new(o)),
7091                 },
7092                 result_ok: true,
7093         }
7094 }
7095 #[no_mangle]
7096 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7097 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7098         CResult_PaymentPreimageAPIErrorZ {
7099                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7100                         err: Box::into_raw(Box::new(e)),
7101                 },
7102                 result_ok: false,
7103         }
7104 }
7105 /// Checks if the given object is currently in the success state
7106 #[no_mangle]
7107 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7108         o.result_ok
7109 }
7110 #[no_mangle]
7111 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7112 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7113 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7114         fn drop(&mut self) {
7115                 if self.result_ok {
7116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7118                         }
7119                 } else {
7120                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7121                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7122                         }
7123                 }
7124         }
7125 }
7126 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7127         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7128                 let contents = if o.result_ok {
7129                         let result = unsafe { o.contents.result };
7130                         unsafe { o.contents.result = core::ptr::null_mut() };
7131                         CResult_PaymentPreimageAPIErrorZPtr { result }
7132                 } else {
7133                         let err = unsafe { o.contents.err };
7134                         unsafe { o.contents.err = core::ptr::null_mut(); }
7135                         CResult_PaymentPreimageAPIErrorZPtr { err }
7136                 };
7137                 Self {
7138                         contents,
7139                         result_ok: o.result_ok,
7140                 }
7141         }
7142 }
7143 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7144         fn clone(&self) -> Self {
7145                 if self.result_ok {
7146                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7147                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7148                         } }
7149                 } else {
7150                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7151                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7152                         } }
7153                 }
7154         }
7155 }
7156 #[no_mangle]
7157 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7158 /// but with all dynamically-allocated buffers duplicated in new buffers.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7160 #[repr(C)]
7161 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7162 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7163         /// A pointer to the contents in the success state.
7164         /// Reading from this pointer when `result_ok` is not set is undefined.
7165         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7166         /// A pointer to the contents in the error state.
7167         /// Reading from this pointer when `result_ok` is set is undefined.
7168         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7169 }
7170 #[repr(C)]
7171 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7172 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7174 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7175         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7176         /// `err` or `result` depending on the state of `result_ok`.
7177         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7178         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7179         pub result_ok: bool,
7180 }
7181 #[no_mangle]
7182 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7183 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7184         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7185                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7186                         result: Box::into_raw(Box::new(o)),
7187                 },
7188                 result_ok: true,
7189         }
7190 }
7191 #[no_mangle]
7192 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7193 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7194         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7195                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196                         err: Box::into_raw(Box::new(e)),
7197                 },
7198                 result_ok: false,
7199         }
7200 }
7201 /// Checks if the given object is currently in the success state
7202 #[no_mangle]
7203 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7204         o.result_ok
7205 }
7206 #[no_mangle]
7207 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7208 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7209 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7210         fn drop(&mut self) {
7211                 if self.result_ok {
7212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7214                         }
7215                 } else {
7216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7218                         }
7219                 }
7220         }
7221 }
7222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7224                 let contents = if o.result_ok {
7225                         let result = unsafe { o.contents.result };
7226                         unsafe { o.contents.result = core::ptr::null_mut() };
7227                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7228                 } else {
7229                         let err = unsafe { o.contents.err };
7230                         unsafe { o.contents.err = core::ptr::null_mut(); }
7231                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7232                 };
7233                 Self {
7234                         contents,
7235                         result_ok: o.result_ok,
7236                 }
7237         }
7238 }
7239 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7240         fn clone(&self) -> Self {
7241                 if self.result_ok {
7242                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7243                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7244                         } }
7245                 } else {
7246                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7248                         } }
7249                 }
7250         }
7251 }
7252 #[no_mangle]
7253 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7254 /// but with all dynamically-allocated buffers duplicated in new buffers.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7256 #[repr(C)]
7257 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7258 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7259         /// A pointer to the contents in the success state.
7260         /// Reading from this pointer when `result_ok` is not set is undefined.
7261         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7262         /// A pointer to the contents in the error state.
7263         /// Reading from this pointer when `result_ok` is set is undefined.
7264         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7265 }
7266 #[repr(C)]
7267 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7268 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7271         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7272         /// `err` or `result` depending on the state of `result_ok`.
7273         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7274         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7275         pub result_ok: bool,
7276 }
7277 #[no_mangle]
7278 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7279 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7280         CResult_ChannelCounterpartyDecodeErrorZ {
7281                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7282                         result: Box::into_raw(Box::new(o)),
7283                 },
7284                 result_ok: true,
7285         }
7286 }
7287 #[no_mangle]
7288 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7289 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7290         CResult_ChannelCounterpartyDecodeErrorZ {
7291                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292                         err: Box::into_raw(Box::new(e)),
7293                 },
7294                 result_ok: false,
7295         }
7296 }
7297 /// Checks if the given object is currently in the success state
7298 #[no_mangle]
7299 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7300         o.result_ok
7301 }
7302 #[no_mangle]
7303 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7304 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7305 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7306         fn drop(&mut self) {
7307                 if self.result_ok {
7308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7310                         }
7311                 } else {
7312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7314                         }
7315                 }
7316         }
7317 }
7318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7319         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7320                 let contents = if o.result_ok {
7321                         let result = unsafe { o.contents.result };
7322                         unsafe { o.contents.result = core::ptr::null_mut() };
7323                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7324                 } else {
7325                         let err = unsafe { o.contents.err };
7326                         unsafe { o.contents.err = core::ptr::null_mut(); }
7327                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7328                 };
7329                 Self {
7330                         contents,
7331                         result_ok: o.result_ok,
7332                 }
7333         }
7334 }
7335 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7336         fn clone(&self) -> Self {
7337                 if self.result_ok {
7338                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7339                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7340                         } }
7341                 } else {
7342                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7343                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7344                         } }
7345                 }
7346         }
7347 }
7348 #[no_mangle]
7349 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7350 /// but with all dynamically-allocated buffers duplicated in new buffers.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7352 #[repr(C)]
7353 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7354 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7355         /// A pointer to the contents in the success state.
7356         /// Reading from this pointer when `result_ok` is not set is undefined.
7357         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7358         /// A pointer to the contents in the error state.
7359         /// Reading from this pointer when `result_ok` is set is undefined.
7360         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7361 }
7362 #[repr(C)]
7363 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7364 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7366 pub struct CResult_ChannelDetailsDecodeErrorZ {
7367         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7368         /// `err` or `result` depending on the state of `result_ok`.
7369         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7370         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7371         pub result_ok: bool,
7372 }
7373 #[no_mangle]
7374 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7375 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7376         CResult_ChannelDetailsDecodeErrorZ {
7377                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7378                         result: Box::into_raw(Box::new(o)),
7379                 },
7380                 result_ok: true,
7381         }
7382 }
7383 #[no_mangle]
7384 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7385 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7386         CResult_ChannelDetailsDecodeErrorZ {
7387                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388                         err: Box::into_raw(Box::new(e)),
7389                 },
7390                 result_ok: false,
7391         }
7392 }
7393 /// Checks if the given object is currently in the success state
7394 #[no_mangle]
7395 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7396         o.result_ok
7397 }
7398 #[no_mangle]
7399 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7400 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7401 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7402         fn drop(&mut self) {
7403                 if self.result_ok {
7404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7406                         }
7407                 } else {
7408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7410                         }
7411                 }
7412         }
7413 }
7414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7415         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7416                 let contents = if o.result_ok {
7417                         let result = unsafe { o.contents.result };
7418                         unsafe { o.contents.result = core::ptr::null_mut() };
7419                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7420                 } else {
7421                         let err = unsafe { o.contents.err };
7422                         unsafe { o.contents.err = core::ptr::null_mut(); }
7423                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7424                 };
7425                 Self {
7426                         contents,
7427                         result_ok: o.result_ok,
7428                 }
7429         }
7430 }
7431 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7432         fn clone(&self) -> Self {
7433                 if self.result_ok {
7434                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7435                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7436                         } }
7437                 } else {
7438                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7439                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7440                         } }
7441                 }
7442         }
7443 }
7444 #[no_mangle]
7445 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7446 /// but with all dynamically-allocated buffers duplicated in new buffers.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7448 #[repr(C)]
7449 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7450 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7451         /// A pointer to the contents in the success state.
7452         /// Reading from this pointer when `result_ok` is not set is undefined.
7453         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7454         /// A pointer to the contents in the error state.
7455         /// Reading from this pointer when `result_ok` is set is undefined.
7456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7457 }
7458 #[repr(C)]
7459 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7460 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7462 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7463         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7464         /// `err` or `result` depending on the state of `result_ok`.
7465         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7466         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7467         pub result_ok: bool,
7468 }
7469 #[no_mangle]
7470 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7471 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7472         CResult_PhantomRouteHintsDecodeErrorZ {
7473                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7474                         result: Box::into_raw(Box::new(o)),
7475                 },
7476                 result_ok: true,
7477         }
7478 }
7479 #[no_mangle]
7480 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7481 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7482         CResult_PhantomRouteHintsDecodeErrorZ {
7483                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7484                         err: Box::into_raw(Box::new(e)),
7485                 },
7486                 result_ok: false,
7487         }
7488 }
7489 /// Checks if the given object is currently in the success state
7490 #[no_mangle]
7491 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7492         o.result_ok
7493 }
7494 #[no_mangle]
7495 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7496 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7497 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7498         fn drop(&mut self) {
7499                 if self.result_ok {
7500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7502                         }
7503                 } else {
7504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7506                         }
7507                 }
7508         }
7509 }
7510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7512                 let contents = if o.result_ok {
7513                         let result = unsafe { o.contents.result };
7514                         unsafe { o.contents.result = core::ptr::null_mut() };
7515                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7516                 } else {
7517                         let err = unsafe { o.contents.err };
7518                         unsafe { o.contents.err = core::ptr::null_mut(); }
7519                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7520                 };
7521                 Self {
7522                         contents,
7523                         result_ok: o.result_ok,
7524                 }
7525         }
7526 }
7527 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
7528         fn clone(&self) -> Self {
7529                 if self.result_ok {
7530                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7531                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
7532                         } }
7533                 } else {
7534                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7536                         } }
7537                 }
7538         }
7539 }
7540 #[no_mangle]
7541 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
7542 /// but with all dynamically-allocated buffers duplicated in new buffers.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
7544 #[repr(C)]
7545 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7546 /// This corresponds to std::vector in C++
7547 pub struct CVec_ChannelMonitorZ {
7548         /// The elements in the array.
7549         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7550         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7551         /// The number of elements pointed to by `data`.
7552         pub datalen: usize
7553 }
7554 impl CVec_ChannelMonitorZ {
7555         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7556                 if self.datalen == 0 { return Vec::new(); }
7557                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7558                 self.data = core::ptr::null_mut();
7559                 self.datalen = 0;
7560                 ret
7561         }
7562         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7563                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7564         }
7565 }
7566 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7567         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7568                 let datalen = v.len();
7569                 let data = Box::into_raw(v.into_boxed_slice());
7570                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7571         }
7572 }
7573 #[no_mangle]
7574 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7575 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7576 impl Drop for CVec_ChannelMonitorZ {
7577         fn drop(&mut self) {
7578                 if self.datalen == 0 { return; }
7579                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7580         }
7581 }
7582 #[repr(C)]
7583 /// A tuple of 2 elements. See the individual fields for the types contained.
7584 pub struct C2Tuple_BlockHashChannelManagerZ {
7585         /// The element at position 0
7586         pub a: crate::c_types::ThirtyTwoBytes,
7587         /// The element at position 1
7588         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7589 }
7590 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7591         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7592                 Self {
7593                         a: tup.0,
7594                         b: tup.1,
7595                 }
7596         }
7597 }
7598 impl C2Tuple_BlockHashChannelManagerZ {
7599         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7600                 (self.a, self.b)
7601         }
7602 }
7603 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7604 #[no_mangle]
7605 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7606         C2Tuple_BlockHashChannelManagerZ { a, b, }
7607 }
7608
7609 #[no_mangle]
7610 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7611 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7612 #[repr(C)]
7613 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7614 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7615         /// A pointer to the contents in the success state.
7616         /// Reading from this pointer when `result_ok` is not set is undefined.
7617         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7618         /// A pointer to the contents in the error state.
7619         /// Reading from this pointer when `result_ok` is set is undefined.
7620         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7621 }
7622 #[repr(C)]
7623 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7624 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7626 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7627         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7628         /// `err` or `result` depending on the state of `result_ok`.
7629         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7630         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7631         pub result_ok: bool,
7632 }
7633 #[no_mangle]
7634 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7635 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7636         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7637                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7638                         result: Box::into_raw(Box::new(o)),
7639                 },
7640                 result_ok: true,
7641         }
7642 }
7643 #[no_mangle]
7644 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7645 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7646         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7647                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7648                         err: Box::into_raw(Box::new(e)),
7649                 },
7650                 result_ok: false,
7651         }
7652 }
7653 /// Checks if the given object is currently in the success state
7654 #[no_mangle]
7655 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7656         o.result_ok
7657 }
7658 #[no_mangle]
7659 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7661 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7662         fn drop(&mut self) {
7663                 if self.result_ok {
7664                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7665                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7666                         }
7667                 } else {
7668                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7669                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7670                         }
7671                 }
7672         }
7673 }
7674 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7675         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7676                 let contents = if o.result_ok {
7677                         let result = unsafe { o.contents.result };
7678                         unsafe { o.contents.result = core::ptr::null_mut() };
7679                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7680                 } else {
7681                         let err = unsafe { o.contents.err };
7682                         unsafe { o.contents.err = core::ptr::null_mut(); }
7683                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7684                 };
7685                 Self {
7686                         contents,
7687                         result_ok: o.result_ok,
7688                 }
7689         }
7690 }
7691 #[repr(C)]
7692 /// The contents of CResult_ChannelConfigDecodeErrorZ
7693 pub union CResult_ChannelConfigDecodeErrorZPtr {
7694         /// A pointer to the contents in the success state.
7695         /// Reading from this pointer when `result_ok` is not set is undefined.
7696         pub result: *mut crate::lightning::util::config::ChannelConfig,
7697         /// A pointer to the contents in the error state.
7698         /// Reading from this pointer when `result_ok` is set is undefined.
7699         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7700 }
7701 #[repr(C)]
7702 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7703 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7705 pub struct CResult_ChannelConfigDecodeErrorZ {
7706         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7707         /// `err` or `result` depending on the state of `result_ok`.
7708         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7709         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7710         pub result_ok: bool,
7711 }
7712 #[no_mangle]
7713 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7714 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7715         CResult_ChannelConfigDecodeErrorZ {
7716                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7717                         result: Box::into_raw(Box::new(o)),
7718                 },
7719                 result_ok: true,
7720         }
7721 }
7722 #[no_mangle]
7723 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7724 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7725         CResult_ChannelConfigDecodeErrorZ {
7726                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7727                         err: Box::into_raw(Box::new(e)),
7728                 },
7729                 result_ok: false,
7730         }
7731 }
7732 /// Checks if the given object is currently in the success state
7733 #[no_mangle]
7734 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7735         o.result_ok
7736 }
7737 #[no_mangle]
7738 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7739 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7740 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7741         fn drop(&mut self) {
7742                 if self.result_ok {
7743                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7744                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7745                         }
7746                 } else {
7747                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7749                         }
7750                 }
7751         }
7752 }
7753 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7754         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7755                 let contents = if o.result_ok {
7756                         let result = unsafe { o.contents.result };
7757                         unsafe { o.contents.result = core::ptr::null_mut() };
7758                         CResult_ChannelConfigDecodeErrorZPtr { result }
7759                 } else {
7760                         let err = unsafe { o.contents.err };
7761                         unsafe { o.contents.err = core::ptr::null_mut(); }
7762                         CResult_ChannelConfigDecodeErrorZPtr { err }
7763                 };
7764                 Self {
7765                         contents,
7766                         result_ok: o.result_ok,
7767                 }
7768         }
7769 }
7770 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7771         fn clone(&self) -> Self {
7772                 if self.result_ok {
7773                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7774                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7775                         } }
7776                 } else {
7777                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7778                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7779                         } }
7780                 }
7781         }
7782 }
7783 #[no_mangle]
7784 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7787 #[repr(C)]
7788 /// The contents of CResult_OutPointDecodeErrorZ
7789 pub union CResult_OutPointDecodeErrorZPtr {
7790         /// A pointer to the contents in the success state.
7791         /// Reading from this pointer when `result_ok` is not set is undefined.
7792         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7793         /// A pointer to the contents in the error state.
7794         /// Reading from this pointer when `result_ok` is set is undefined.
7795         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7796 }
7797 #[repr(C)]
7798 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7799 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_OutPointDecodeErrorZ {
7802         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7803         /// `err` or `result` depending on the state of `result_ok`.
7804         pub contents: CResult_OutPointDecodeErrorZPtr,
7805         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7806         pub result_ok: bool,
7807 }
7808 #[no_mangle]
7809 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7810 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7811         CResult_OutPointDecodeErrorZ {
7812                 contents: CResult_OutPointDecodeErrorZPtr {
7813                         result: Box::into_raw(Box::new(o)),
7814                 },
7815                 result_ok: true,
7816         }
7817 }
7818 #[no_mangle]
7819 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7820 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7821         CResult_OutPointDecodeErrorZ {
7822                 contents: CResult_OutPointDecodeErrorZPtr {
7823                         err: Box::into_raw(Box::new(e)),
7824                 },
7825                 result_ok: false,
7826         }
7827 }
7828 /// Checks if the given object is currently in the success state
7829 #[no_mangle]
7830 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7831         o.result_ok
7832 }
7833 #[no_mangle]
7834 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7835 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7836 impl Drop for CResult_OutPointDecodeErrorZ {
7837         fn drop(&mut self) {
7838                 if self.result_ok {
7839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7841                         }
7842                 } else {
7843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7845                         }
7846                 }
7847         }
7848 }
7849 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7851                 let contents = if o.result_ok {
7852                         let result = unsafe { o.contents.result };
7853                         unsafe { o.contents.result = core::ptr::null_mut() };
7854                         CResult_OutPointDecodeErrorZPtr { result }
7855                 } else {
7856                         let err = unsafe { o.contents.err };
7857                         unsafe { o.contents.err = core::ptr::null_mut(); }
7858                         CResult_OutPointDecodeErrorZPtr { err }
7859                 };
7860                 Self {
7861                         contents,
7862                         result_ok: o.result_ok,
7863                 }
7864         }
7865 }
7866 impl Clone for CResult_OutPointDecodeErrorZ {
7867         fn clone(&self) -> Self {
7868                 if self.result_ok {
7869                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7870                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7871                         } }
7872                 } else {
7873                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7875                         } }
7876                 }
7877         }
7878 }
7879 #[no_mangle]
7880 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7883 #[repr(C)]
7884 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7885 pub enum COption_TypeZ {
7886         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7887         Some(crate::lightning::ln::wire::Type),
7888         /// When we're in this state, this COption_TypeZ contains nothing
7889         None
7890 }
7891 impl COption_TypeZ {
7892         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7893                 if let Self::None = self { false } else { true }
7894         }
7895         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7896                 !self.is_some()
7897         }
7898         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7899                 if let Self::Some(v) = self { v } else { unreachable!() }
7900         }
7901 }
7902 #[no_mangle]
7903 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7904 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7905         COption_TypeZ::Some(o)
7906 }
7907 #[no_mangle]
7908 /// Constructs a new COption_TypeZ containing nothing
7909 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7910         COption_TypeZ::None
7911 }
7912 #[no_mangle]
7913 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7914 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7915 #[repr(C)]
7916 /// The contents of CResult_COption_TypeZDecodeErrorZ
7917 pub union CResult_COption_TypeZDecodeErrorZPtr {
7918         /// A pointer to the contents in the success state.
7919         /// Reading from this pointer when `result_ok` is not set is undefined.
7920         pub result: *mut crate::c_types::derived::COption_TypeZ,
7921         /// A pointer to the contents in the error state.
7922         /// Reading from this pointer when `result_ok` is set is undefined.
7923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7924 }
7925 #[repr(C)]
7926 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_COption_TypeZDecodeErrorZ {
7930         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7931         /// `err` or `result` depending on the state of `result_ok`.
7932         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7933         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7934         pub result_ok: bool,
7935 }
7936 #[no_mangle]
7937 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7938 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7939         CResult_COption_TypeZDecodeErrorZ {
7940                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7941                         result: Box::into_raw(Box::new(o)),
7942                 },
7943                 result_ok: true,
7944         }
7945 }
7946 #[no_mangle]
7947 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7948 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7949         CResult_COption_TypeZDecodeErrorZ {
7950                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7951                         err: Box::into_raw(Box::new(e)),
7952                 },
7953                 result_ok: false,
7954         }
7955 }
7956 /// Checks if the given object is currently in the success state
7957 #[no_mangle]
7958 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7959         o.result_ok
7960 }
7961 #[no_mangle]
7962 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7963 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7964 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7965         fn drop(&mut self) {
7966                 if self.result_ok {
7967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7969                         }
7970                 } else {
7971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7973                         }
7974                 }
7975         }
7976 }
7977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7978         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7979                 let contents = if o.result_ok {
7980                         let result = unsafe { o.contents.result };
7981                         unsafe { o.contents.result = core::ptr::null_mut() };
7982                         CResult_COption_TypeZDecodeErrorZPtr { result }
7983                 } else {
7984                         let err = unsafe { o.contents.err };
7985                         unsafe { o.contents.err = core::ptr::null_mut(); }
7986                         CResult_COption_TypeZDecodeErrorZPtr { err }
7987                 };
7988                 Self {
7989                         contents,
7990                         result_ok: o.result_ok,
7991                 }
7992         }
7993 }
7994 #[repr(C)]
7995 /// The contents of CResult_PaymentIdPaymentErrorZ
7996 pub union CResult_PaymentIdPaymentErrorZPtr {
7997         /// A pointer to the contents in the success state.
7998         /// Reading from this pointer when `result_ok` is not set is undefined.
7999         pub result: *mut crate::c_types::ThirtyTwoBytes,
8000         /// A pointer to the contents in the error state.
8001         /// Reading from this pointer when `result_ok` is set is undefined.
8002         pub err: *mut crate::lightning_invoice::payment::PaymentError,
8003 }
8004 #[repr(C)]
8005 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8006 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8008 pub struct CResult_PaymentIdPaymentErrorZ {
8009         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8010         /// `err` or `result` depending on the state of `result_ok`.
8011         pub contents: CResult_PaymentIdPaymentErrorZPtr,
8012         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8013         pub result_ok: bool,
8014 }
8015 #[no_mangle]
8016 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8017 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8018         CResult_PaymentIdPaymentErrorZ {
8019                 contents: CResult_PaymentIdPaymentErrorZPtr {
8020                         result: Box::into_raw(Box::new(o)),
8021                 },
8022                 result_ok: true,
8023         }
8024 }
8025 #[no_mangle]
8026 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8027 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8028         CResult_PaymentIdPaymentErrorZ {
8029                 contents: CResult_PaymentIdPaymentErrorZPtr {
8030                         err: Box::into_raw(Box::new(e)),
8031                 },
8032                 result_ok: false,
8033         }
8034 }
8035 /// Checks if the given object is currently in the success state
8036 #[no_mangle]
8037 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8038         o.result_ok
8039 }
8040 #[no_mangle]
8041 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8042 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8043 impl Drop for CResult_PaymentIdPaymentErrorZ {
8044         fn drop(&mut self) {
8045                 if self.result_ok {
8046                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8047                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8048                         }
8049                 } else {
8050                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8051                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8052                         }
8053                 }
8054         }
8055 }
8056 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8057         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8058                 let contents = if o.result_ok {
8059                         let result = unsafe { o.contents.result };
8060                         unsafe { o.contents.result = core::ptr::null_mut() };
8061                         CResult_PaymentIdPaymentErrorZPtr { result }
8062                 } else {
8063                         let err = unsafe { o.contents.err };
8064                         unsafe { o.contents.err = core::ptr::null_mut(); }
8065                         CResult_PaymentIdPaymentErrorZPtr { err }
8066                 };
8067                 Self {
8068                         contents,
8069                         result_ok: o.result_ok,
8070                 }
8071         }
8072 }
8073 impl Clone for CResult_PaymentIdPaymentErrorZ {
8074         fn clone(&self) -> Self {
8075                 if self.result_ok {
8076                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8077                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8078                         } }
8079                 } else {
8080                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8081                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8082                         } }
8083                 }
8084         }
8085 }
8086 #[no_mangle]
8087 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8090 #[repr(C)]
8091 /// The contents of CResult_SiPrefixParseErrorZ
8092 pub union CResult_SiPrefixParseErrorZPtr {
8093         /// A pointer to the contents in the success state.
8094         /// Reading from this pointer when `result_ok` is not set is undefined.
8095         pub result: *mut crate::lightning_invoice::SiPrefix,
8096         /// A pointer to the contents in the error state.
8097         /// Reading from this pointer when `result_ok` is set is undefined.
8098         pub err: *mut crate::lightning_invoice::ParseError,
8099 }
8100 #[repr(C)]
8101 /// A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8102 /// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8104 pub struct CResult_SiPrefixParseErrorZ {
8105         /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8106         /// `err` or `result` depending on the state of `result_ok`.
8107         pub contents: CResult_SiPrefixParseErrorZPtr,
8108         /// Whether this CResult_SiPrefixParseErrorZ represents a success state.
8109         pub result_ok: bool,
8110 }
8111 #[no_mangle]
8112 /// Creates a new CResult_SiPrefixParseErrorZ in the success state.
8113 pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ {
8114         CResult_SiPrefixParseErrorZ {
8115                 contents: CResult_SiPrefixParseErrorZPtr {
8116                         result: Box::into_raw(Box::new(o)),
8117                 },
8118                 result_ok: true,
8119         }
8120 }
8121 #[no_mangle]
8122 /// Creates a new CResult_SiPrefixParseErrorZ in the error state.
8123 pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ {
8124         CResult_SiPrefixParseErrorZ {
8125                 contents: CResult_SiPrefixParseErrorZPtr {
8126                         err: Box::into_raw(Box::new(e)),
8127                 },
8128                 result_ok: false,
8129         }
8130 }
8131 /// Checks if the given object is currently in the success state
8132 #[no_mangle]
8133 pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool {
8134         o.result_ok
8135 }
8136 #[no_mangle]
8137 /// Frees any resources used by the CResult_SiPrefixParseErrorZ.
8138 pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { }
8139 impl Drop for CResult_SiPrefixParseErrorZ {
8140         fn drop(&mut self) {
8141                 if self.result_ok {
8142                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8143                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8144                         }
8145                 } else {
8146                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8147                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8148                         }
8149                 }
8150         }
8151 }
8152 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>> for CResult_SiPrefixParseErrorZ {
8153         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, crate::lightning_invoice::ParseError>) -> Self {
8154                 let contents = if o.result_ok {
8155                         let result = unsafe { o.contents.result };
8156                         unsafe { o.contents.result = core::ptr::null_mut() };
8157                         CResult_SiPrefixParseErrorZPtr { result }
8158                 } else {
8159                         let err = unsafe { o.contents.err };
8160                         unsafe { o.contents.err = core::ptr::null_mut(); }
8161                         CResult_SiPrefixParseErrorZPtr { err }
8162                 };
8163                 Self {
8164                         contents,
8165                         result_ok: o.result_ok,
8166                 }
8167         }
8168 }
8169 impl Clone for CResult_SiPrefixParseErrorZ {
8170         fn clone(&self) -> Self {
8171                 if self.result_ok {
8172                         Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr {
8173                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8174                         } }
8175                 } else {
8176                         Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr {
8177                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
8178                         } }
8179                 }
8180         }
8181 }
8182 #[no_mangle]
8183 /// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
8184 /// but with all dynamically-allocated buffers duplicated in new buffers.
8185 pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) }
8186 #[repr(C)]
8187 /// The contents of CResult_InvoiceParseOrSemanticErrorZ
8188 pub union CResult_InvoiceParseOrSemanticErrorZPtr {
8189         /// A pointer to the contents in the success state.
8190         /// Reading from this pointer when `result_ok` is not set is undefined.
8191         pub result: *mut crate::lightning_invoice::Invoice,
8192         /// A pointer to the contents in the error state.
8193         /// Reading from this pointer when `result_ok` is set is undefined.
8194         pub err: *mut crate::lightning_invoice::ParseOrSemanticError,
8195 }
8196 #[repr(C)]
8197 /// A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8198 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8199 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8200 pub struct CResult_InvoiceParseOrSemanticErrorZ {
8201         /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8202         /// `err` or `result` depending on the state of `result_ok`.
8203         pub contents: CResult_InvoiceParseOrSemanticErrorZPtr,
8204         /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8205         pub result_ok: bool,
8206 }
8207 #[no_mangle]
8208 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
8209 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ {
8210         CResult_InvoiceParseOrSemanticErrorZ {
8211                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8212                         result: Box::into_raw(Box::new(o)),
8213                 },
8214                 result_ok: true,
8215         }
8216 }
8217 #[no_mangle]
8218 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
8219 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ {
8220         CResult_InvoiceParseOrSemanticErrorZ {
8221                 contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8222                         err: Box::into_raw(Box::new(e)),
8223                 },
8224                 result_ok: false,
8225         }
8226 }
8227 /// Checks if the given object is currently in the success state
8228 #[no_mangle]
8229 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool {
8230         o.result_ok
8231 }
8232 #[no_mangle]
8233 /// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
8234 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { }
8235 impl Drop for CResult_InvoiceParseOrSemanticErrorZ {
8236         fn drop(&mut self) {
8237                 if self.result_ok {
8238                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8239                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8240                         }
8241                 } else {
8242                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8243                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8244                         }
8245                 }
8246         }
8247 }
8248 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>> for CResult_InvoiceParseOrSemanticErrorZ {
8249         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::ParseOrSemanticError>) -> Self {
8250                 let contents = if o.result_ok {
8251                         let result = unsafe { o.contents.result };
8252                         unsafe { o.contents.result = core::ptr::null_mut() };
8253                         CResult_InvoiceParseOrSemanticErrorZPtr { result }
8254                 } else {
8255                         let err = unsafe { o.contents.err };
8256                         unsafe { o.contents.err = core::ptr::null_mut(); }
8257                         CResult_InvoiceParseOrSemanticErrorZPtr { err }
8258                 };
8259                 Self {
8260                         contents,
8261                         result_ok: o.result_ok,
8262                 }
8263         }
8264 }
8265 impl Clone for CResult_InvoiceParseOrSemanticErrorZ {
8266         fn clone(&self) -> Self {
8267                 if self.result_ok {
8268                         Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8269                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8270                         } }
8271                 } else {
8272                         Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr {
8273                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseOrSemanticError>::clone(unsafe { &*self.contents.err })))
8274                         } }
8275                 }
8276         }
8277 }
8278 #[no_mangle]
8279 /// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
8280 /// but with all dynamically-allocated buffers duplicated in new buffers.
8281 pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) }
8282 #[repr(C)]
8283 /// The contents of CResult_SignedRawInvoiceParseErrorZ
8284 pub union CResult_SignedRawInvoiceParseErrorZPtr {
8285         /// A pointer to the contents in the success state.
8286         /// Reading from this pointer when `result_ok` is not set is undefined.
8287         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8288         /// A pointer to the contents in the error state.
8289         /// Reading from this pointer when `result_ok` is set is undefined.
8290         pub err: *mut crate::lightning_invoice::ParseError,
8291 }
8292 #[repr(C)]
8293 /// A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8294 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8295 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8296 pub struct CResult_SignedRawInvoiceParseErrorZ {
8297         /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8298         /// `err` or `result` depending on the state of `result_ok`.
8299         pub contents: CResult_SignedRawInvoiceParseErrorZPtr,
8300         /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8301         pub result_ok: bool,
8302 }
8303 #[no_mangle]
8304 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
8305 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ {
8306         CResult_SignedRawInvoiceParseErrorZ {
8307                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
8308                         result: Box::into_raw(Box::new(o)),
8309                 },
8310                 result_ok: true,
8311         }
8312 }
8313 #[no_mangle]
8314 /// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
8315 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ {
8316         CResult_SignedRawInvoiceParseErrorZ {
8317                 contents: CResult_SignedRawInvoiceParseErrorZPtr {
8318                         err: Box::into_raw(Box::new(e)),
8319                 },
8320                 result_ok: false,
8321         }
8322 }
8323 /// Checks if the given object is currently in the success state
8324 #[no_mangle]
8325 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool {
8326         o.result_ok
8327 }
8328 #[no_mangle]
8329 /// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
8330 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { }
8331 impl Drop for CResult_SignedRawInvoiceParseErrorZ {
8332         fn drop(&mut self) {
8333                 if self.result_ok {
8334                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8335                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8336                         }
8337                 } else {
8338                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8339                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8340                         }
8341                 }
8342         }
8343 }
8344 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>> for CResult_SignedRawInvoiceParseErrorZ {
8345         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, crate::lightning_invoice::ParseError>) -> Self {
8346                 let contents = if o.result_ok {
8347                         let result = unsafe { o.contents.result };
8348                         unsafe { o.contents.result = core::ptr::null_mut() };
8349                         CResult_SignedRawInvoiceParseErrorZPtr { result }
8350                 } else {
8351                         let err = unsafe { o.contents.err };
8352                         unsafe { o.contents.err = core::ptr::null_mut(); }
8353                         CResult_SignedRawInvoiceParseErrorZPtr { err }
8354                 };
8355                 Self {
8356                         contents,
8357                         result_ok: o.result_ok,
8358                 }
8359         }
8360 }
8361 impl Clone for CResult_SignedRawInvoiceParseErrorZ {
8362         fn clone(&self) -> Self {
8363                 if self.result_ok {
8364                         Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr {
8365                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8366                         } }
8367                 } else {
8368                         Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr {
8369                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::ParseError>::clone(unsafe { &*self.contents.err })))
8370                         } }
8371                 }
8372         }
8373 }
8374 #[no_mangle]
8375 /// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
8376 /// but with all dynamically-allocated buffers duplicated in new buffers.
8377 pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) }
8378 #[repr(C)]
8379 /// A tuple of 3 elements. See the individual fields for the types contained.
8380 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8381         /// The element at position 0
8382         pub a: crate::lightning_invoice::RawInvoice,
8383         /// The element at position 1
8384         pub b: crate::c_types::ThirtyTwoBytes,
8385         /// The element at position 2
8386         pub c: crate::lightning_invoice::InvoiceSignature,
8387 }
8388 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8389         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8390                 Self {
8391                         a: tup.0,
8392                         b: tup.1,
8393                         c: tup.2,
8394                 }
8395         }
8396 }
8397 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8398         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8399                 (self.a, self.b, self.c)
8400         }
8401 }
8402 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8403         fn clone(&self) -> Self {
8404                 Self {
8405                         a: Clone::clone(&self.a),
8406                         b: Clone::clone(&self.b),
8407                         c: Clone::clone(&self.c),
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 C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8415 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8416 #[no_mangle]
8417 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 {
8418         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8419 }
8420
8421 #[no_mangle]
8422 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8423 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8424 #[repr(C)]
8425 /// The contents of CResult_PayeePubKeyErrorZ
8426 pub union CResult_PayeePubKeyErrorZPtr {
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::lightning_invoice::PayeePubKey,
8430         /// A pointer to the contents in the error state.
8431         /// Reading from this pointer when `result_ok` is set is undefined.
8432         pub err: *mut crate::c_types::Secp256k1Error,
8433 }
8434 #[repr(C)]
8435 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8436 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8438 pub struct CResult_PayeePubKeyErrorZ {
8439         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8440         /// `err` or `result` depending on the state of `result_ok`.
8441         pub contents: CResult_PayeePubKeyErrorZPtr,
8442         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8443         pub result_ok: bool,
8444 }
8445 #[no_mangle]
8446 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8447 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8448         CResult_PayeePubKeyErrorZ {
8449                 contents: CResult_PayeePubKeyErrorZPtr {
8450                         result: Box::into_raw(Box::new(o)),
8451                 },
8452                 result_ok: true,
8453         }
8454 }
8455 #[no_mangle]
8456 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8457 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8458         CResult_PayeePubKeyErrorZ {
8459                 contents: CResult_PayeePubKeyErrorZPtr {
8460                         err: Box::into_raw(Box::new(e)),
8461                 },
8462                 result_ok: false,
8463         }
8464 }
8465 /// Checks if the given object is currently in the success state
8466 #[no_mangle]
8467 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8468         o.result_ok
8469 }
8470 #[no_mangle]
8471 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8472 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8473 impl Drop for CResult_PayeePubKeyErrorZ {
8474         fn drop(&mut self) {
8475                 if self.result_ok {
8476                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8477                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8478                         }
8479                 } else {
8480                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8481                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8482                         }
8483                 }
8484         }
8485 }
8486 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8487         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8488                 let contents = if o.result_ok {
8489                         let result = unsafe { o.contents.result };
8490                         unsafe { o.contents.result = core::ptr::null_mut() };
8491                         CResult_PayeePubKeyErrorZPtr { result }
8492                 } else {
8493                         let err = unsafe { o.contents.err };
8494                         unsafe { o.contents.err = core::ptr::null_mut(); }
8495                         CResult_PayeePubKeyErrorZPtr { err }
8496                 };
8497                 Self {
8498                         contents,
8499                         result_ok: o.result_ok,
8500                 }
8501         }
8502 }
8503 impl Clone for CResult_PayeePubKeyErrorZ {
8504         fn clone(&self) -> Self {
8505                 if self.result_ok {
8506                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8507                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8508                         } }
8509                 } else {
8510                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8511                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8512                         } }
8513                 }
8514         }
8515 }
8516 #[no_mangle]
8517 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8518 /// but with all dynamically-allocated buffers duplicated in new buffers.
8519 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8520 #[repr(C)]
8521 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8522 /// This corresponds to std::vector in C++
8523 pub struct CVec_PrivateRouteZ {
8524         /// The elements in the array.
8525         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8526         pub data: *mut crate::lightning_invoice::PrivateRoute,
8527         /// The number of elements pointed to by `data`.
8528         pub datalen: usize
8529 }
8530 impl CVec_PrivateRouteZ {
8531         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8532                 if self.datalen == 0 { return Vec::new(); }
8533                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8534                 self.data = core::ptr::null_mut();
8535                 self.datalen = 0;
8536                 ret
8537         }
8538         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8539                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8540         }
8541 }
8542 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8543         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8544                 let datalen = v.len();
8545                 let data = Box::into_raw(v.into_boxed_slice());
8546                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8547         }
8548 }
8549 #[no_mangle]
8550 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8551 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8552 impl Drop for CVec_PrivateRouteZ {
8553         fn drop(&mut self) {
8554                 if self.datalen == 0 { return; }
8555                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8556         }
8557 }
8558 impl Clone for CVec_PrivateRouteZ {
8559         fn clone(&self) -> Self {
8560                 let mut res = Vec::new();
8561                 if self.datalen == 0 { return Self::from(res); }
8562                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8563                 Self::from(res)
8564         }
8565 }
8566 #[repr(C)]
8567 /// The contents of CResult_PositiveTimestampCreationErrorZ
8568 pub union CResult_PositiveTimestampCreationErrorZPtr {
8569         /// A pointer to the contents in the success state.
8570         /// Reading from this pointer when `result_ok` is not set is undefined.
8571         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8572         /// A pointer to the contents in the error state.
8573         /// Reading from this pointer when `result_ok` is set is undefined.
8574         pub err: *mut crate::lightning_invoice::CreationError,
8575 }
8576 #[repr(C)]
8577 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8578 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8579 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8580 pub struct CResult_PositiveTimestampCreationErrorZ {
8581         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8582         /// `err` or `result` depending on the state of `result_ok`.
8583         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8584         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8585         pub result_ok: bool,
8586 }
8587 #[no_mangle]
8588 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8589 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8590         CResult_PositiveTimestampCreationErrorZ {
8591                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8592                         result: Box::into_raw(Box::new(o)),
8593                 },
8594                 result_ok: true,
8595         }
8596 }
8597 #[no_mangle]
8598 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8599 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8600         CResult_PositiveTimestampCreationErrorZ {
8601                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8602                         err: Box::into_raw(Box::new(e)),
8603                 },
8604                 result_ok: false,
8605         }
8606 }
8607 /// Checks if the given object is currently in the success state
8608 #[no_mangle]
8609 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8610         o.result_ok
8611 }
8612 #[no_mangle]
8613 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8614 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8615 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8616         fn drop(&mut self) {
8617                 if self.result_ok {
8618                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8619                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8620                         }
8621                 } else {
8622                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8623                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8624                         }
8625                 }
8626         }
8627 }
8628 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8629         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8630                 let contents = if o.result_ok {
8631                         let result = unsafe { o.contents.result };
8632                         unsafe { o.contents.result = core::ptr::null_mut() };
8633                         CResult_PositiveTimestampCreationErrorZPtr { result }
8634                 } else {
8635                         let err = unsafe { o.contents.err };
8636                         unsafe { o.contents.err = core::ptr::null_mut(); }
8637                         CResult_PositiveTimestampCreationErrorZPtr { err }
8638                 };
8639                 Self {
8640                         contents,
8641                         result_ok: o.result_ok,
8642                 }
8643         }
8644 }
8645 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8646         fn clone(&self) -> Self {
8647                 if self.result_ok {
8648                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8649                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8650                         } }
8651                 } else {
8652                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8653                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8654                         } }
8655                 }
8656         }
8657 }
8658 #[no_mangle]
8659 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8660 /// but with all dynamically-allocated buffers duplicated in new buffers.
8661 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8662 #[repr(C)]
8663 /// The contents of CResult_NoneSemanticErrorZ
8664 pub union CResult_NoneSemanticErrorZPtr {
8665         /// Note that this value is always NULL, as there are no contents in the OK variant
8666         pub result: *mut core::ffi::c_void,
8667         /// A pointer to the contents in the error state.
8668         /// Reading from this pointer when `result_ok` is set is undefined.
8669         pub err: *mut crate::lightning_invoice::SemanticError,
8670 }
8671 #[repr(C)]
8672 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8673 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8674 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8675 pub struct CResult_NoneSemanticErrorZ {
8676         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8677         /// `err` or `result` depending on the state of `result_ok`.
8678         pub contents: CResult_NoneSemanticErrorZPtr,
8679         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8680         pub result_ok: bool,
8681 }
8682 #[no_mangle]
8683 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8684 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8685         CResult_NoneSemanticErrorZ {
8686                 contents: CResult_NoneSemanticErrorZPtr {
8687                         result: core::ptr::null_mut(),
8688                 },
8689                 result_ok: true,
8690         }
8691 }
8692 #[no_mangle]
8693 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8694 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8695         CResult_NoneSemanticErrorZ {
8696                 contents: CResult_NoneSemanticErrorZPtr {
8697                         err: Box::into_raw(Box::new(e)),
8698                 },
8699                 result_ok: false,
8700         }
8701 }
8702 /// Checks if the given object is currently in the success state
8703 #[no_mangle]
8704 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8705         o.result_ok
8706 }
8707 #[no_mangle]
8708 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8709 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8710 impl Drop for CResult_NoneSemanticErrorZ {
8711         fn drop(&mut self) {
8712                 if self.result_ok {
8713                 } else {
8714                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8715                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8716                         }
8717                 }
8718         }
8719 }
8720 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8721         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8722                 let contents = if o.result_ok {
8723                         let _ = unsafe { Box::from_raw(o.contents.result) };
8724                         o.contents.result = core::ptr::null_mut();
8725                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8726                 } else {
8727                         let err = unsafe { o.contents.err };
8728                         unsafe { o.contents.err = core::ptr::null_mut(); }
8729                         CResult_NoneSemanticErrorZPtr { err }
8730                 };
8731                 Self {
8732                         contents,
8733                         result_ok: o.result_ok,
8734                 }
8735         }
8736 }
8737 impl Clone for CResult_NoneSemanticErrorZ {
8738         fn clone(&self) -> Self {
8739                 if self.result_ok {
8740                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8741                                 result: core::ptr::null_mut()
8742                         } }
8743                 } else {
8744                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8745                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8746                         } }
8747                 }
8748         }
8749 }
8750 #[no_mangle]
8751 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8752 /// but with all dynamically-allocated buffers duplicated in new buffers.
8753 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8754 #[repr(C)]
8755 /// The contents of CResult_InvoiceSemanticErrorZ
8756 pub union CResult_InvoiceSemanticErrorZPtr {
8757         /// A pointer to the contents in the success state.
8758         /// Reading from this pointer when `result_ok` is not set is undefined.
8759         pub result: *mut crate::lightning_invoice::Invoice,
8760         /// A pointer to the contents in the error state.
8761         /// Reading from this pointer when `result_ok` is set is undefined.
8762         pub err: *mut crate::lightning_invoice::SemanticError,
8763 }
8764 #[repr(C)]
8765 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8766 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8767 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8768 pub struct CResult_InvoiceSemanticErrorZ {
8769         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8770         /// `err` or `result` depending on the state of `result_ok`.
8771         pub contents: CResult_InvoiceSemanticErrorZPtr,
8772         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8773         pub result_ok: bool,
8774 }
8775 #[no_mangle]
8776 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8777 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8778         CResult_InvoiceSemanticErrorZ {
8779                 contents: CResult_InvoiceSemanticErrorZPtr {
8780                         result: Box::into_raw(Box::new(o)),
8781                 },
8782                 result_ok: true,
8783         }
8784 }
8785 #[no_mangle]
8786 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8787 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8788         CResult_InvoiceSemanticErrorZ {
8789                 contents: CResult_InvoiceSemanticErrorZPtr {
8790                         err: Box::into_raw(Box::new(e)),
8791                 },
8792                 result_ok: false,
8793         }
8794 }
8795 /// Checks if the given object is currently in the success state
8796 #[no_mangle]
8797 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8798         o.result_ok
8799 }
8800 #[no_mangle]
8801 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8802 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8803 impl Drop for CResult_InvoiceSemanticErrorZ {
8804         fn drop(&mut self) {
8805                 if self.result_ok {
8806                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8807                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8808                         }
8809                 } else {
8810                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8811                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8812                         }
8813                 }
8814         }
8815 }
8816 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8817         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8818                 let contents = if o.result_ok {
8819                         let result = unsafe { o.contents.result };
8820                         unsafe { o.contents.result = core::ptr::null_mut() };
8821                         CResult_InvoiceSemanticErrorZPtr { result }
8822                 } else {
8823                         let err = unsafe { o.contents.err };
8824                         unsafe { o.contents.err = core::ptr::null_mut(); }
8825                         CResult_InvoiceSemanticErrorZPtr { err }
8826                 };
8827                 Self {
8828                         contents,
8829                         result_ok: o.result_ok,
8830                 }
8831         }
8832 }
8833 impl Clone for CResult_InvoiceSemanticErrorZ {
8834         fn clone(&self) -> Self {
8835                 if self.result_ok {
8836                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8837                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8838                         } }
8839                 } else {
8840                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8841                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8842                         } }
8843                 }
8844         }
8845 }
8846 #[no_mangle]
8847 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8848 /// but with all dynamically-allocated buffers duplicated in new buffers.
8849 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8850 #[repr(C)]
8851 /// The contents of CResult_DescriptionCreationErrorZ
8852 pub union CResult_DescriptionCreationErrorZPtr {
8853         /// A pointer to the contents in the success state.
8854         /// Reading from this pointer when `result_ok` is not set is undefined.
8855         pub result: *mut crate::lightning_invoice::Description,
8856         /// A pointer to the contents in the error state.
8857         /// Reading from this pointer when `result_ok` is set is undefined.
8858         pub err: *mut crate::lightning_invoice::CreationError,
8859 }
8860 #[repr(C)]
8861 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8862 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8864 pub struct CResult_DescriptionCreationErrorZ {
8865         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8866         /// `err` or `result` depending on the state of `result_ok`.
8867         pub contents: CResult_DescriptionCreationErrorZPtr,
8868         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8869         pub result_ok: bool,
8870 }
8871 #[no_mangle]
8872 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8873 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8874         CResult_DescriptionCreationErrorZ {
8875                 contents: CResult_DescriptionCreationErrorZPtr {
8876                         result: Box::into_raw(Box::new(o)),
8877                 },
8878                 result_ok: true,
8879         }
8880 }
8881 #[no_mangle]
8882 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8883 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8884         CResult_DescriptionCreationErrorZ {
8885                 contents: CResult_DescriptionCreationErrorZPtr {
8886                         err: Box::into_raw(Box::new(e)),
8887                 },
8888                 result_ok: false,
8889         }
8890 }
8891 /// Checks if the given object is currently in the success state
8892 #[no_mangle]
8893 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8894         o.result_ok
8895 }
8896 #[no_mangle]
8897 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8898 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8899 impl Drop for CResult_DescriptionCreationErrorZ {
8900         fn drop(&mut self) {
8901                 if self.result_ok {
8902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8904                         }
8905                 } else {
8906                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8907                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8908                         }
8909                 }
8910         }
8911 }
8912 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8913         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8914                 let contents = if o.result_ok {
8915                         let result = unsafe { o.contents.result };
8916                         unsafe { o.contents.result = core::ptr::null_mut() };
8917                         CResult_DescriptionCreationErrorZPtr { result }
8918                 } else {
8919                         let err = unsafe { o.contents.err };
8920                         unsafe { o.contents.err = core::ptr::null_mut(); }
8921                         CResult_DescriptionCreationErrorZPtr { err }
8922                 };
8923                 Self {
8924                         contents,
8925                         result_ok: o.result_ok,
8926                 }
8927         }
8928 }
8929 impl Clone for CResult_DescriptionCreationErrorZ {
8930         fn clone(&self) -> Self {
8931                 if self.result_ok {
8932                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8933                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8934                         } }
8935                 } else {
8936                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8937                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8938                         } }
8939                 }
8940         }
8941 }
8942 #[no_mangle]
8943 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8944 /// but with all dynamically-allocated buffers duplicated in new buffers.
8945 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8946 #[repr(C)]
8947 /// The contents of CResult_PrivateRouteCreationErrorZ
8948 pub union CResult_PrivateRouteCreationErrorZPtr {
8949         /// A pointer to the contents in the success state.
8950         /// Reading from this pointer when `result_ok` is not set is undefined.
8951         pub result: *mut crate::lightning_invoice::PrivateRoute,
8952         /// A pointer to the contents in the error state.
8953         /// Reading from this pointer when `result_ok` is set is undefined.
8954         pub err: *mut crate::lightning_invoice::CreationError,
8955 }
8956 #[repr(C)]
8957 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8958 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8959 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8960 pub struct CResult_PrivateRouteCreationErrorZ {
8961         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8962         /// `err` or `result` depending on the state of `result_ok`.
8963         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8964         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8965         pub result_ok: bool,
8966 }
8967 #[no_mangle]
8968 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8969 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8970         CResult_PrivateRouteCreationErrorZ {
8971                 contents: CResult_PrivateRouteCreationErrorZPtr {
8972                         result: Box::into_raw(Box::new(o)),
8973                 },
8974                 result_ok: true,
8975         }
8976 }
8977 #[no_mangle]
8978 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8979 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8980         CResult_PrivateRouteCreationErrorZ {
8981                 contents: CResult_PrivateRouteCreationErrorZPtr {
8982                         err: Box::into_raw(Box::new(e)),
8983                 },
8984                 result_ok: false,
8985         }
8986 }
8987 /// Checks if the given object is currently in the success state
8988 #[no_mangle]
8989 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8990         o.result_ok
8991 }
8992 #[no_mangle]
8993 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8994 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8995 impl Drop for CResult_PrivateRouteCreationErrorZ {
8996         fn drop(&mut self) {
8997                 if self.result_ok {
8998                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8999                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9000                         }
9001                 } else {
9002                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9003                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9004                         }
9005                 }
9006         }
9007 }
9008 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9009         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9010                 let contents = if o.result_ok {
9011                         let result = unsafe { o.contents.result };
9012                         unsafe { o.contents.result = core::ptr::null_mut() };
9013                         CResult_PrivateRouteCreationErrorZPtr { result }
9014                 } else {
9015                         let err = unsafe { o.contents.err };
9016                         unsafe { o.contents.err = core::ptr::null_mut(); }
9017                         CResult_PrivateRouteCreationErrorZPtr { err }
9018                 };
9019                 Self {
9020                         contents,
9021                         result_ok: o.result_ok,
9022                 }
9023         }
9024 }
9025 impl Clone for CResult_PrivateRouteCreationErrorZ {
9026         fn clone(&self) -> Self {
9027                 if self.result_ok {
9028                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9029                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9030                         } }
9031                 } else {
9032                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9033                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9034                         } }
9035                 }
9036         }
9037 }
9038 #[no_mangle]
9039 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9040 /// but with all dynamically-allocated buffers duplicated in new buffers.
9041 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9042 #[repr(C)]
9043 /// The contents of CResult_StringErrorZ
9044 pub union CResult_StringErrorZPtr {
9045         /// A pointer to the contents in the success state.
9046         /// Reading from this pointer when `result_ok` is not set is undefined.
9047         pub result: *mut crate::c_types::Str,
9048         /// A pointer to the contents in the error state.
9049         /// Reading from this pointer when `result_ok` is set is undefined.
9050         pub err: *mut crate::c_types::Secp256k1Error,
9051 }
9052 #[repr(C)]
9053 /// A CResult_StringErrorZ represents the result of a fallible operation,
9054 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9056 pub struct CResult_StringErrorZ {
9057         /// The contents of this CResult_StringErrorZ, accessible via either
9058         /// `err` or `result` depending on the state of `result_ok`.
9059         pub contents: CResult_StringErrorZPtr,
9060         /// Whether this CResult_StringErrorZ represents a success state.
9061         pub result_ok: bool,
9062 }
9063 #[no_mangle]
9064 /// Creates a new CResult_StringErrorZ in the success state.
9065 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9066         CResult_StringErrorZ {
9067                 contents: CResult_StringErrorZPtr {
9068                         result: Box::into_raw(Box::new(o)),
9069                 },
9070                 result_ok: true,
9071         }
9072 }
9073 #[no_mangle]
9074 /// Creates a new CResult_StringErrorZ in the error state.
9075 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9076         CResult_StringErrorZ {
9077                 contents: CResult_StringErrorZPtr {
9078                         err: Box::into_raw(Box::new(e)),
9079                 },
9080                 result_ok: false,
9081         }
9082 }
9083 /// Checks if the given object is currently in the success state
9084 #[no_mangle]
9085 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9086         o.result_ok
9087 }
9088 #[no_mangle]
9089 /// Frees any resources used by the CResult_StringErrorZ.
9090 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9091 impl Drop for CResult_StringErrorZ {
9092         fn drop(&mut self) {
9093                 if self.result_ok {
9094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9096                         }
9097                 } else {
9098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9100                         }
9101                 }
9102         }
9103 }
9104 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9105         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9106                 let contents = if o.result_ok {
9107                         let result = unsafe { o.contents.result };
9108                         unsafe { o.contents.result = core::ptr::null_mut() };
9109                         CResult_StringErrorZPtr { result }
9110                 } else {
9111                         let err = unsafe { o.contents.err };
9112                         unsafe { o.contents.err = core::ptr::null_mut(); }
9113                         CResult_StringErrorZPtr { err }
9114                 };
9115                 Self {
9116                         contents,
9117                         result_ok: o.result_ok,
9118                 }
9119         }
9120 }
9121 #[repr(C)]
9122 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9123 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9124         /// A pointer to the contents in the success state.
9125         /// Reading from this pointer when `result_ok` is not set is undefined.
9126         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9127         /// A pointer to the contents in the error state.
9128         /// Reading from this pointer when `result_ok` is set is undefined.
9129         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9130 }
9131 #[repr(C)]
9132 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9133 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9135 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9136         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9137         /// `err` or `result` depending on the state of `result_ok`.
9138         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9139         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9140         pub result_ok: bool,
9141 }
9142 #[no_mangle]
9143 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9144 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9145         CResult_ChannelMonitorUpdateDecodeErrorZ {
9146                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9147                         result: Box::into_raw(Box::new(o)),
9148                 },
9149                 result_ok: true,
9150         }
9151 }
9152 #[no_mangle]
9153 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9154 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9155         CResult_ChannelMonitorUpdateDecodeErrorZ {
9156                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9157                         err: Box::into_raw(Box::new(e)),
9158                 },
9159                 result_ok: false,
9160         }
9161 }
9162 /// Checks if the given object is currently in the success state
9163 #[no_mangle]
9164 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9165         o.result_ok
9166 }
9167 #[no_mangle]
9168 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9169 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9170 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9171         fn drop(&mut self) {
9172                 if self.result_ok {
9173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9175                         }
9176                 } else {
9177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9179                         }
9180                 }
9181         }
9182 }
9183 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9184         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9185                 let contents = if o.result_ok {
9186                         let result = unsafe { o.contents.result };
9187                         unsafe { o.contents.result = core::ptr::null_mut() };
9188                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9189                 } else {
9190                         let err = unsafe { o.contents.err };
9191                         unsafe { o.contents.err = core::ptr::null_mut(); }
9192                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9193                 };
9194                 Self {
9195                         contents,
9196                         result_ok: o.result_ok,
9197                 }
9198         }
9199 }
9200 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9201         fn clone(&self) -> Self {
9202                 if self.result_ok {
9203                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9204                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9205                         } }
9206                 } else {
9207                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9208                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9209                         } }
9210                 }
9211         }
9212 }
9213 #[no_mangle]
9214 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9215 /// but with all dynamically-allocated buffers duplicated in new buffers.
9216 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9217 #[repr(C)]
9218 #[derive(Clone)]
9219 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9220 pub enum COption_MonitorEventZ {
9221         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9222         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9223         /// When we're in this state, this COption_MonitorEventZ contains nothing
9224         None
9225 }
9226 impl COption_MonitorEventZ {
9227         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9228                 if let Self::None = self { false } else { true }
9229         }
9230         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9231                 !self.is_some()
9232         }
9233         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9234                 if let Self::Some(v) = self { v } else { unreachable!() }
9235         }
9236 }
9237 #[no_mangle]
9238 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9239 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9240         COption_MonitorEventZ::Some(o)
9241 }
9242 #[no_mangle]
9243 /// Constructs a new COption_MonitorEventZ containing nothing
9244 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9245         COption_MonitorEventZ::None
9246 }
9247 #[no_mangle]
9248 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9249 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9250 #[no_mangle]
9251 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9252 /// but with all dynamically-allocated buffers duplicated in new buffers.
9253 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9254 #[repr(C)]
9255 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9256 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9257         /// A pointer to the contents in the success state.
9258         /// Reading from this pointer when `result_ok` is not set is undefined.
9259         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9260         /// A pointer to the contents in the error state.
9261         /// Reading from this pointer when `result_ok` is set is undefined.
9262         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9263 }
9264 #[repr(C)]
9265 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9266 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9267 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9268 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9269         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9270         /// `err` or `result` depending on the state of `result_ok`.
9271         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9272         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9273         pub result_ok: bool,
9274 }
9275 #[no_mangle]
9276 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9277 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9278         CResult_COption_MonitorEventZDecodeErrorZ {
9279                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9280                         result: Box::into_raw(Box::new(o)),
9281                 },
9282                 result_ok: true,
9283         }
9284 }
9285 #[no_mangle]
9286 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9287 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9288         CResult_COption_MonitorEventZDecodeErrorZ {
9289                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9290                         err: Box::into_raw(Box::new(e)),
9291                 },
9292                 result_ok: false,
9293         }
9294 }
9295 /// Checks if the given object is currently in the success state
9296 #[no_mangle]
9297 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9298         o.result_ok
9299 }
9300 #[no_mangle]
9301 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9302 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9303 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9304         fn drop(&mut self) {
9305                 if self.result_ok {
9306                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9307                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9308                         }
9309                 } else {
9310                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9311                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9312                         }
9313                 }
9314         }
9315 }
9316 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9317         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9318                 let contents = if o.result_ok {
9319                         let result = unsafe { o.contents.result };
9320                         unsafe { o.contents.result = core::ptr::null_mut() };
9321                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9322                 } else {
9323                         let err = unsafe { o.contents.err };
9324                         unsafe { o.contents.err = core::ptr::null_mut(); }
9325                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9326                 };
9327                 Self {
9328                         contents,
9329                         result_ok: o.result_ok,
9330                 }
9331         }
9332 }
9333 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9334         fn clone(&self) -> Self {
9335                 if self.result_ok {
9336                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9337                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9338                         } }
9339                 } else {
9340                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9341                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9342                         } }
9343                 }
9344         }
9345 }
9346 #[no_mangle]
9347 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9348 /// but with all dynamically-allocated buffers duplicated in new buffers.
9349 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9350 #[repr(C)]
9351 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9352 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9353         /// A pointer to the contents in the success state.
9354         /// Reading from this pointer when `result_ok` is not set is undefined.
9355         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9356         /// A pointer to the contents in the error state.
9357         /// Reading from this pointer when `result_ok` is set is undefined.
9358         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9359 }
9360 #[repr(C)]
9361 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9362 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9363 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9364 pub struct CResult_HTLCUpdateDecodeErrorZ {
9365         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9366         /// `err` or `result` depending on the state of `result_ok`.
9367         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9368         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9369         pub result_ok: bool,
9370 }
9371 #[no_mangle]
9372 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9373 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9374         CResult_HTLCUpdateDecodeErrorZ {
9375                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9376                         result: Box::into_raw(Box::new(o)),
9377                 },
9378                 result_ok: true,
9379         }
9380 }
9381 #[no_mangle]
9382 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9383 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9384         CResult_HTLCUpdateDecodeErrorZ {
9385                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9386                         err: Box::into_raw(Box::new(e)),
9387                 },
9388                 result_ok: false,
9389         }
9390 }
9391 /// Checks if the given object is currently in the success state
9392 #[no_mangle]
9393 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9394         o.result_ok
9395 }
9396 #[no_mangle]
9397 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9398 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9399 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9400         fn drop(&mut self) {
9401                 if self.result_ok {
9402                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9403                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9404                         }
9405                 } else {
9406                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9407                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9408                         }
9409                 }
9410         }
9411 }
9412 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9413         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9414                 let contents = if o.result_ok {
9415                         let result = unsafe { o.contents.result };
9416                         unsafe { o.contents.result = core::ptr::null_mut() };
9417                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9418                 } else {
9419                         let err = unsafe { o.contents.err };
9420                         unsafe { o.contents.err = core::ptr::null_mut(); }
9421                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9422                 };
9423                 Self {
9424                         contents,
9425                         result_ok: o.result_ok,
9426                 }
9427         }
9428 }
9429 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9430         fn clone(&self) -> Self {
9431                 if self.result_ok {
9432                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9433                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9434                         } }
9435                 } else {
9436                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9437                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9438                         } }
9439                 }
9440         }
9441 }
9442 #[no_mangle]
9443 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9444 /// but with all dynamically-allocated buffers duplicated in new buffers.
9445 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9446 #[repr(C)]
9447 /// A tuple of 2 elements. See the individual fields for the types contained.
9448 pub struct C2Tuple_OutPointScriptZ {
9449         /// The element at position 0
9450         pub a: crate::lightning::chain::transaction::OutPoint,
9451         /// The element at position 1
9452         pub b: crate::c_types::derived::CVec_u8Z,
9453 }
9454 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9455         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9456                 Self {
9457                         a: tup.0,
9458                         b: tup.1,
9459                 }
9460         }
9461 }
9462 impl C2Tuple_OutPointScriptZ {
9463         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9464                 (self.a, self.b)
9465         }
9466 }
9467 impl Clone for C2Tuple_OutPointScriptZ {
9468         fn clone(&self) -> Self {
9469                 Self {
9470                         a: Clone::clone(&self.a),
9471                         b: Clone::clone(&self.b),
9472                 }
9473         }
9474 }
9475 #[no_mangle]
9476 /// Creates a new tuple which has the same data as `orig`
9477 /// but with all dynamically-allocated buffers duplicated in new buffers.
9478 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9479 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9480 #[no_mangle]
9481 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9482         C2Tuple_OutPointScriptZ { a, b, }
9483 }
9484
9485 #[no_mangle]
9486 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9487 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9488 #[repr(C)]
9489 /// A tuple of 2 elements. See the individual fields for the types contained.
9490 pub struct C2Tuple_u32ScriptZ {
9491         /// The element at position 0
9492         pub a: u32,
9493         /// The element at position 1
9494         pub b: crate::c_types::derived::CVec_u8Z,
9495 }
9496 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9497         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9498                 Self {
9499                         a: tup.0,
9500                         b: tup.1,
9501                 }
9502         }
9503 }
9504 impl C2Tuple_u32ScriptZ {
9505         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9506                 (self.a, self.b)
9507         }
9508 }
9509 impl Clone for C2Tuple_u32ScriptZ {
9510         fn clone(&self) -> Self {
9511                 Self {
9512                         a: Clone::clone(&self.a),
9513                         b: Clone::clone(&self.b),
9514                 }
9515         }
9516 }
9517 #[no_mangle]
9518 /// Creates a new tuple which has the same data as `orig`
9519 /// but with all dynamically-allocated buffers duplicated in new buffers.
9520 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9521 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9522 #[no_mangle]
9523 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9524         C2Tuple_u32ScriptZ { a, b, }
9525 }
9526
9527 #[no_mangle]
9528 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9529 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9530 #[repr(C)]
9531 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9532 /// This corresponds to std::vector in C++
9533 pub struct CVec_C2Tuple_u32ScriptZZ {
9534         /// The elements in the array.
9535         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9536         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9537         /// The number of elements pointed to by `data`.
9538         pub datalen: usize
9539 }
9540 impl CVec_C2Tuple_u32ScriptZZ {
9541         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9542                 if self.datalen == 0 { return Vec::new(); }
9543                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9544                 self.data = core::ptr::null_mut();
9545                 self.datalen = 0;
9546                 ret
9547         }
9548         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9549                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9550         }
9551 }
9552 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9553         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9554                 let datalen = v.len();
9555                 let data = Box::into_raw(v.into_boxed_slice());
9556                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9557         }
9558 }
9559 #[no_mangle]
9560 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9561 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9562 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9563         fn drop(&mut self) {
9564                 if self.datalen == 0 { return; }
9565                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9566         }
9567 }
9568 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9569         fn clone(&self) -> Self {
9570                 let mut res = Vec::new();
9571                 if self.datalen == 0 { return Self::from(res); }
9572                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9573                 Self::from(res)
9574         }
9575 }
9576 #[repr(C)]
9577 /// A tuple of 2 elements. See the individual fields for the types contained.
9578 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9579         /// The element at position 0
9580         pub a: crate::c_types::ThirtyTwoBytes,
9581         /// The element at position 1
9582         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9583 }
9584 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9585         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9586                 Self {
9587                         a: tup.0,
9588                         b: tup.1,
9589                 }
9590         }
9591 }
9592 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9593         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9594                 (self.a, self.b)
9595         }
9596 }
9597 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9598         fn clone(&self) -> Self {
9599                 Self {
9600                         a: Clone::clone(&self.a),
9601                         b: Clone::clone(&self.b),
9602                 }
9603         }
9604 }
9605 #[no_mangle]
9606 /// Creates a new tuple which has the same data as `orig`
9607 /// but with all dynamically-allocated buffers duplicated in new buffers.
9608 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9609 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9610 #[no_mangle]
9611 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 {
9612         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9613 }
9614
9615 #[no_mangle]
9616 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9617 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9618 #[repr(C)]
9619 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9620 /// This corresponds to std::vector in C++
9621 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9622         /// The elements in the array.
9623         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9624         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9625         /// The number of elements pointed to by `data`.
9626         pub datalen: usize
9627 }
9628 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9629         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9630                 if self.datalen == 0 { return Vec::new(); }
9631                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9632                 self.data = core::ptr::null_mut();
9633                 self.datalen = 0;
9634                 ret
9635         }
9636         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9637                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9638         }
9639 }
9640 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9641         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9642                 let datalen = v.len();
9643                 let data = Box::into_raw(v.into_boxed_slice());
9644                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9645         }
9646 }
9647 #[no_mangle]
9648 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9649 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9650 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9651         fn drop(&mut self) {
9652                 if self.datalen == 0 { return; }
9653                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9654         }
9655 }
9656 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9657         fn clone(&self) -> Self {
9658                 let mut res = Vec::new();
9659                 if self.datalen == 0 { return Self::from(res); }
9660                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9661                 Self::from(res)
9662         }
9663 }
9664 #[repr(C)]
9665 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9666 /// This corresponds to std::vector in C++
9667 pub struct CVec_EventZ {
9668         /// The elements in the array.
9669         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9670         pub data: *mut crate::lightning::util::events::Event,
9671         /// The number of elements pointed to by `data`.
9672         pub datalen: usize
9673 }
9674 impl CVec_EventZ {
9675         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9676                 if self.datalen == 0 { return Vec::new(); }
9677                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9678                 self.data = core::ptr::null_mut();
9679                 self.datalen = 0;
9680                 ret
9681         }
9682         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9683                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9684         }
9685 }
9686 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9687         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9688                 let datalen = v.len();
9689                 let data = Box::into_raw(v.into_boxed_slice());
9690                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9691         }
9692 }
9693 #[no_mangle]
9694 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9695 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9696 impl Drop for CVec_EventZ {
9697         fn drop(&mut self) {
9698                 if self.datalen == 0 { return; }
9699                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9700         }
9701 }
9702 impl Clone for CVec_EventZ {
9703         fn clone(&self) -> Self {
9704                 let mut res = Vec::new();
9705                 if self.datalen == 0 { return Self::from(res); }
9706                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9707                 Self::from(res)
9708         }
9709 }
9710 #[repr(C)]
9711 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9712 /// This corresponds to std::vector in C++
9713 pub struct CVec_TransactionZ {
9714         /// The elements in the array.
9715         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9716         pub data: *mut crate::c_types::Transaction,
9717         /// The number of elements pointed to by `data`.
9718         pub datalen: usize
9719 }
9720 impl CVec_TransactionZ {
9721         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9722                 if self.datalen == 0 { return Vec::new(); }
9723                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9724                 self.data = core::ptr::null_mut();
9725                 self.datalen = 0;
9726                 ret
9727         }
9728         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9729                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9730         }
9731 }
9732 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9733         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9734                 let datalen = v.len();
9735                 let data = Box::into_raw(v.into_boxed_slice());
9736                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9737         }
9738 }
9739 #[no_mangle]
9740 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9741 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9742 impl Drop for CVec_TransactionZ {
9743         fn drop(&mut self) {
9744                 if self.datalen == 0 { return; }
9745                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9746         }
9747 }
9748 impl Clone for CVec_TransactionZ {
9749         fn clone(&self) -> Self {
9750                 let mut res = Vec::new();
9751                 if self.datalen == 0 { return Self::from(res); }
9752                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9753                 Self::from(res)
9754         }
9755 }
9756 #[repr(C)]
9757 /// A tuple of 2 elements. See the individual fields for the types contained.
9758 pub struct C2Tuple_u32TxOutZ {
9759         /// The element at position 0
9760         pub a: u32,
9761         /// The element at position 1
9762         pub b: crate::c_types::TxOut,
9763 }
9764 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9765         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9766                 Self {
9767                         a: tup.0,
9768                         b: tup.1,
9769                 }
9770         }
9771 }
9772 impl C2Tuple_u32TxOutZ {
9773         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9774                 (self.a, self.b)
9775         }
9776 }
9777 impl Clone for C2Tuple_u32TxOutZ {
9778         fn clone(&self) -> Self {
9779                 Self {
9780                         a: Clone::clone(&self.a),
9781                         b: Clone::clone(&self.b),
9782                 }
9783         }
9784 }
9785 #[no_mangle]
9786 /// Creates a new tuple which has the same data as `orig`
9787 /// but with all dynamically-allocated buffers duplicated in new buffers.
9788 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9789 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9790 #[no_mangle]
9791 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9792         C2Tuple_u32TxOutZ { a, b, }
9793 }
9794
9795 #[no_mangle]
9796 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9797 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9798 #[repr(C)]
9799 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9800 /// This corresponds to std::vector in C++
9801 pub struct CVec_C2Tuple_u32TxOutZZ {
9802         /// The elements in the array.
9803         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9804         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9805         /// The number of elements pointed to by `data`.
9806         pub datalen: usize
9807 }
9808 impl CVec_C2Tuple_u32TxOutZZ {
9809         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9810                 if self.datalen == 0 { return Vec::new(); }
9811                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9812                 self.data = core::ptr::null_mut();
9813                 self.datalen = 0;
9814                 ret
9815         }
9816         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9817                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9818         }
9819 }
9820 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9821         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9822                 let datalen = v.len();
9823                 let data = Box::into_raw(v.into_boxed_slice());
9824                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9825         }
9826 }
9827 #[no_mangle]
9828 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9829 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9830 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9831         fn drop(&mut self) {
9832                 if self.datalen == 0 { return; }
9833                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9834         }
9835 }
9836 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9837         fn clone(&self) -> Self {
9838                 let mut res = Vec::new();
9839                 if self.datalen == 0 { return Self::from(res); }
9840                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9841                 Self::from(res)
9842         }
9843 }
9844 #[repr(C)]
9845 /// A tuple of 2 elements. See the individual fields for the types contained.
9846 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9847         /// The element at position 0
9848         pub a: crate::c_types::ThirtyTwoBytes,
9849         /// The element at position 1
9850         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9851 }
9852 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9853         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9854                 Self {
9855                         a: tup.0,
9856                         b: tup.1,
9857                 }
9858         }
9859 }
9860 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9861         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9862                 (self.a, self.b)
9863         }
9864 }
9865 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9866         fn clone(&self) -> Self {
9867                 Self {
9868                         a: Clone::clone(&self.a),
9869                         b: Clone::clone(&self.b),
9870                 }
9871         }
9872 }
9873 #[no_mangle]
9874 /// Creates a new tuple which has the same data as `orig`
9875 /// but with all dynamically-allocated buffers duplicated in new buffers.
9876 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9877 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9878 #[no_mangle]
9879 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 {
9880         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9881 }
9882
9883 #[no_mangle]
9884 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9885 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9886 #[repr(C)]
9887 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9888 /// This corresponds to std::vector in C++
9889 pub struct CVec_TransactionOutputsZ {
9890         /// The elements in the array.
9891         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9892         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9893         /// The number of elements pointed to by `data`.
9894         pub datalen: usize
9895 }
9896 impl CVec_TransactionOutputsZ {
9897         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9898                 if self.datalen == 0 { return Vec::new(); }
9899                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9900                 self.data = core::ptr::null_mut();
9901                 self.datalen = 0;
9902                 ret
9903         }
9904         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9905                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9906         }
9907 }
9908 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9909         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9910                 let datalen = v.len();
9911                 let data = Box::into_raw(v.into_boxed_slice());
9912                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9913         }
9914 }
9915 #[no_mangle]
9916 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9917 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9918 impl Drop for CVec_TransactionOutputsZ {
9919         fn drop(&mut self) {
9920                 if self.datalen == 0 { return; }
9921                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9922         }
9923 }
9924 impl Clone for CVec_TransactionOutputsZ {
9925         fn clone(&self) -> Self {
9926                 let mut res = Vec::new();
9927                 if self.datalen == 0 { return Self::from(res); }
9928                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9929                 Self::from(res)
9930         }
9931 }
9932 #[repr(C)]
9933 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9934 /// This corresponds to std::vector in C++
9935 pub struct CVec_BalanceZ {
9936         /// The elements in the array.
9937         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9938         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9939         /// The number of elements pointed to by `data`.
9940         pub datalen: usize
9941 }
9942 impl CVec_BalanceZ {
9943         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9944                 if self.datalen == 0 { return Vec::new(); }
9945                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9946                 self.data = core::ptr::null_mut();
9947                 self.datalen = 0;
9948                 ret
9949         }
9950         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9951                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9952         }
9953 }
9954 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9955         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9956                 let datalen = v.len();
9957                 let data = Box::into_raw(v.into_boxed_slice());
9958                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9959         }
9960 }
9961 #[no_mangle]
9962 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9963 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9964 impl Drop for CVec_BalanceZ {
9965         fn drop(&mut self) {
9966                 if self.datalen == 0 { return; }
9967                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9968         }
9969 }
9970 impl Clone for CVec_BalanceZ {
9971         fn clone(&self) -> Self {
9972                 let mut res = Vec::new();
9973                 if self.datalen == 0 { return Self::from(res); }
9974                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9975                 Self::from(res)
9976         }
9977 }
9978 #[repr(C)]
9979 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9980 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9981         /// A pointer to the contents in the success state.
9982         /// Reading from this pointer when `result_ok` is not set is undefined.
9983         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9984         /// A pointer to the contents in the error state.
9985         /// Reading from this pointer when `result_ok` is set is undefined.
9986         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9987 }
9988 #[repr(C)]
9989 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9990 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9992 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9993         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9994         /// `err` or `result` depending on the state of `result_ok`.
9995         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9996         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9997         pub result_ok: bool,
9998 }
9999 #[no_mangle]
10000 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10001 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10002         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10003                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10004                         result: Box::into_raw(Box::new(o)),
10005                 },
10006                 result_ok: true,
10007         }
10008 }
10009 #[no_mangle]
10010 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10011 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10012         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10013                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10014                         err: Box::into_raw(Box::new(e)),
10015                 },
10016                 result_ok: false,
10017         }
10018 }
10019 /// Checks if the given object is currently in the success state
10020 #[no_mangle]
10021 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10022         o.result_ok
10023 }
10024 #[no_mangle]
10025 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10026 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10027 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10028         fn drop(&mut self) {
10029                 if self.result_ok {
10030                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10031                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10032                         }
10033                 } else {
10034                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10035                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10036                         }
10037                 }
10038         }
10039 }
10040 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10041         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10042                 let contents = if o.result_ok {
10043                         let result = unsafe { o.contents.result };
10044                         unsafe { o.contents.result = core::ptr::null_mut() };
10045                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10046                 } else {
10047                         let err = unsafe { o.contents.err };
10048                         unsafe { o.contents.err = core::ptr::null_mut(); }
10049                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10050                 };
10051                 Self {
10052                         contents,
10053                         result_ok: o.result_ok,
10054                 }
10055         }
10056 }
10057 #[repr(C)]
10058 /// The contents of CResult_NoneLightningErrorZ
10059 pub union CResult_NoneLightningErrorZPtr {
10060         /// Note that this value is always NULL, as there are no contents in the OK variant
10061         pub result: *mut core::ffi::c_void,
10062         /// A pointer to the contents in the error state.
10063         /// Reading from this pointer when `result_ok` is set is undefined.
10064         pub err: *mut crate::lightning::ln::msgs::LightningError,
10065 }
10066 #[repr(C)]
10067 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10068 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10070 pub struct CResult_NoneLightningErrorZ {
10071         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10072         /// `err` or `result` depending on the state of `result_ok`.
10073         pub contents: CResult_NoneLightningErrorZPtr,
10074         /// Whether this CResult_NoneLightningErrorZ represents a success state.
10075         pub result_ok: bool,
10076 }
10077 #[no_mangle]
10078 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10079 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10080         CResult_NoneLightningErrorZ {
10081                 contents: CResult_NoneLightningErrorZPtr {
10082                         result: core::ptr::null_mut(),
10083                 },
10084                 result_ok: true,
10085         }
10086 }
10087 #[no_mangle]
10088 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10089 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10090         CResult_NoneLightningErrorZ {
10091                 contents: CResult_NoneLightningErrorZPtr {
10092                         err: Box::into_raw(Box::new(e)),
10093                 },
10094                 result_ok: false,
10095         }
10096 }
10097 /// Checks if the given object is currently in the success state
10098 #[no_mangle]
10099 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10100         o.result_ok
10101 }
10102 #[no_mangle]
10103 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10104 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10105 impl Drop for CResult_NoneLightningErrorZ {
10106         fn drop(&mut self) {
10107                 if self.result_ok {
10108                 } else {
10109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10111                         }
10112                 }
10113         }
10114 }
10115 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10117                 let contents = if o.result_ok {
10118                         let _ = unsafe { Box::from_raw(o.contents.result) };
10119                         o.contents.result = core::ptr::null_mut();
10120                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10121                 } else {
10122                         let err = unsafe { o.contents.err };
10123                         unsafe { o.contents.err = core::ptr::null_mut(); }
10124                         CResult_NoneLightningErrorZPtr { err }
10125                 };
10126                 Self {
10127                         contents,
10128                         result_ok: o.result_ok,
10129                 }
10130         }
10131 }
10132 impl Clone for CResult_NoneLightningErrorZ {
10133         fn clone(&self) -> Self {
10134                 if self.result_ok {
10135                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10136                                 result: core::ptr::null_mut()
10137                         } }
10138                 } else {
10139                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10141                         } }
10142                 }
10143         }
10144 }
10145 #[no_mangle]
10146 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10147 /// but with all dynamically-allocated buffers duplicated in new buffers.
10148 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10149 #[repr(C)]
10150 /// A tuple of 2 elements. See the individual fields for the types contained.
10151 pub struct C2Tuple_PublicKeyTypeZ {
10152         /// The element at position 0
10153         pub a: crate::c_types::PublicKey,
10154         /// The element at position 1
10155         pub b: crate::lightning::ln::wire::Type,
10156 }
10157 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10158         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10159                 Self {
10160                         a: tup.0,
10161                         b: tup.1,
10162                 }
10163         }
10164 }
10165 impl C2Tuple_PublicKeyTypeZ {
10166         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10167                 (self.a, self.b)
10168         }
10169 }
10170 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10171 #[no_mangle]
10172 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10173         C2Tuple_PublicKeyTypeZ { a, b, }
10174 }
10175
10176 #[no_mangle]
10177 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10178 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10179 #[repr(C)]
10180 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10181 /// This corresponds to std::vector in C++
10182 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10183         /// The elements in the array.
10184         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10185         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10186         /// The number of elements pointed to by `data`.
10187         pub datalen: usize
10188 }
10189 impl CVec_C2Tuple_PublicKeyTypeZZ {
10190         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10191                 if self.datalen == 0 { return Vec::new(); }
10192                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10193                 self.data = core::ptr::null_mut();
10194                 self.datalen = 0;
10195                 ret
10196         }
10197         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10198                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10199         }
10200 }
10201 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10202         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10203                 let datalen = v.len();
10204                 let data = Box::into_raw(v.into_boxed_slice());
10205                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10206         }
10207 }
10208 #[no_mangle]
10209 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10210 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10211 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10212         fn drop(&mut self) {
10213                 if self.datalen == 0 { return; }
10214                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10215         }
10216 }
10217 #[repr(C)]
10218 /// The contents of CResult_boolLightningErrorZ
10219 pub union CResult_boolLightningErrorZPtr {
10220         /// A pointer to the contents in the success state.
10221         /// Reading from this pointer when `result_ok` is not set is undefined.
10222         pub result: *mut bool,
10223         /// A pointer to the contents in the error state.
10224         /// Reading from this pointer when `result_ok` is set is undefined.
10225         pub err: *mut crate::lightning::ln::msgs::LightningError,
10226 }
10227 #[repr(C)]
10228 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10229 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10231 pub struct CResult_boolLightningErrorZ {
10232         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10233         /// `err` or `result` depending on the state of `result_ok`.
10234         pub contents: CResult_boolLightningErrorZPtr,
10235         /// Whether this CResult_boolLightningErrorZ represents a success state.
10236         pub result_ok: bool,
10237 }
10238 #[no_mangle]
10239 /// Creates a new CResult_boolLightningErrorZ in the success state.
10240 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10241         CResult_boolLightningErrorZ {
10242                 contents: CResult_boolLightningErrorZPtr {
10243                         result: Box::into_raw(Box::new(o)),
10244                 },
10245                 result_ok: true,
10246         }
10247 }
10248 #[no_mangle]
10249 /// Creates a new CResult_boolLightningErrorZ in the error state.
10250 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10251         CResult_boolLightningErrorZ {
10252                 contents: CResult_boolLightningErrorZPtr {
10253                         err: Box::into_raw(Box::new(e)),
10254                 },
10255                 result_ok: false,
10256         }
10257 }
10258 /// Checks if the given object is currently in the success state
10259 #[no_mangle]
10260 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10261         o.result_ok
10262 }
10263 #[no_mangle]
10264 /// Frees any resources used by the CResult_boolLightningErrorZ.
10265 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10266 impl Drop for CResult_boolLightningErrorZ {
10267         fn drop(&mut self) {
10268                 if self.result_ok {
10269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10271                         }
10272                 } else {
10273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10275                         }
10276                 }
10277         }
10278 }
10279 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10280         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10281                 let contents = if o.result_ok {
10282                         let result = unsafe { o.contents.result };
10283                         unsafe { o.contents.result = core::ptr::null_mut() };
10284                         CResult_boolLightningErrorZPtr { result }
10285                 } else {
10286                         let err = unsafe { o.contents.err };
10287                         unsafe { o.contents.err = core::ptr::null_mut(); }
10288                         CResult_boolLightningErrorZPtr { err }
10289                 };
10290                 Self {
10291                         contents,
10292                         result_ok: o.result_ok,
10293                 }
10294         }
10295 }
10296 impl Clone for CResult_boolLightningErrorZ {
10297         fn clone(&self) -> Self {
10298                 if self.result_ok {
10299                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10300                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10301                         } }
10302                 } else {
10303                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10305                         } }
10306                 }
10307         }
10308 }
10309 #[no_mangle]
10310 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10311 /// but with all dynamically-allocated buffers duplicated in new buffers.
10312 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10313 #[repr(C)]
10314 /// A tuple of 3 elements. See the individual fields for the types contained.
10315 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10316         /// The element at position 0
10317         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10318         /// The element at position 1
10319         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10320         /// The element at position 2
10321         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10322 }
10323 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10324         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10325                 Self {
10326                         a: tup.0,
10327                         b: tup.1,
10328                         c: tup.2,
10329                 }
10330         }
10331 }
10332 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10333         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10334                 (self.a, self.b, self.c)
10335         }
10336 }
10337 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10338         fn clone(&self) -> Self {
10339                 Self {
10340                         a: Clone::clone(&self.a),
10341                         b: Clone::clone(&self.b),
10342                         c: Clone::clone(&self.c),
10343                 }
10344         }
10345 }
10346 #[no_mangle]
10347 /// Creates a new tuple which has the same data as `orig`
10348 /// but with all dynamically-allocated buffers duplicated in new buffers.
10349 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10350 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10351 #[no_mangle]
10352 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 {
10353         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10354 }
10355
10356 #[no_mangle]
10357 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10358 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10359 #[repr(C)]
10360 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10361 /// This corresponds to std::vector in C++
10362 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10363         /// The elements in the array.
10364         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10365         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10366         /// The number of elements pointed to by `data`.
10367         pub datalen: usize
10368 }
10369 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10370         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10371                 if self.datalen == 0 { return Vec::new(); }
10372                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10373                 self.data = core::ptr::null_mut();
10374                 self.datalen = 0;
10375                 ret
10376         }
10377         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10378                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10379         }
10380 }
10381 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10382         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10383                 let datalen = v.len();
10384                 let data = Box::into_raw(v.into_boxed_slice());
10385                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10386         }
10387 }
10388 #[no_mangle]
10389 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10390 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10391 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10392         fn drop(&mut self) {
10393                 if self.datalen == 0 { return; }
10394                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10395         }
10396 }
10397 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10398         fn clone(&self) -> Self {
10399                 let mut res = Vec::new();
10400                 if self.datalen == 0 { return Self::from(res); }
10401                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10402                 Self::from(res)
10403         }
10404 }
10405 #[repr(C)]
10406 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10407 /// This corresponds to std::vector in C++
10408 pub struct CVec_NodeAnnouncementZ {
10409         /// The elements in the array.
10410         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10411         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10412         /// The number of elements pointed to by `data`.
10413         pub datalen: usize
10414 }
10415 impl CVec_NodeAnnouncementZ {
10416         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10417                 if self.datalen == 0 { return Vec::new(); }
10418                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10419                 self.data = core::ptr::null_mut();
10420                 self.datalen = 0;
10421                 ret
10422         }
10423         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10424                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10425         }
10426 }
10427 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10428         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10429                 let datalen = v.len();
10430                 let data = Box::into_raw(v.into_boxed_slice());
10431                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10432         }
10433 }
10434 #[no_mangle]
10435 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10436 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10437 impl Drop for CVec_NodeAnnouncementZ {
10438         fn drop(&mut self) {
10439                 if self.datalen == 0 { return; }
10440                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10441         }
10442 }
10443 impl Clone for CVec_NodeAnnouncementZ {
10444         fn clone(&self) -> Self {
10445                 let mut res = Vec::new();
10446                 if self.datalen == 0 { return Self::from(res); }
10447                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10448                 Self::from(res)
10449         }
10450 }
10451 #[repr(C)]
10452 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10453 /// This corresponds to std::vector in C++
10454 pub struct CVec_PublicKeyZ {
10455         /// The elements in the array.
10456         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10457         pub data: *mut crate::c_types::PublicKey,
10458         /// The number of elements pointed to by `data`.
10459         pub datalen: usize
10460 }
10461 impl CVec_PublicKeyZ {
10462         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10463                 if self.datalen == 0 { return Vec::new(); }
10464                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10465                 self.data = core::ptr::null_mut();
10466                 self.datalen = 0;
10467                 ret
10468         }
10469         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10470                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10471         }
10472 }
10473 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10474         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10475                 let datalen = v.len();
10476                 let data = Box::into_raw(v.into_boxed_slice());
10477                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10478         }
10479 }
10480 #[no_mangle]
10481 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10482 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10483 impl Drop for CVec_PublicKeyZ {
10484         fn drop(&mut self) {
10485                 if self.datalen == 0 { return; }
10486                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10487         }
10488 }
10489 impl Clone for CVec_PublicKeyZ {
10490         fn clone(&self) -> Self {
10491                 let mut res = Vec::new();
10492                 if self.datalen == 0 { return Self::from(res); }
10493                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10494                 Self::from(res)
10495         }
10496 }
10497 #[repr(C)]
10498 #[derive(Clone)]
10499 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10500 pub enum COption_NetAddressZ {
10501         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10502         Some(crate::lightning::ln::msgs::NetAddress),
10503         /// When we're in this state, this COption_NetAddressZ contains nothing
10504         None
10505 }
10506 impl COption_NetAddressZ {
10507         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10508                 if let Self::None = self { false } else { true }
10509         }
10510         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10511                 !self.is_some()
10512         }
10513         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
10514                 if let Self::Some(v) = self { v } else { unreachable!() }
10515         }
10516 }
10517 #[no_mangle]
10518 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
10519 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
10520         COption_NetAddressZ::Some(o)
10521 }
10522 #[no_mangle]
10523 /// Constructs a new COption_NetAddressZ containing nothing
10524 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
10525         COption_NetAddressZ::None
10526 }
10527 #[no_mangle]
10528 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
10529 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
10530 #[no_mangle]
10531 /// Creates a new COption_NetAddressZ which has the same data as `orig`
10532 /// but with all dynamically-allocated buffers duplicated in new buffers.
10533 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
10534 #[repr(C)]
10535 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10536 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10537         /// A pointer to the contents in the success state.
10538         /// Reading from this pointer when `result_ok` is not set is undefined.
10539         pub result: *mut crate::c_types::derived::CVec_u8Z,
10540         /// A pointer to the contents in the error state.
10541         /// Reading from this pointer when `result_ok` is set is undefined.
10542         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10543 }
10544 #[repr(C)]
10545 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10546 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10547 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10548 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10549         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10550         /// `err` or `result` depending on the state of `result_ok`.
10551         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10552         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10553         pub result_ok: bool,
10554 }
10555 #[no_mangle]
10556 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10557 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10558         CResult_CVec_u8ZPeerHandleErrorZ {
10559                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10560                         result: Box::into_raw(Box::new(o)),
10561                 },
10562                 result_ok: true,
10563         }
10564 }
10565 #[no_mangle]
10566 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10567 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10568         CResult_CVec_u8ZPeerHandleErrorZ {
10569                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10570                         err: Box::into_raw(Box::new(e)),
10571                 },
10572                 result_ok: false,
10573         }
10574 }
10575 /// Checks if the given object is currently in the success state
10576 #[no_mangle]
10577 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10578         o.result_ok
10579 }
10580 #[no_mangle]
10581 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10582 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10583 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10584         fn drop(&mut self) {
10585                 if self.result_ok {
10586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10588                         }
10589                 } else {
10590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10592                         }
10593                 }
10594         }
10595 }
10596 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10597         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10598                 let contents = if o.result_ok {
10599                         let result = unsafe { o.contents.result };
10600                         unsafe { o.contents.result = core::ptr::null_mut() };
10601                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10602                 } else {
10603                         let err = unsafe { o.contents.err };
10604                         unsafe { o.contents.err = core::ptr::null_mut(); }
10605                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10606                 };
10607                 Self {
10608                         contents,
10609                         result_ok: o.result_ok,
10610                 }
10611         }
10612 }
10613 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10614         fn clone(&self) -> Self {
10615                 if self.result_ok {
10616                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10617                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10618                         } }
10619                 } else {
10620                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10621                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10622                         } }
10623                 }
10624         }
10625 }
10626 #[no_mangle]
10627 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10628 /// but with all dynamically-allocated buffers duplicated in new buffers.
10629 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10630 #[repr(C)]
10631 /// The contents of CResult_NonePeerHandleErrorZ
10632 pub union CResult_NonePeerHandleErrorZPtr {
10633         /// Note that this value is always NULL, as there are no contents in the OK variant
10634         pub result: *mut core::ffi::c_void,
10635         /// A pointer to the contents in the error state.
10636         /// Reading from this pointer when `result_ok` is set is undefined.
10637         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10638 }
10639 #[repr(C)]
10640 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10641 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10642 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10643 pub struct CResult_NonePeerHandleErrorZ {
10644         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10645         /// `err` or `result` depending on the state of `result_ok`.
10646         pub contents: CResult_NonePeerHandleErrorZPtr,
10647         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10648         pub result_ok: bool,
10649 }
10650 #[no_mangle]
10651 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10652 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10653         CResult_NonePeerHandleErrorZ {
10654                 contents: CResult_NonePeerHandleErrorZPtr {
10655                         result: core::ptr::null_mut(),
10656                 },
10657                 result_ok: true,
10658         }
10659 }
10660 #[no_mangle]
10661 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10662 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10663         CResult_NonePeerHandleErrorZ {
10664                 contents: CResult_NonePeerHandleErrorZPtr {
10665                         err: Box::into_raw(Box::new(e)),
10666                 },
10667                 result_ok: false,
10668         }
10669 }
10670 /// Checks if the given object is currently in the success state
10671 #[no_mangle]
10672 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10673         o.result_ok
10674 }
10675 #[no_mangle]
10676 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10677 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10678 impl Drop for CResult_NonePeerHandleErrorZ {
10679         fn drop(&mut self) {
10680                 if self.result_ok {
10681                 } else {
10682                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10683                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10684                         }
10685                 }
10686         }
10687 }
10688 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10689         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10690                 let contents = if o.result_ok {
10691                         let _ = unsafe { Box::from_raw(o.contents.result) };
10692                         o.contents.result = core::ptr::null_mut();
10693                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10694                 } else {
10695                         let err = unsafe { o.contents.err };
10696                         unsafe { o.contents.err = core::ptr::null_mut(); }
10697                         CResult_NonePeerHandleErrorZPtr { err }
10698                 };
10699                 Self {
10700                         contents,
10701                         result_ok: o.result_ok,
10702                 }
10703         }
10704 }
10705 impl Clone for CResult_NonePeerHandleErrorZ {
10706         fn clone(&self) -> Self {
10707                 if self.result_ok {
10708                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10709                                 result: core::ptr::null_mut()
10710                         } }
10711                 } else {
10712                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10713                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10714                         } }
10715                 }
10716         }
10717 }
10718 #[no_mangle]
10719 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10720 /// but with all dynamically-allocated buffers duplicated in new buffers.
10721 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10722 #[repr(C)]
10723 /// The contents of CResult_boolPeerHandleErrorZ
10724 pub union CResult_boolPeerHandleErrorZPtr {
10725         /// A pointer to the contents in the success state.
10726         /// Reading from this pointer when `result_ok` is not set is undefined.
10727         pub result: *mut bool,
10728         /// A pointer to the contents in the error state.
10729         /// Reading from this pointer when `result_ok` is set is undefined.
10730         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10731 }
10732 #[repr(C)]
10733 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10734 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10735 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10736 pub struct CResult_boolPeerHandleErrorZ {
10737         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10738         /// `err` or `result` depending on the state of `result_ok`.
10739         pub contents: CResult_boolPeerHandleErrorZPtr,
10740         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10741         pub result_ok: bool,
10742 }
10743 #[no_mangle]
10744 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10745 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10746         CResult_boolPeerHandleErrorZ {
10747                 contents: CResult_boolPeerHandleErrorZPtr {
10748                         result: Box::into_raw(Box::new(o)),
10749                 },
10750                 result_ok: true,
10751         }
10752 }
10753 #[no_mangle]
10754 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10755 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10756         CResult_boolPeerHandleErrorZ {
10757                 contents: CResult_boolPeerHandleErrorZPtr {
10758                         err: Box::into_raw(Box::new(e)),
10759                 },
10760                 result_ok: false,
10761         }
10762 }
10763 /// Checks if the given object is currently in the success state
10764 #[no_mangle]
10765 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10766         o.result_ok
10767 }
10768 #[no_mangle]
10769 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10770 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10771 impl Drop for CResult_boolPeerHandleErrorZ {
10772         fn drop(&mut self) {
10773                 if self.result_ok {
10774                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10775                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10776                         }
10777                 } else {
10778                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10779                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10780                         }
10781                 }
10782         }
10783 }
10784 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10785         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10786                 let contents = if o.result_ok {
10787                         let result = unsafe { o.contents.result };
10788                         unsafe { o.contents.result = core::ptr::null_mut() };
10789                         CResult_boolPeerHandleErrorZPtr { result }
10790                 } else {
10791                         let err = unsafe { o.contents.err };
10792                         unsafe { o.contents.err = core::ptr::null_mut(); }
10793                         CResult_boolPeerHandleErrorZPtr { err }
10794                 };
10795                 Self {
10796                         contents,
10797                         result_ok: o.result_ok,
10798                 }
10799         }
10800 }
10801 impl Clone for CResult_boolPeerHandleErrorZ {
10802         fn clone(&self) -> Self {
10803                 if self.result_ok {
10804                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10805                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10806                         } }
10807                 } else {
10808                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10809                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10810                         } }
10811                 }
10812         }
10813 }
10814 #[no_mangle]
10815 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10816 /// but with all dynamically-allocated buffers duplicated in new buffers.
10817 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10818 #[repr(C)]
10819 /// The contents of CResult_NodeIdDecodeErrorZ
10820 pub union CResult_NodeIdDecodeErrorZPtr {
10821         /// A pointer to the contents in the success state.
10822         /// Reading from this pointer when `result_ok` is not set is undefined.
10823         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10824         /// A pointer to the contents in the error state.
10825         /// Reading from this pointer when `result_ok` is set is undefined.
10826         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10827 }
10828 #[repr(C)]
10829 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10830 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10831 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10832 pub struct CResult_NodeIdDecodeErrorZ {
10833         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10834         /// `err` or `result` depending on the state of `result_ok`.
10835         pub contents: CResult_NodeIdDecodeErrorZPtr,
10836         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10837         pub result_ok: bool,
10838 }
10839 #[no_mangle]
10840 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10841 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10842         CResult_NodeIdDecodeErrorZ {
10843                 contents: CResult_NodeIdDecodeErrorZPtr {
10844                         result: Box::into_raw(Box::new(o)),
10845                 },
10846                 result_ok: true,
10847         }
10848 }
10849 #[no_mangle]
10850 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10851 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10852         CResult_NodeIdDecodeErrorZ {
10853                 contents: CResult_NodeIdDecodeErrorZPtr {
10854                         err: Box::into_raw(Box::new(e)),
10855                 },
10856                 result_ok: false,
10857         }
10858 }
10859 /// Checks if the given object is currently in the success state
10860 #[no_mangle]
10861 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10862         o.result_ok
10863 }
10864 #[no_mangle]
10865 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10866 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10867 impl Drop for CResult_NodeIdDecodeErrorZ {
10868         fn drop(&mut self) {
10869                 if self.result_ok {
10870                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10871                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10872                         }
10873                 } else {
10874                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10875                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10876                         }
10877                 }
10878         }
10879 }
10880 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10881         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10882                 let contents = if o.result_ok {
10883                         let result = unsafe { o.contents.result };
10884                         unsafe { o.contents.result = core::ptr::null_mut() };
10885                         CResult_NodeIdDecodeErrorZPtr { result }
10886                 } else {
10887                         let err = unsafe { o.contents.err };
10888                         unsafe { o.contents.err = core::ptr::null_mut(); }
10889                         CResult_NodeIdDecodeErrorZPtr { err }
10890                 };
10891                 Self {
10892                         contents,
10893                         result_ok: o.result_ok,
10894                 }
10895         }
10896 }
10897 impl Clone for CResult_NodeIdDecodeErrorZ {
10898         fn clone(&self) -> Self {
10899                 if self.result_ok {
10900                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10901                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10902                         } }
10903                 } else {
10904                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10905                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10906                         } }
10907                 }
10908         }
10909 }
10910 #[no_mangle]
10911 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10912 /// but with all dynamically-allocated buffers duplicated in new buffers.
10913 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10914 #[repr(C)]
10915 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10916 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10917         /// A pointer to the contents in the success state.
10918         /// Reading from this pointer when `result_ok` is not set is undefined.
10919         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10920         /// A pointer to the contents in the error state.
10921         /// Reading from this pointer when `result_ok` is set is undefined.
10922         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10923 }
10924 #[repr(C)]
10925 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10926 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10927 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10928 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10929         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10930         /// `err` or `result` depending on the state of `result_ok`.
10931         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10932         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10933         pub result_ok: bool,
10934 }
10935 #[no_mangle]
10936 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10937 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10938         CResult_COption_NetworkUpdateZDecodeErrorZ {
10939                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10940                         result: Box::into_raw(Box::new(o)),
10941                 },
10942                 result_ok: true,
10943         }
10944 }
10945 #[no_mangle]
10946 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10947 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10948         CResult_COption_NetworkUpdateZDecodeErrorZ {
10949                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10950                         err: Box::into_raw(Box::new(e)),
10951                 },
10952                 result_ok: false,
10953         }
10954 }
10955 /// Checks if the given object is currently in the success state
10956 #[no_mangle]
10957 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10958         o.result_ok
10959 }
10960 #[no_mangle]
10961 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10962 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10963 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10964         fn drop(&mut self) {
10965                 if self.result_ok {
10966                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10967                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10968                         }
10969                 } else {
10970                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10971                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10972                         }
10973                 }
10974         }
10975 }
10976 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10977         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10978                 let contents = if o.result_ok {
10979                         let result = unsafe { o.contents.result };
10980                         unsafe { o.contents.result = core::ptr::null_mut() };
10981                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10982                 } else {
10983                         let err = unsafe { o.contents.err };
10984                         unsafe { o.contents.err = core::ptr::null_mut(); }
10985                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10986                 };
10987                 Self {
10988                         contents,
10989                         result_ok: o.result_ok,
10990                 }
10991         }
10992 }
10993 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10994         fn clone(&self) -> Self {
10995                 if self.result_ok {
10996                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10997                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10998                         } }
10999                 } else {
11000                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11001                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11002                         } }
11003                 }
11004         }
11005 }
11006 #[no_mangle]
11007 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11008 /// but with all dynamically-allocated buffers duplicated in new buffers.
11009 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11010 #[repr(C)]
11011 /// An enum which can either contain a crate::lightning::chain::Access or not
11012 pub enum COption_AccessZ {
11013         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11014         Some(crate::lightning::chain::Access),
11015         /// When we're in this state, this COption_AccessZ contains nothing
11016         None
11017 }
11018 impl COption_AccessZ {
11019         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11020                 if let Self::None = self { false } else { true }
11021         }
11022         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11023                 !self.is_some()
11024         }
11025         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11026                 if let Self::Some(v) = self { v } else { unreachable!() }
11027         }
11028 }
11029 #[no_mangle]
11030 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11031 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11032         COption_AccessZ::Some(o)
11033 }
11034 #[no_mangle]
11035 /// Constructs a new COption_AccessZ containing nothing
11036 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11037         COption_AccessZ::None
11038 }
11039 #[no_mangle]
11040 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11041 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11042 #[repr(C)]
11043 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11044 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11045         /// A pointer to the contents in the success state.
11046         /// Reading from this pointer when `result_ok` is not set is undefined.
11047         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11048         /// A pointer to the contents in the error state.
11049         /// Reading from this pointer when `result_ok` is set is undefined.
11050         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11051 }
11052 #[repr(C)]
11053 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11054 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11055 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11056 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11057         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11058         /// `err` or `result` depending on the state of `result_ok`.
11059         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11060         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11061         pub result_ok: bool,
11062 }
11063 #[no_mangle]
11064 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11065 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11066         CResult_ChannelUpdateInfoDecodeErrorZ {
11067                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11068                         result: Box::into_raw(Box::new(o)),
11069                 },
11070                 result_ok: true,
11071         }
11072 }
11073 #[no_mangle]
11074 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11075 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11076         CResult_ChannelUpdateInfoDecodeErrorZ {
11077                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11078                         err: Box::into_raw(Box::new(e)),
11079                 },
11080                 result_ok: false,
11081         }
11082 }
11083 /// Checks if the given object is currently in the success state
11084 #[no_mangle]
11085 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11086         o.result_ok
11087 }
11088 #[no_mangle]
11089 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11090 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11091 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11092         fn drop(&mut self) {
11093                 if self.result_ok {
11094                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11095                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11096                         }
11097                 } else {
11098                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11099                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11100                         }
11101                 }
11102         }
11103 }
11104 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11105         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11106                 let contents = if o.result_ok {
11107                         let result = unsafe { o.contents.result };
11108                         unsafe { o.contents.result = core::ptr::null_mut() };
11109                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11110                 } else {
11111                         let err = unsafe { o.contents.err };
11112                         unsafe { o.contents.err = core::ptr::null_mut(); }
11113                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11114                 };
11115                 Self {
11116                         contents,
11117                         result_ok: o.result_ok,
11118                 }
11119         }
11120 }
11121 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11122         fn clone(&self) -> Self {
11123                 if self.result_ok {
11124                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11125                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11126                         } }
11127                 } else {
11128                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11129                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11130                         } }
11131                 }
11132         }
11133 }
11134 #[no_mangle]
11135 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11136 /// but with all dynamically-allocated buffers duplicated in new buffers.
11137 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11138 #[repr(C)]
11139 /// The contents of CResult_ChannelInfoDecodeErrorZ
11140 pub union CResult_ChannelInfoDecodeErrorZPtr {
11141         /// A pointer to the contents in the success state.
11142         /// Reading from this pointer when `result_ok` is not set is undefined.
11143         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11144         /// A pointer to the contents in the error state.
11145         /// Reading from this pointer when `result_ok` is set is undefined.
11146         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11147 }
11148 #[repr(C)]
11149 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11150 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11151 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11152 pub struct CResult_ChannelInfoDecodeErrorZ {
11153         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11154         /// `err` or `result` depending on the state of `result_ok`.
11155         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11156         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11157         pub result_ok: bool,
11158 }
11159 #[no_mangle]
11160 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11161 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11162         CResult_ChannelInfoDecodeErrorZ {
11163                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11164                         result: Box::into_raw(Box::new(o)),
11165                 },
11166                 result_ok: true,
11167         }
11168 }
11169 #[no_mangle]
11170 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11171 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11172         CResult_ChannelInfoDecodeErrorZ {
11173                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11174                         err: Box::into_raw(Box::new(e)),
11175                 },
11176                 result_ok: false,
11177         }
11178 }
11179 /// Checks if the given object is currently in the success state
11180 #[no_mangle]
11181 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11182         o.result_ok
11183 }
11184 #[no_mangle]
11185 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11186 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11187 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11188         fn drop(&mut self) {
11189                 if self.result_ok {
11190                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11191                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11192                         }
11193                 } else {
11194                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11195                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11196                         }
11197                 }
11198         }
11199 }
11200 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11201         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11202                 let contents = if o.result_ok {
11203                         let result = unsafe { o.contents.result };
11204                         unsafe { o.contents.result = core::ptr::null_mut() };
11205                         CResult_ChannelInfoDecodeErrorZPtr { result }
11206                 } else {
11207                         let err = unsafe { o.contents.err };
11208                         unsafe { o.contents.err = core::ptr::null_mut(); }
11209                         CResult_ChannelInfoDecodeErrorZPtr { err }
11210                 };
11211                 Self {
11212                         contents,
11213                         result_ok: o.result_ok,
11214                 }
11215         }
11216 }
11217 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11218         fn clone(&self) -> Self {
11219                 if self.result_ok {
11220                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11221                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11222                         } }
11223                 } else {
11224                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11225                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11226                         } }
11227                 }
11228         }
11229 }
11230 #[no_mangle]
11231 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11232 /// but with all dynamically-allocated buffers duplicated in new buffers.
11233 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11234 #[repr(C)]
11235 /// The contents of CResult_RoutingFeesDecodeErrorZ
11236 pub union CResult_RoutingFeesDecodeErrorZPtr {
11237         /// A pointer to the contents in the success state.
11238         /// Reading from this pointer when `result_ok` is not set is undefined.
11239         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11240         /// A pointer to the contents in the error state.
11241         /// Reading from this pointer when `result_ok` is set is undefined.
11242         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11243 }
11244 #[repr(C)]
11245 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11246 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11247 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11248 pub struct CResult_RoutingFeesDecodeErrorZ {
11249         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11250         /// `err` or `result` depending on the state of `result_ok`.
11251         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11252         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11253         pub result_ok: bool,
11254 }
11255 #[no_mangle]
11256 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11257 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11258         CResult_RoutingFeesDecodeErrorZ {
11259                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11260                         result: Box::into_raw(Box::new(o)),
11261                 },
11262                 result_ok: true,
11263         }
11264 }
11265 #[no_mangle]
11266 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11267 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11268         CResult_RoutingFeesDecodeErrorZ {
11269                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11270                         err: Box::into_raw(Box::new(e)),
11271                 },
11272                 result_ok: false,
11273         }
11274 }
11275 /// Checks if the given object is currently in the success state
11276 #[no_mangle]
11277 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11278         o.result_ok
11279 }
11280 #[no_mangle]
11281 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11282 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11283 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11284         fn drop(&mut self) {
11285                 if self.result_ok {
11286                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11287                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11288                         }
11289                 } else {
11290                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11291                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11292                         }
11293                 }
11294         }
11295 }
11296 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11297         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11298                 let contents = if o.result_ok {
11299                         let result = unsafe { o.contents.result };
11300                         unsafe { o.contents.result = core::ptr::null_mut() };
11301                         CResult_RoutingFeesDecodeErrorZPtr { result }
11302                 } else {
11303                         let err = unsafe { o.contents.err };
11304                         unsafe { o.contents.err = core::ptr::null_mut(); }
11305                         CResult_RoutingFeesDecodeErrorZPtr { err }
11306                 };
11307                 Self {
11308                         contents,
11309                         result_ok: o.result_ok,
11310                 }
11311         }
11312 }
11313 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11314         fn clone(&self) -> Self {
11315                 if self.result_ok {
11316                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11317                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11318                         } }
11319                 } else {
11320                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11321                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11322                         } }
11323                 }
11324         }
11325 }
11326 #[no_mangle]
11327 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11328 /// but with all dynamically-allocated buffers duplicated in new buffers.
11329 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11330 #[repr(C)]
11331 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11332 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11333         /// A pointer to the contents in the success state.
11334         /// Reading from this pointer when `result_ok` is not set is undefined.
11335         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11336         /// A pointer to the contents in the error state.
11337         /// Reading from this pointer when `result_ok` is set is undefined.
11338         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11339 }
11340 #[repr(C)]
11341 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11342 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11343 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11344 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11345         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11346         /// `err` or `result` depending on the state of `result_ok`.
11347         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11348         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11349         pub result_ok: bool,
11350 }
11351 #[no_mangle]
11352 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11353 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11354         CResult_NodeAnnouncementInfoDecodeErrorZ {
11355                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11356                         result: Box::into_raw(Box::new(o)),
11357                 },
11358                 result_ok: true,
11359         }
11360 }
11361 #[no_mangle]
11362 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11363 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11364         CResult_NodeAnnouncementInfoDecodeErrorZ {
11365                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11366                         err: Box::into_raw(Box::new(e)),
11367                 },
11368                 result_ok: false,
11369         }
11370 }
11371 /// Checks if the given object is currently in the success state
11372 #[no_mangle]
11373 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11374         o.result_ok
11375 }
11376 #[no_mangle]
11377 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11378 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11379 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11380         fn drop(&mut self) {
11381                 if self.result_ok {
11382                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11383                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11384                         }
11385                 } else {
11386                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11387                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11388                         }
11389                 }
11390         }
11391 }
11392 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11393         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11394                 let contents = if o.result_ok {
11395                         let result = unsafe { o.contents.result };
11396                         unsafe { o.contents.result = core::ptr::null_mut() };
11397                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11398                 } else {
11399                         let err = unsafe { o.contents.err };
11400                         unsafe { o.contents.err = core::ptr::null_mut(); }
11401                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11402                 };
11403                 Self {
11404                         contents,
11405                         result_ok: o.result_ok,
11406                 }
11407         }
11408 }
11409 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11410         fn clone(&self) -> Self {
11411                 if self.result_ok {
11412                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11413                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11414                         } }
11415                 } else {
11416                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11417                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11418                         } }
11419                 }
11420         }
11421 }
11422 #[no_mangle]
11423 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11424 /// but with all dynamically-allocated buffers duplicated in new buffers.
11425 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11426 #[repr(C)]
11427 /// A dynamically-allocated array of u64s of arbitrary size.
11428 /// This corresponds to std::vector in C++
11429 pub struct CVec_u64Z {
11430         /// The elements in the array.
11431         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11432         pub data: *mut u64,
11433         /// The number of elements pointed to by `data`.
11434         pub datalen: usize
11435 }
11436 impl CVec_u64Z {
11437         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11438                 if self.datalen == 0 { return Vec::new(); }
11439                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11440                 self.data = core::ptr::null_mut();
11441                 self.datalen = 0;
11442                 ret
11443         }
11444         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11445                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11446         }
11447 }
11448 impl From<Vec<u64>> for CVec_u64Z {
11449         fn from(v: Vec<u64>) -> Self {
11450                 let datalen = v.len();
11451                 let data = Box::into_raw(v.into_boxed_slice());
11452                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11453         }
11454 }
11455 #[no_mangle]
11456 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11457 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11458 impl Drop for CVec_u64Z {
11459         fn drop(&mut self) {
11460                 if self.datalen == 0 { return; }
11461                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11462         }
11463 }
11464 impl Clone for CVec_u64Z {
11465         fn clone(&self) -> Self {
11466                 let mut res = Vec::new();
11467                 if self.datalen == 0 { return Self::from(res); }
11468                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11469                 Self::from(res)
11470         }
11471 }
11472 #[repr(C)]
11473 /// The contents of CResult_NodeInfoDecodeErrorZ
11474 pub union CResult_NodeInfoDecodeErrorZPtr {
11475         /// A pointer to the contents in the success state.
11476         /// Reading from this pointer when `result_ok` is not set is undefined.
11477         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11478         /// A pointer to the contents in the error state.
11479         /// Reading from this pointer when `result_ok` is set is undefined.
11480         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11481 }
11482 #[repr(C)]
11483 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11484 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11486 pub struct CResult_NodeInfoDecodeErrorZ {
11487         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11488         /// `err` or `result` depending on the state of `result_ok`.
11489         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11490         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11491         pub result_ok: bool,
11492 }
11493 #[no_mangle]
11494 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11495 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11496         CResult_NodeInfoDecodeErrorZ {
11497                 contents: CResult_NodeInfoDecodeErrorZPtr {
11498                         result: Box::into_raw(Box::new(o)),
11499                 },
11500                 result_ok: true,
11501         }
11502 }
11503 #[no_mangle]
11504 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11505 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11506         CResult_NodeInfoDecodeErrorZ {
11507                 contents: CResult_NodeInfoDecodeErrorZPtr {
11508                         err: Box::into_raw(Box::new(e)),
11509                 },
11510                 result_ok: false,
11511         }
11512 }
11513 /// Checks if the given object is currently in the success state
11514 #[no_mangle]
11515 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11516         o.result_ok
11517 }
11518 #[no_mangle]
11519 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11520 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11521 impl Drop for CResult_NodeInfoDecodeErrorZ {
11522         fn drop(&mut self) {
11523                 if self.result_ok {
11524                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11525                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11526                         }
11527                 } else {
11528                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11529                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11530                         }
11531                 }
11532         }
11533 }
11534 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11535         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11536                 let contents = if o.result_ok {
11537                         let result = unsafe { o.contents.result };
11538                         unsafe { o.contents.result = core::ptr::null_mut() };
11539                         CResult_NodeInfoDecodeErrorZPtr { result }
11540                 } else {
11541                         let err = unsafe { o.contents.err };
11542                         unsafe { o.contents.err = core::ptr::null_mut(); }
11543                         CResult_NodeInfoDecodeErrorZPtr { err }
11544                 };
11545                 Self {
11546                         contents,
11547                         result_ok: o.result_ok,
11548                 }
11549         }
11550 }
11551 impl Clone for CResult_NodeInfoDecodeErrorZ {
11552         fn clone(&self) -> Self {
11553                 if self.result_ok {
11554                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11555                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11556                         } }
11557                 } else {
11558                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11559                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11560                         } }
11561                 }
11562         }
11563 }
11564 #[no_mangle]
11565 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11566 /// but with all dynamically-allocated buffers duplicated in new buffers.
11567 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11568 #[repr(C)]
11569 /// The contents of CResult_NetworkGraphDecodeErrorZ
11570 pub union CResult_NetworkGraphDecodeErrorZPtr {
11571         /// A pointer to the contents in the success state.
11572         /// Reading from this pointer when `result_ok` is not set is undefined.
11573         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11574         /// A pointer to the contents in the error state.
11575         /// Reading from this pointer when `result_ok` is set is undefined.
11576         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11577 }
11578 #[repr(C)]
11579 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11580 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11581 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11582 pub struct CResult_NetworkGraphDecodeErrorZ {
11583         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11584         /// `err` or `result` depending on the state of `result_ok`.
11585         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11586         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11587         pub result_ok: bool,
11588 }
11589 #[no_mangle]
11590 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11591 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11592         CResult_NetworkGraphDecodeErrorZ {
11593                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11594                         result: Box::into_raw(Box::new(o)),
11595                 },
11596                 result_ok: true,
11597         }
11598 }
11599 #[no_mangle]
11600 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11601 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11602         CResult_NetworkGraphDecodeErrorZ {
11603                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11604                         err: Box::into_raw(Box::new(e)),
11605                 },
11606                 result_ok: false,
11607         }
11608 }
11609 /// Checks if the given object is currently in the success state
11610 #[no_mangle]
11611 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11612         o.result_ok
11613 }
11614 #[no_mangle]
11615 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11616 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11617 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11618         fn drop(&mut self) {
11619                 if self.result_ok {
11620                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11621                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11622                         }
11623                 } else {
11624                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11625                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11626                         }
11627                 }
11628         }
11629 }
11630 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11631         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11632                 let contents = if o.result_ok {
11633                         let result = unsafe { o.contents.result };
11634                         unsafe { o.contents.result = core::ptr::null_mut() };
11635                         CResult_NetworkGraphDecodeErrorZPtr { result }
11636                 } else {
11637                         let err = unsafe { o.contents.err };
11638                         unsafe { o.contents.err = core::ptr::null_mut(); }
11639                         CResult_NetworkGraphDecodeErrorZPtr { err }
11640                 };
11641                 Self {
11642                         contents,
11643                         result_ok: o.result_ok,
11644                 }
11645         }
11646 }
11647 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11648         fn clone(&self) -> Self {
11649                 if self.result_ok {
11650                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11651                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11652                         } }
11653                 } else {
11654                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11655                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11656                         } }
11657                 }
11658         }
11659 }
11660 #[no_mangle]
11661 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11662 /// but with all dynamically-allocated buffers duplicated in new buffers.
11663 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11664 #[repr(C)]
11665 #[derive(Clone)]
11666 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11667 pub enum COption_CVec_NetAddressZZ {
11668         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11669         Some(crate::c_types::derived::CVec_NetAddressZ),
11670         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11671         None
11672 }
11673 impl COption_CVec_NetAddressZZ {
11674         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11675                 if let Self::None = self { false } else { true }
11676         }
11677         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11678                 !self.is_some()
11679         }
11680         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11681                 if let Self::Some(v) = self { v } else { unreachable!() }
11682         }
11683 }
11684 #[no_mangle]
11685 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11686 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11687         COption_CVec_NetAddressZZ::Some(o)
11688 }
11689 #[no_mangle]
11690 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11691 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11692         COption_CVec_NetAddressZZ::None
11693 }
11694 #[no_mangle]
11695 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11696 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11697 #[no_mangle]
11698 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11699 /// but with all dynamically-allocated buffers duplicated in new buffers.
11700 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11701 #[repr(C)]
11702 /// The contents of CResult_NetAddressDecodeErrorZ
11703 pub union CResult_NetAddressDecodeErrorZPtr {
11704         /// A pointer to the contents in the success state.
11705         /// Reading from this pointer when `result_ok` is not set is undefined.
11706         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11707         /// A pointer to the contents in the error state.
11708         /// Reading from this pointer when `result_ok` is set is undefined.
11709         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11710 }
11711 #[repr(C)]
11712 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11713 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11715 pub struct CResult_NetAddressDecodeErrorZ {
11716         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11717         /// `err` or `result` depending on the state of `result_ok`.
11718         pub contents: CResult_NetAddressDecodeErrorZPtr,
11719         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11720         pub result_ok: bool,
11721 }
11722 #[no_mangle]
11723 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11724 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11725         CResult_NetAddressDecodeErrorZ {
11726                 contents: CResult_NetAddressDecodeErrorZPtr {
11727                         result: Box::into_raw(Box::new(o)),
11728                 },
11729                 result_ok: true,
11730         }
11731 }
11732 #[no_mangle]
11733 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11734 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11735         CResult_NetAddressDecodeErrorZ {
11736                 contents: CResult_NetAddressDecodeErrorZPtr {
11737                         err: Box::into_raw(Box::new(e)),
11738                 },
11739                 result_ok: false,
11740         }
11741 }
11742 /// Checks if the given object is currently in the success state
11743 #[no_mangle]
11744 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11745         o.result_ok
11746 }
11747 #[no_mangle]
11748 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11749 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11750 impl Drop for CResult_NetAddressDecodeErrorZ {
11751         fn drop(&mut self) {
11752                 if self.result_ok {
11753                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11754                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11755                         }
11756                 } else {
11757                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11758                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11759                         }
11760                 }
11761         }
11762 }
11763 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11764         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11765                 let contents = if o.result_ok {
11766                         let result = unsafe { o.contents.result };
11767                         unsafe { o.contents.result = core::ptr::null_mut() };
11768                         CResult_NetAddressDecodeErrorZPtr { result }
11769                 } else {
11770                         let err = unsafe { o.contents.err };
11771                         unsafe { o.contents.err = core::ptr::null_mut(); }
11772                         CResult_NetAddressDecodeErrorZPtr { err }
11773                 };
11774                 Self {
11775                         contents,
11776                         result_ok: o.result_ok,
11777                 }
11778         }
11779 }
11780 impl Clone for CResult_NetAddressDecodeErrorZ {
11781         fn clone(&self) -> Self {
11782                 if self.result_ok {
11783                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11784                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11785                         } }
11786                 } else {
11787                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11788                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11789                         } }
11790                 }
11791         }
11792 }
11793 #[no_mangle]
11794 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11795 /// but with all dynamically-allocated buffers duplicated in new buffers.
11796 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11797 #[repr(C)]
11798 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11799 /// This corresponds to std::vector in C++
11800 pub struct CVec_UpdateAddHTLCZ {
11801         /// The elements in the array.
11802         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11803         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11804         /// The number of elements pointed to by `data`.
11805         pub datalen: usize
11806 }
11807 impl CVec_UpdateAddHTLCZ {
11808         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11809                 if self.datalen == 0 { return Vec::new(); }
11810                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11811                 self.data = core::ptr::null_mut();
11812                 self.datalen = 0;
11813                 ret
11814         }
11815         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11816                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11817         }
11818 }
11819 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11820         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11821                 let datalen = v.len();
11822                 let data = Box::into_raw(v.into_boxed_slice());
11823                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11824         }
11825 }
11826 #[no_mangle]
11827 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11828 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11829 impl Drop for CVec_UpdateAddHTLCZ {
11830         fn drop(&mut self) {
11831                 if self.datalen == 0 { return; }
11832                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11833         }
11834 }
11835 impl Clone for CVec_UpdateAddHTLCZ {
11836         fn clone(&self) -> Self {
11837                 let mut res = Vec::new();
11838                 if self.datalen == 0 { return Self::from(res); }
11839                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11840                 Self::from(res)
11841         }
11842 }
11843 #[repr(C)]
11844 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11845 /// This corresponds to std::vector in C++
11846 pub struct CVec_UpdateFulfillHTLCZ {
11847         /// The elements in the array.
11848         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11849         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11850         /// The number of elements pointed to by `data`.
11851         pub datalen: usize
11852 }
11853 impl CVec_UpdateFulfillHTLCZ {
11854         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11855                 if self.datalen == 0 { return Vec::new(); }
11856                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11857                 self.data = core::ptr::null_mut();
11858                 self.datalen = 0;
11859                 ret
11860         }
11861         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11862                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11863         }
11864 }
11865 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11866         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11867                 let datalen = v.len();
11868                 let data = Box::into_raw(v.into_boxed_slice());
11869                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11870         }
11871 }
11872 #[no_mangle]
11873 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11874 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11875 impl Drop for CVec_UpdateFulfillHTLCZ {
11876         fn drop(&mut self) {
11877                 if self.datalen == 0 { return; }
11878                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11879         }
11880 }
11881 impl Clone for CVec_UpdateFulfillHTLCZ {
11882         fn clone(&self) -> Self {
11883                 let mut res = Vec::new();
11884                 if self.datalen == 0 { return Self::from(res); }
11885                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11886                 Self::from(res)
11887         }
11888 }
11889 #[repr(C)]
11890 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11891 /// This corresponds to std::vector in C++
11892 pub struct CVec_UpdateFailHTLCZ {
11893         /// The elements in the array.
11894         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11895         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11896         /// The number of elements pointed to by `data`.
11897         pub datalen: usize
11898 }
11899 impl CVec_UpdateFailHTLCZ {
11900         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11901                 if self.datalen == 0 { return Vec::new(); }
11902                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11903                 self.data = core::ptr::null_mut();
11904                 self.datalen = 0;
11905                 ret
11906         }
11907         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11908                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11909         }
11910 }
11911 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11912         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11913                 let datalen = v.len();
11914                 let data = Box::into_raw(v.into_boxed_slice());
11915                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11916         }
11917 }
11918 #[no_mangle]
11919 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11920 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11921 impl Drop for CVec_UpdateFailHTLCZ {
11922         fn drop(&mut self) {
11923                 if self.datalen == 0 { return; }
11924                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11925         }
11926 }
11927 impl Clone for CVec_UpdateFailHTLCZ {
11928         fn clone(&self) -> Self {
11929                 let mut res = Vec::new();
11930                 if self.datalen == 0 { return Self::from(res); }
11931                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11932                 Self::from(res)
11933         }
11934 }
11935 #[repr(C)]
11936 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11937 /// This corresponds to std::vector in C++
11938 pub struct CVec_UpdateFailMalformedHTLCZ {
11939         /// The elements in the array.
11940         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11941         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11942         /// The number of elements pointed to by `data`.
11943         pub datalen: usize
11944 }
11945 impl CVec_UpdateFailMalformedHTLCZ {
11946         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11947                 if self.datalen == 0 { return Vec::new(); }
11948                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11949                 self.data = core::ptr::null_mut();
11950                 self.datalen = 0;
11951                 ret
11952         }
11953         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11954                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11955         }
11956 }
11957 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11958         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11959                 let datalen = v.len();
11960                 let data = Box::into_raw(v.into_boxed_slice());
11961                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11962         }
11963 }
11964 #[no_mangle]
11965 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11966 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11967 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11968         fn drop(&mut self) {
11969                 if self.datalen == 0 { return; }
11970                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11971         }
11972 }
11973 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11974         fn clone(&self) -> Self {
11975                 let mut res = Vec::new();
11976                 if self.datalen == 0 { return Self::from(res); }
11977                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11978                 Self::from(res)
11979         }
11980 }
11981 #[repr(C)]
11982 /// The contents of CResult_AcceptChannelDecodeErrorZ
11983 pub union CResult_AcceptChannelDecodeErrorZPtr {
11984         /// A pointer to the contents in the success state.
11985         /// Reading from this pointer when `result_ok` is not set is undefined.
11986         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11987         /// A pointer to the contents in the error state.
11988         /// Reading from this pointer when `result_ok` is set is undefined.
11989         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11990 }
11991 #[repr(C)]
11992 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11993 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11995 pub struct CResult_AcceptChannelDecodeErrorZ {
11996         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11997         /// `err` or `result` depending on the state of `result_ok`.
11998         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11999         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12000         pub result_ok: bool,
12001 }
12002 #[no_mangle]
12003 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12004 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12005         CResult_AcceptChannelDecodeErrorZ {
12006                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12007                         result: Box::into_raw(Box::new(o)),
12008                 },
12009                 result_ok: true,
12010         }
12011 }
12012 #[no_mangle]
12013 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12014 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12015         CResult_AcceptChannelDecodeErrorZ {
12016                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12017                         err: Box::into_raw(Box::new(e)),
12018                 },
12019                 result_ok: false,
12020         }
12021 }
12022 /// Checks if the given object is currently in the success state
12023 #[no_mangle]
12024 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12025         o.result_ok
12026 }
12027 #[no_mangle]
12028 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12029 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12030 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12031         fn drop(&mut self) {
12032                 if self.result_ok {
12033                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12034                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12035                         }
12036                 } else {
12037                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12038                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12039                         }
12040                 }
12041         }
12042 }
12043 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12044         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12045                 let contents = if o.result_ok {
12046                         let result = unsafe { o.contents.result };
12047                         unsafe { o.contents.result = core::ptr::null_mut() };
12048                         CResult_AcceptChannelDecodeErrorZPtr { result }
12049                 } else {
12050                         let err = unsafe { o.contents.err };
12051                         unsafe { o.contents.err = core::ptr::null_mut(); }
12052                         CResult_AcceptChannelDecodeErrorZPtr { err }
12053                 };
12054                 Self {
12055                         contents,
12056                         result_ok: o.result_ok,
12057                 }
12058         }
12059 }
12060 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12061         fn clone(&self) -> Self {
12062                 if self.result_ok {
12063                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12064                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12065                         } }
12066                 } else {
12067                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12068                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12069                         } }
12070                 }
12071         }
12072 }
12073 #[no_mangle]
12074 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12075 /// but with all dynamically-allocated buffers duplicated in new buffers.
12076 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12077 #[repr(C)]
12078 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12079 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12080         /// A pointer to the contents in the success state.
12081         /// Reading from this pointer when `result_ok` is not set is undefined.
12082         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12083         /// A pointer to the contents in the error state.
12084         /// Reading from this pointer when `result_ok` is set is undefined.
12085         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12086 }
12087 #[repr(C)]
12088 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12089 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12090 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12091 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12092         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12093         /// `err` or `result` depending on the state of `result_ok`.
12094         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12095         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12096         pub result_ok: bool,
12097 }
12098 #[no_mangle]
12099 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12100 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12101         CResult_AnnouncementSignaturesDecodeErrorZ {
12102                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12103                         result: Box::into_raw(Box::new(o)),
12104                 },
12105                 result_ok: true,
12106         }
12107 }
12108 #[no_mangle]
12109 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12110 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12111         CResult_AnnouncementSignaturesDecodeErrorZ {
12112                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12113                         err: Box::into_raw(Box::new(e)),
12114                 },
12115                 result_ok: false,
12116         }
12117 }
12118 /// Checks if the given object is currently in the success state
12119 #[no_mangle]
12120 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12121         o.result_ok
12122 }
12123 #[no_mangle]
12124 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12125 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12126 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12127         fn drop(&mut self) {
12128                 if self.result_ok {
12129                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12130                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12131                         }
12132                 } else {
12133                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12134                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12135                         }
12136                 }
12137         }
12138 }
12139 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12140         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12141                 let contents = if o.result_ok {
12142                         let result = unsafe { o.contents.result };
12143                         unsafe { o.contents.result = core::ptr::null_mut() };
12144                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12145                 } else {
12146                         let err = unsafe { o.contents.err };
12147                         unsafe { o.contents.err = core::ptr::null_mut(); }
12148                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12149                 };
12150                 Self {
12151                         contents,
12152                         result_ok: o.result_ok,
12153                 }
12154         }
12155 }
12156 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12157         fn clone(&self) -> Self {
12158                 if self.result_ok {
12159                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12160                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12161                         } }
12162                 } else {
12163                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12164                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12165                         } }
12166                 }
12167         }
12168 }
12169 #[no_mangle]
12170 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12171 /// but with all dynamically-allocated buffers duplicated in new buffers.
12172 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12173 #[repr(C)]
12174 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12175 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12176         /// A pointer to the contents in the success state.
12177         /// Reading from this pointer when `result_ok` is not set is undefined.
12178         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12179         /// A pointer to the contents in the error state.
12180         /// Reading from this pointer when `result_ok` is set is undefined.
12181         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12182 }
12183 #[repr(C)]
12184 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12185 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12186 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12187 pub struct CResult_ChannelReestablishDecodeErrorZ {
12188         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12189         /// `err` or `result` depending on the state of `result_ok`.
12190         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12191         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12192         pub result_ok: bool,
12193 }
12194 #[no_mangle]
12195 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12196 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12197         CResult_ChannelReestablishDecodeErrorZ {
12198                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12199                         result: Box::into_raw(Box::new(o)),
12200                 },
12201                 result_ok: true,
12202         }
12203 }
12204 #[no_mangle]
12205 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12206 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12207         CResult_ChannelReestablishDecodeErrorZ {
12208                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12209                         err: Box::into_raw(Box::new(e)),
12210                 },
12211                 result_ok: false,
12212         }
12213 }
12214 /// Checks if the given object is currently in the success state
12215 #[no_mangle]
12216 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12217         o.result_ok
12218 }
12219 #[no_mangle]
12220 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12221 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12222 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12223         fn drop(&mut self) {
12224                 if self.result_ok {
12225                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12226                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12227                         }
12228                 } else {
12229                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12230                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12231                         }
12232                 }
12233         }
12234 }
12235 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12236         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12237                 let contents = if o.result_ok {
12238                         let result = unsafe { o.contents.result };
12239                         unsafe { o.contents.result = core::ptr::null_mut() };
12240                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12241                 } else {
12242                         let err = unsafe { o.contents.err };
12243                         unsafe { o.contents.err = core::ptr::null_mut(); }
12244                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12245                 };
12246                 Self {
12247                         contents,
12248                         result_ok: o.result_ok,
12249                 }
12250         }
12251 }
12252 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12253         fn clone(&self) -> Self {
12254                 if self.result_ok {
12255                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12256                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12257                         } }
12258                 } else {
12259                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12260                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12261                         } }
12262                 }
12263         }
12264 }
12265 #[no_mangle]
12266 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12267 /// but with all dynamically-allocated buffers duplicated in new buffers.
12268 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12269 #[repr(C)]
12270 /// The contents of CResult_ClosingSignedDecodeErrorZ
12271 pub union CResult_ClosingSignedDecodeErrorZPtr {
12272         /// A pointer to the contents in the success state.
12273         /// Reading from this pointer when `result_ok` is not set is undefined.
12274         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12275         /// A pointer to the contents in the error state.
12276         /// Reading from this pointer when `result_ok` is set is undefined.
12277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12278 }
12279 #[repr(C)]
12280 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12281 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12283 pub struct CResult_ClosingSignedDecodeErrorZ {
12284         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12285         /// `err` or `result` depending on the state of `result_ok`.
12286         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12287         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12288         pub result_ok: bool,
12289 }
12290 #[no_mangle]
12291 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12292 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12293         CResult_ClosingSignedDecodeErrorZ {
12294                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12295                         result: Box::into_raw(Box::new(o)),
12296                 },
12297                 result_ok: true,
12298         }
12299 }
12300 #[no_mangle]
12301 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12302 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12303         CResult_ClosingSignedDecodeErrorZ {
12304                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12305                         err: Box::into_raw(Box::new(e)),
12306                 },
12307                 result_ok: false,
12308         }
12309 }
12310 /// Checks if the given object is currently in the success state
12311 #[no_mangle]
12312 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12313         o.result_ok
12314 }
12315 #[no_mangle]
12316 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12317 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12318 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12319         fn drop(&mut self) {
12320                 if self.result_ok {
12321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12323                         }
12324                 } else {
12325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12327                         }
12328                 }
12329         }
12330 }
12331 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12332         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12333                 let contents = if o.result_ok {
12334                         let result = unsafe { o.contents.result };
12335                         unsafe { o.contents.result = core::ptr::null_mut() };
12336                         CResult_ClosingSignedDecodeErrorZPtr { result }
12337                 } else {
12338                         let err = unsafe { o.contents.err };
12339                         unsafe { o.contents.err = core::ptr::null_mut(); }
12340                         CResult_ClosingSignedDecodeErrorZPtr { err }
12341                 };
12342                 Self {
12343                         contents,
12344                         result_ok: o.result_ok,
12345                 }
12346         }
12347 }
12348 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12349         fn clone(&self) -> Self {
12350                 if self.result_ok {
12351                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12352                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12353                         } }
12354                 } else {
12355                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12357                         } }
12358                 }
12359         }
12360 }
12361 #[no_mangle]
12362 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12363 /// but with all dynamically-allocated buffers duplicated in new buffers.
12364 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12365 #[repr(C)]
12366 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12367 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12368         /// A pointer to the contents in the success state.
12369         /// Reading from this pointer when `result_ok` is not set is undefined.
12370         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12371         /// A pointer to the contents in the error state.
12372         /// Reading from this pointer when `result_ok` is set is undefined.
12373         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12374 }
12375 #[repr(C)]
12376 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12377 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12378 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12379 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12380         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12381         /// `err` or `result` depending on the state of `result_ok`.
12382         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12383         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12384         pub result_ok: bool,
12385 }
12386 #[no_mangle]
12387 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12388 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12389         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12390                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12391                         result: Box::into_raw(Box::new(o)),
12392                 },
12393                 result_ok: true,
12394         }
12395 }
12396 #[no_mangle]
12397 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12398 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12399         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12400                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12401                         err: Box::into_raw(Box::new(e)),
12402                 },
12403                 result_ok: false,
12404         }
12405 }
12406 /// Checks if the given object is currently in the success state
12407 #[no_mangle]
12408 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12409         o.result_ok
12410 }
12411 #[no_mangle]
12412 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12413 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12414 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12415         fn drop(&mut self) {
12416                 if self.result_ok {
12417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12419                         }
12420                 } else {
12421                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12422                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12423                         }
12424                 }
12425         }
12426 }
12427 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12428         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12429                 let contents = if o.result_ok {
12430                         let result = unsafe { o.contents.result };
12431                         unsafe { o.contents.result = core::ptr::null_mut() };
12432                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12433                 } else {
12434                         let err = unsafe { o.contents.err };
12435                         unsafe { o.contents.err = core::ptr::null_mut(); }
12436                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12437                 };
12438                 Self {
12439                         contents,
12440                         result_ok: o.result_ok,
12441                 }
12442         }
12443 }
12444 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12445         fn clone(&self) -> Self {
12446                 if self.result_ok {
12447                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12448                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12449                         } }
12450                 } else {
12451                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12452                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12453                         } }
12454                 }
12455         }
12456 }
12457 #[no_mangle]
12458 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12459 /// but with all dynamically-allocated buffers duplicated in new buffers.
12460 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12461 #[repr(C)]
12462 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12463 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12464         /// A pointer to the contents in the success state.
12465         /// Reading from this pointer when `result_ok` is not set is undefined.
12466         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12467         /// A pointer to the contents in the error state.
12468         /// Reading from this pointer when `result_ok` is set is undefined.
12469         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12470 }
12471 #[repr(C)]
12472 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12473 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12474 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12475 pub struct CResult_CommitmentSignedDecodeErrorZ {
12476         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12477         /// `err` or `result` depending on the state of `result_ok`.
12478         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12479         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12480         pub result_ok: bool,
12481 }
12482 #[no_mangle]
12483 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12484 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12485         CResult_CommitmentSignedDecodeErrorZ {
12486                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12487                         result: Box::into_raw(Box::new(o)),
12488                 },
12489                 result_ok: true,
12490         }
12491 }
12492 #[no_mangle]
12493 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12494 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12495         CResult_CommitmentSignedDecodeErrorZ {
12496                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12497                         err: Box::into_raw(Box::new(e)),
12498                 },
12499                 result_ok: false,
12500         }
12501 }
12502 /// Checks if the given object is currently in the success state
12503 #[no_mangle]
12504 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12505         o.result_ok
12506 }
12507 #[no_mangle]
12508 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12509 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12510 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12511         fn drop(&mut self) {
12512                 if self.result_ok {
12513                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12514                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12515                         }
12516                 } else {
12517                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12518                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12519                         }
12520                 }
12521         }
12522 }
12523 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12524         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12525                 let contents = if o.result_ok {
12526                         let result = unsafe { o.contents.result };
12527                         unsafe { o.contents.result = core::ptr::null_mut() };
12528                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12529                 } else {
12530                         let err = unsafe { o.contents.err };
12531                         unsafe { o.contents.err = core::ptr::null_mut(); }
12532                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12533                 };
12534                 Self {
12535                         contents,
12536                         result_ok: o.result_ok,
12537                 }
12538         }
12539 }
12540 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12541         fn clone(&self) -> Self {
12542                 if self.result_ok {
12543                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12544                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12545                         } }
12546                 } else {
12547                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12548                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12549                         } }
12550                 }
12551         }
12552 }
12553 #[no_mangle]
12554 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12555 /// but with all dynamically-allocated buffers duplicated in new buffers.
12556 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12557 #[repr(C)]
12558 /// The contents of CResult_FundingCreatedDecodeErrorZ
12559 pub union CResult_FundingCreatedDecodeErrorZPtr {
12560         /// A pointer to the contents in the success state.
12561         /// Reading from this pointer when `result_ok` is not set is undefined.
12562         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12563         /// A pointer to the contents in the error state.
12564         /// Reading from this pointer when `result_ok` is set is undefined.
12565         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12566 }
12567 #[repr(C)]
12568 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12569 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12570 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12571 pub struct CResult_FundingCreatedDecodeErrorZ {
12572         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12573         /// `err` or `result` depending on the state of `result_ok`.
12574         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12575         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12576         pub result_ok: bool,
12577 }
12578 #[no_mangle]
12579 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12580 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12581         CResult_FundingCreatedDecodeErrorZ {
12582                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12583                         result: Box::into_raw(Box::new(o)),
12584                 },
12585                 result_ok: true,
12586         }
12587 }
12588 #[no_mangle]
12589 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12590 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12591         CResult_FundingCreatedDecodeErrorZ {
12592                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12593                         err: Box::into_raw(Box::new(e)),
12594                 },
12595                 result_ok: false,
12596         }
12597 }
12598 /// Checks if the given object is currently in the success state
12599 #[no_mangle]
12600 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12601         o.result_ok
12602 }
12603 #[no_mangle]
12604 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12605 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12606 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12607         fn drop(&mut self) {
12608                 if self.result_ok {
12609                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12610                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12611                         }
12612                 } else {
12613                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12614                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12615                         }
12616                 }
12617         }
12618 }
12619 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12620         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12621                 let contents = if o.result_ok {
12622                         let result = unsafe { o.contents.result };
12623                         unsafe { o.contents.result = core::ptr::null_mut() };
12624                         CResult_FundingCreatedDecodeErrorZPtr { result }
12625                 } else {
12626                         let err = unsafe { o.contents.err };
12627                         unsafe { o.contents.err = core::ptr::null_mut(); }
12628                         CResult_FundingCreatedDecodeErrorZPtr { err }
12629                 };
12630                 Self {
12631                         contents,
12632                         result_ok: o.result_ok,
12633                 }
12634         }
12635 }
12636 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12637         fn clone(&self) -> Self {
12638                 if self.result_ok {
12639                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12640                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12641                         } }
12642                 } else {
12643                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12644                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12645                         } }
12646                 }
12647         }
12648 }
12649 #[no_mangle]
12650 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12651 /// but with all dynamically-allocated buffers duplicated in new buffers.
12652 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12653 #[repr(C)]
12654 /// The contents of CResult_FundingSignedDecodeErrorZ
12655 pub union CResult_FundingSignedDecodeErrorZPtr {
12656         /// A pointer to the contents in the success state.
12657         /// Reading from this pointer when `result_ok` is not set is undefined.
12658         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12659         /// A pointer to the contents in the error state.
12660         /// Reading from this pointer when `result_ok` is set is undefined.
12661         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12662 }
12663 #[repr(C)]
12664 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12665 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12666 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12667 pub struct CResult_FundingSignedDecodeErrorZ {
12668         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12669         /// `err` or `result` depending on the state of `result_ok`.
12670         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12671         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12672         pub result_ok: bool,
12673 }
12674 #[no_mangle]
12675 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12676 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12677         CResult_FundingSignedDecodeErrorZ {
12678                 contents: CResult_FundingSignedDecodeErrorZPtr {
12679                         result: Box::into_raw(Box::new(o)),
12680                 },
12681                 result_ok: true,
12682         }
12683 }
12684 #[no_mangle]
12685 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12686 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12687         CResult_FundingSignedDecodeErrorZ {
12688                 contents: CResult_FundingSignedDecodeErrorZPtr {
12689                         err: Box::into_raw(Box::new(e)),
12690                 },
12691                 result_ok: false,
12692         }
12693 }
12694 /// Checks if the given object is currently in the success state
12695 #[no_mangle]
12696 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12697         o.result_ok
12698 }
12699 #[no_mangle]
12700 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12701 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12702 impl Drop for CResult_FundingSignedDecodeErrorZ {
12703         fn drop(&mut self) {
12704                 if self.result_ok {
12705                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12706                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12707                         }
12708                 } else {
12709                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12710                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12711                         }
12712                 }
12713         }
12714 }
12715 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12716         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12717                 let contents = if o.result_ok {
12718                         let result = unsafe { o.contents.result };
12719                         unsafe { o.contents.result = core::ptr::null_mut() };
12720                         CResult_FundingSignedDecodeErrorZPtr { result }
12721                 } else {
12722                         let err = unsafe { o.contents.err };
12723                         unsafe { o.contents.err = core::ptr::null_mut(); }
12724                         CResult_FundingSignedDecodeErrorZPtr { err }
12725                 };
12726                 Self {
12727                         contents,
12728                         result_ok: o.result_ok,
12729                 }
12730         }
12731 }
12732 impl Clone for CResult_FundingSignedDecodeErrorZ {
12733         fn clone(&self) -> Self {
12734                 if self.result_ok {
12735                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12736                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12737                         } }
12738                 } else {
12739                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12740                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12741                         } }
12742                 }
12743         }
12744 }
12745 #[no_mangle]
12746 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12747 /// but with all dynamically-allocated buffers duplicated in new buffers.
12748 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12749 #[repr(C)]
12750 /// The contents of CResult_FundingLockedDecodeErrorZ
12751 pub union CResult_FundingLockedDecodeErrorZPtr {
12752         /// A pointer to the contents in the success state.
12753         /// Reading from this pointer when `result_ok` is not set is undefined.
12754         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12755         /// A pointer to the contents in the error state.
12756         /// Reading from this pointer when `result_ok` is set is undefined.
12757         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12758 }
12759 #[repr(C)]
12760 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12761 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12762 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12763 pub struct CResult_FundingLockedDecodeErrorZ {
12764         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12765         /// `err` or `result` depending on the state of `result_ok`.
12766         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12767         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12768         pub result_ok: bool,
12769 }
12770 #[no_mangle]
12771 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12772 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12773         CResult_FundingLockedDecodeErrorZ {
12774                 contents: CResult_FundingLockedDecodeErrorZPtr {
12775                         result: Box::into_raw(Box::new(o)),
12776                 },
12777                 result_ok: true,
12778         }
12779 }
12780 #[no_mangle]
12781 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12782 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12783         CResult_FundingLockedDecodeErrorZ {
12784                 contents: CResult_FundingLockedDecodeErrorZPtr {
12785                         err: Box::into_raw(Box::new(e)),
12786                 },
12787                 result_ok: false,
12788         }
12789 }
12790 /// Checks if the given object is currently in the success state
12791 #[no_mangle]
12792 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12793         o.result_ok
12794 }
12795 #[no_mangle]
12796 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12797 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12798 impl Drop for CResult_FundingLockedDecodeErrorZ {
12799         fn drop(&mut self) {
12800                 if self.result_ok {
12801                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12802                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12803                         }
12804                 } else {
12805                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12806                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12807                         }
12808                 }
12809         }
12810 }
12811 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12812         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12813                 let contents = if o.result_ok {
12814                         let result = unsafe { o.contents.result };
12815                         unsafe { o.contents.result = core::ptr::null_mut() };
12816                         CResult_FundingLockedDecodeErrorZPtr { result }
12817                 } else {
12818                         let err = unsafe { o.contents.err };
12819                         unsafe { o.contents.err = core::ptr::null_mut(); }
12820                         CResult_FundingLockedDecodeErrorZPtr { err }
12821                 };
12822                 Self {
12823                         contents,
12824                         result_ok: o.result_ok,
12825                 }
12826         }
12827 }
12828 impl Clone for CResult_FundingLockedDecodeErrorZ {
12829         fn clone(&self) -> Self {
12830                 if self.result_ok {
12831                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12832                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12833                         } }
12834                 } else {
12835                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12836                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12837                         } }
12838                 }
12839         }
12840 }
12841 #[no_mangle]
12842 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12843 /// but with all dynamically-allocated buffers duplicated in new buffers.
12844 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12845 #[repr(C)]
12846 /// The contents of CResult_InitDecodeErrorZ
12847 pub union CResult_InitDecodeErrorZPtr {
12848         /// A pointer to the contents in the success state.
12849         /// Reading from this pointer when `result_ok` is not set is undefined.
12850         pub result: *mut crate::lightning::ln::msgs::Init,
12851         /// A pointer to the contents in the error state.
12852         /// Reading from this pointer when `result_ok` is set is undefined.
12853         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12854 }
12855 #[repr(C)]
12856 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12857 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12858 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12859 pub struct CResult_InitDecodeErrorZ {
12860         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12861         /// `err` or `result` depending on the state of `result_ok`.
12862         pub contents: CResult_InitDecodeErrorZPtr,
12863         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12864         pub result_ok: bool,
12865 }
12866 #[no_mangle]
12867 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12868 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12869         CResult_InitDecodeErrorZ {
12870                 contents: CResult_InitDecodeErrorZPtr {
12871                         result: Box::into_raw(Box::new(o)),
12872                 },
12873                 result_ok: true,
12874         }
12875 }
12876 #[no_mangle]
12877 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12878 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12879         CResult_InitDecodeErrorZ {
12880                 contents: CResult_InitDecodeErrorZPtr {
12881                         err: Box::into_raw(Box::new(e)),
12882                 },
12883                 result_ok: false,
12884         }
12885 }
12886 /// Checks if the given object is currently in the success state
12887 #[no_mangle]
12888 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12889         o.result_ok
12890 }
12891 #[no_mangle]
12892 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12893 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12894 impl Drop for CResult_InitDecodeErrorZ {
12895         fn drop(&mut self) {
12896                 if self.result_ok {
12897                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12898                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12899                         }
12900                 } else {
12901                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12902                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12903                         }
12904                 }
12905         }
12906 }
12907 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12908         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12909                 let contents = if o.result_ok {
12910                         let result = unsafe { o.contents.result };
12911                         unsafe { o.contents.result = core::ptr::null_mut() };
12912                         CResult_InitDecodeErrorZPtr { result }
12913                 } else {
12914                         let err = unsafe { o.contents.err };
12915                         unsafe { o.contents.err = core::ptr::null_mut(); }
12916                         CResult_InitDecodeErrorZPtr { err }
12917                 };
12918                 Self {
12919                         contents,
12920                         result_ok: o.result_ok,
12921                 }
12922         }
12923 }
12924 impl Clone for CResult_InitDecodeErrorZ {
12925         fn clone(&self) -> Self {
12926                 if self.result_ok {
12927                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12928                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12929                         } }
12930                 } else {
12931                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12932                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12933                         } }
12934                 }
12935         }
12936 }
12937 #[no_mangle]
12938 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12939 /// but with all dynamically-allocated buffers duplicated in new buffers.
12940 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12941 #[repr(C)]
12942 /// The contents of CResult_OpenChannelDecodeErrorZ
12943 pub union CResult_OpenChannelDecodeErrorZPtr {
12944         /// A pointer to the contents in the success state.
12945         /// Reading from this pointer when `result_ok` is not set is undefined.
12946         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12947         /// A pointer to the contents in the error state.
12948         /// Reading from this pointer when `result_ok` is set is undefined.
12949         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12950 }
12951 #[repr(C)]
12952 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12953 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12954 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12955 pub struct CResult_OpenChannelDecodeErrorZ {
12956         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12957         /// `err` or `result` depending on the state of `result_ok`.
12958         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12959         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12960         pub result_ok: bool,
12961 }
12962 #[no_mangle]
12963 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12964 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12965         CResult_OpenChannelDecodeErrorZ {
12966                 contents: CResult_OpenChannelDecodeErrorZPtr {
12967                         result: Box::into_raw(Box::new(o)),
12968                 },
12969                 result_ok: true,
12970         }
12971 }
12972 #[no_mangle]
12973 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12974 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12975         CResult_OpenChannelDecodeErrorZ {
12976                 contents: CResult_OpenChannelDecodeErrorZPtr {
12977                         err: Box::into_raw(Box::new(e)),
12978                 },
12979                 result_ok: false,
12980         }
12981 }
12982 /// Checks if the given object is currently in the success state
12983 #[no_mangle]
12984 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12985         o.result_ok
12986 }
12987 #[no_mangle]
12988 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12989 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12990 impl Drop for CResult_OpenChannelDecodeErrorZ {
12991         fn drop(&mut self) {
12992                 if self.result_ok {
12993                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12994                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12995                         }
12996                 } else {
12997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12999                         }
13000                 }
13001         }
13002 }
13003 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13004         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13005                 let contents = if o.result_ok {
13006                         let result = unsafe { o.contents.result };
13007                         unsafe { o.contents.result = core::ptr::null_mut() };
13008                         CResult_OpenChannelDecodeErrorZPtr { result }
13009                 } else {
13010                         let err = unsafe { o.contents.err };
13011                         unsafe { o.contents.err = core::ptr::null_mut(); }
13012                         CResult_OpenChannelDecodeErrorZPtr { err }
13013                 };
13014                 Self {
13015                         contents,
13016                         result_ok: o.result_ok,
13017                 }
13018         }
13019 }
13020 impl Clone for CResult_OpenChannelDecodeErrorZ {
13021         fn clone(&self) -> Self {
13022                 if self.result_ok {
13023                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13024                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13025                         } }
13026                 } else {
13027                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13028                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13029                         } }
13030                 }
13031         }
13032 }
13033 #[no_mangle]
13034 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13035 /// but with all dynamically-allocated buffers duplicated in new buffers.
13036 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13037 #[repr(C)]
13038 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13039 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13040         /// A pointer to the contents in the success state.
13041         /// Reading from this pointer when `result_ok` is not set is undefined.
13042         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13043         /// A pointer to the contents in the error state.
13044         /// Reading from this pointer when `result_ok` is set is undefined.
13045         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13046 }
13047 #[repr(C)]
13048 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13049 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13050 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13051 pub struct CResult_RevokeAndACKDecodeErrorZ {
13052         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13053         /// `err` or `result` depending on the state of `result_ok`.
13054         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13055         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13056         pub result_ok: bool,
13057 }
13058 #[no_mangle]
13059 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13060 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13061         CResult_RevokeAndACKDecodeErrorZ {
13062                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13063                         result: Box::into_raw(Box::new(o)),
13064                 },
13065                 result_ok: true,
13066         }
13067 }
13068 #[no_mangle]
13069 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13070 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13071         CResult_RevokeAndACKDecodeErrorZ {
13072                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13073                         err: Box::into_raw(Box::new(e)),
13074                 },
13075                 result_ok: false,
13076         }
13077 }
13078 /// Checks if the given object is currently in the success state
13079 #[no_mangle]
13080 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13081         o.result_ok
13082 }
13083 #[no_mangle]
13084 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13085 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13086 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13087         fn drop(&mut self) {
13088                 if self.result_ok {
13089                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13090                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13091                         }
13092                 } else {
13093                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13094                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13095                         }
13096                 }
13097         }
13098 }
13099 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13100         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13101                 let contents = if o.result_ok {
13102                         let result = unsafe { o.contents.result };
13103                         unsafe { o.contents.result = core::ptr::null_mut() };
13104                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13105                 } else {
13106                         let err = unsafe { o.contents.err };
13107                         unsafe { o.contents.err = core::ptr::null_mut(); }
13108                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13109                 };
13110                 Self {
13111                         contents,
13112                         result_ok: o.result_ok,
13113                 }
13114         }
13115 }
13116 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13117         fn clone(&self) -> Self {
13118                 if self.result_ok {
13119                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13120                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13121                         } }
13122                 } else {
13123                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13124                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13125                         } }
13126                 }
13127         }
13128 }
13129 #[no_mangle]
13130 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13131 /// but with all dynamically-allocated buffers duplicated in new buffers.
13132 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13133 #[repr(C)]
13134 /// The contents of CResult_ShutdownDecodeErrorZ
13135 pub union CResult_ShutdownDecodeErrorZPtr {
13136         /// A pointer to the contents in the success state.
13137         /// Reading from this pointer when `result_ok` is not set is undefined.
13138         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13139         /// A pointer to the contents in the error state.
13140         /// Reading from this pointer when `result_ok` is set is undefined.
13141         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13142 }
13143 #[repr(C)]
13144 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13145 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13146 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13147 pub struct CResult_ShutdownDecodeErrorZ {
13148         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13149         /// `err` or `result` depending on the state of `result_ok`.
13150         pub contents: CResult_ShutdownDecodeErrorZPtr,
13151         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13152         pub result_ok: bool,
13153 }
13154 #[no_mangle]
13155 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13156 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13157         CResult_ShutdownDecodeErrorZ {
13158                 contents: CResult_ShutdownDecodeErrorZPtr {
13159                         result: Box::into_raw(Box::new(o)),
13160                 },
13161                 result_ok: true,
13162         }
13163 }
13164 #[no_mangle]
13165 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13166 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13167         CResult_ShutdownDecodeErrorZ {
13168                 contents: CResult_ShutdownDecodeErrorZPtr {
13169                         err: Box::into_raw(Box::new(e)),
13170                 },
13171                 result_ok: false,
13172         }
13173 }
13174 /// Checks if the given object is currently in the success state
13175 #[no_mangle]
13176 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13177         o.result_ok
13178 }
13179 #[no_mangle]
13180 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13181 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13182 impl Drop for CResult_ShutdownDecodeErrorZ {
13183         fn drop(&mut self) {
13184                 if self.result_ok {
13185                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13186                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13187                         }
13188                 } else {
13189                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13190                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13191                         }
13192                 }
13193         }
13194 }
13195 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13196         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13197                 let contents = if o.result_ok {
13198                         let result = unsafe { o.contents.result };
13199                         unsafe { o.contents.result = core::ptr::null_mut() };
13200                         CResult_ShutdownDecodeErrorZPtr { result }
13201                 } else {
13202                         let err = unsafe { o.contents.err };
13203                         unsafe { o.contents.err = core::ptr::null_mut(); }
13204                         CResult_ShutdownDecodeErrorZPtr { err }
13205                 };
13206                 Self {
13207                         contents,
13208                         result_ok: o.result_ok,
13209                 }
13210         }
13211 }
13212 impl Clone for CResult_ShutdownDecodeErrorZ {
13213         fn clone(&self) -> Self {
13214                 if self.result_ok {
13215                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13216                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13217                         } }
13218                 } else {
13219                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13220                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13221                         } }
13222                 }
13223         }
13224 }
13225 #[no_mangle]
13226 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13227 /// but with all dynamically-allocated buffers duplicated in new buffers.
13228 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13229 #[repr(C)]
13230 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13231 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13232         /// A pointer to the contents in the success state.
13233         /// Reading from this pointer when `result_ok` is not set is undefined.
13234         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13235         /// A pointer to the contents in the error state.
13236         /// Reading from this pointer when `result_ok` is set is undefined.
13237         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13238 }
13239 #[repr(C)]
13240 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13241 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13242 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13243 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13244         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13245         /// `err` or `result` depending on the state of `result_ok`.
13246         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13247         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13248         pub result_ok: bool,
13249 }
13250 #[no_mangle]
13251 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13252 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13253         CResult_UpdateFailHTLCDecodeErrorZ {
13254                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13255                         result: Box::into_raw(Box::new(o)),
13256                 },
13257                 result_ok: true,
13258         }
13259 }
13260 #[no_mangle]
13261 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13262 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13263         CResult_UpdateFailHTLCDecodeErrorZ {
13264                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13265                         err: Box::into_raw(Box::new(e)),
13266                 },
13267                 result_ok: false,
13268         }
13269 }
13270 /// Checks if the given object is currently in the success state
13271 #[no_mangle]
13272 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13273         o.result_ok
13274 }
13275 #[no_mangle]
13276 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13277 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13278 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13279         fn drop(&mut self) {
13280                 if self.result_ok {
13281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13283                         }
13284                 } else {
13285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13287                         }
13288                 }
13289         }
13290 }
13291 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13292         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13293                 let contents = if o.result_ok {
13294                         let result = unsafe { o.contents.result };
13295                         unsafe { o.contents.result = core::ptr::null_mut() };
13296                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13297                 } else {
13298                         let err = unsafe { o.contents.err };
13299                         unsafe { o.contents.err = core::ptr::null_mut(); }
13300                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13301                 };
13302                 Self {
13303                         contents,
13304                         result_ok: o.result_ok,
13305                 }
13306         }
13307 }
13308 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13309         fn clone(&self) -> Self {
13310                 if self.result_ok {
13311                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13312                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13313                         } }
13314                 } else {
13315                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13316                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13317                         } }
13318                 }
13319         }
13320 }
13321 #[no_mangle]
13322 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13323 /// but with all dynamically-allocated buffers duplicated in new buffers.
13324 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13325 #[repr(C)]
13326 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13327 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13328         /// A pointer to the contents in the success state.
13329         /// Reading from this pointer when `result_ok` is not set is undefined.
13330         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13331         /// A pointer to the contents in the error state.
13332         /// Reading from this pointer when `result_ok` is set is undefined.
13333         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13334 }
13335 #[repr(C)]
13336 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13337 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13338 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13339 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13340         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13341         /// `err` or `result` depending on the state of `result_ok`.
13342         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13343         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13344         pub result_ok: bool,
13345 }
13346 #[no_mangle]
13347 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13348 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13349         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13350                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13351                         result: Box::into_raw(Box::new(o)),
13352                 },
13353                 result_ok: true,
13354         }
13355 }
13356 #[no_mangle]
13357 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13358 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13359         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13360                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13361                         err: Box::into_raw(Box::new(e)),
13362                 },
13363                 result_ok: false,
13364         }
13365 }
13366 /// Checks if the given object is currently in the success state
13367 #[no_mangle]
13368 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13369         o.result_ok
13370 }
13371 #[no_mangle]
13372 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13373 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13374 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13375         fn drop(&mut self) {
13376                 if self.result_ok {
13377                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13378                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13379                         }
13380                 } else {
13381                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13382                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13383                         }
13384                 }
13385         }
13386 }
13387 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13388         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13389                 let contents = if o.result_ok {
13390                         let result = unsafe { o.contents.result };
13391                         unsafe { o.contents.result = core::ptr::null_mut() };
13392                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13393                 } else {
13394                         let err = unsafe { o.contents.err };
13395                         unsafe { o.contents.err = core::ptr::null_mut(); }
13396                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13397                 };
13398                 Self {
13399                         contents,
13400                         result_ok: o.result_ok,
13401                 }
13402         }
13403 }
13404 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13405         fn clone(&self) -> Self {
13406                 if self.result_ok {
13407                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13408                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13409                         } }
13410                 } else {
13411                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13412                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13413                         } }
13414                 }
13415         }
13416 }
13417 #[no_mangle]
13418 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13419 /// but with all dynamically-allocated buffers duplicated in new buffers.
13420 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13421 #[repr(C)]
13422 /// The contents of CResult_UpdateFeeDecodeErrorZ
13423 pub union CResult_UpdateFeeDecodeErrorZPtr {
13424         /// A pointer to the contents in the success state.
13425         /// Reading from this pointer when `result_ok` is not set is undefined.
13426         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13427         /// A pointer to the contents in the error state.
13428         /// Reading from this pointer when `result_ok` is set is undefined.
13429         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13430 }
13431 #[repr(C)]
13432 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13433 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13434 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13435 pub struct CResult_UpdateFeeDecodeErrorZ {
13436         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13437         /// `err` or `result` depending on the state of `result_ok`.
13438         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13439         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13440         pub result_ok: bool,
13441 }
13442 #[no_mangle]
13443 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13444 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13445         CResult_UpdateFeeDecodeErrorZ {
13446                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13447                         result: Box::into_raw(Box::new(o)),
13448                 },
13449                 result_ok: true,
13450         }
13451 }
13452 #[no_mangle]
13453 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13454 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13455         CResult_UpdateFeeDecodeErrorZ {
13456                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13457                         err: Box::into_raw(Box::new(e)),
13458                 },
13459                 result_ok: false,
13460         }
13461 }
13462 /// Checks if the given object is currently in the success state
13463 #[no_mangle]
13464 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13465         o.result_ok
13466 }
13467 #[no_mangle]
13468 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13469 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13470 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13471         fn drop(&mut self) {
13472                 if self.result_ok {
13473                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13474                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13475                         }
13476                 } else {
13477                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13478                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13479                         }
13480                 }
13481         }
13482 }
13483 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13484         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13485                 let contents = if o.result_ok {
13486                         let result = unsafe { o.contents.result };
13487                         unsafe { o.contents.result = core::ptr::null_mut() };
13488                         CResult_UpdateFeeDecodeErrorZPtr { result }
13489                 } else {
13490                         let err = unsafe { o.contents.err };
13491                         unsafe { o.contents.err = core::ptr::null_mut(); }
13492                         CResult_UpdateFeeDecodeErrorZPtr { err }
13493                 };
13494                 Self {
13495                         contents,
13496                         result_ok: o.result_ok,
13497                 }
13498         }
13499 }
13500 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13501         fn clone(&self) -> Self {
13502                 if self.result_ok {
13503                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13504                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13505                         } }
13506                 } else {
13507                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13508                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13509                         } }
13510                 }
13511         }
13512 }
13513 #[no_mangle]
13514 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13515 /// but with all dynamically-allocated buffers duplicated in new buffers.
13516 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13517 #[repr(C)]
13518 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13519 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13520         /// A pointer to the contents in the success state.
13521         /// Reading from this pointer when `result_ok` is not set is undefined.
13522         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13523         /// A pointer to the contents in the error state.
13524         /// Reading from this pointer when `result_ok` is set is undefined.
13525         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13526 }
13527 #[repr(C)]
13528 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13529 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13530 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13531 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13532         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13533         /// `err` or `result` depending on the state of `result_ok`.
13534         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13535         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13536         pub result_ok: bool,
13537 }
13538 #[no_mangle]
13539 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13540 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13541         CResult_UpdateFulfillHTLCDecodeErrorZ {
13542                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13543                         result: Box::into_raw(Box::new(o)),
13544                 },
13545                 result_ok: true,
13546         }
13547 }
13548 #[no_mangle]
13549 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13550 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13551         CResult_UpdateFulfillHTLCDecodeErrorZ {
13552                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13553                         err: Box::into_raw(Box::new(e)),
13554                 },
13555                 result_ok: false,
13556         }
13557 }
13558 /// Checks if the given object is currently in the success state
13559 #[no_mangle]
13560 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13561         o.result_ok
13562 }
13563 #[no_mangle]
13564 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13565 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13566 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13567         fn drop(&mut self) {
13568                 if self.result_ok {
13569                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13570                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13571                         }
13572                 } else {
13573                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13574                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13575                         }
13576                 }
13577         }
13578 }
13579 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13580         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13581                 let contents = if o.result_ok {
13582                         let result = unsafe { o.contents.result };
13583                         unsafe { o.contents.result = core::ptr::null_mut() };
13584                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13585                 } else {
13586                         let err = unsafe { o.contents.err };
13587                         unsafe { o.contents.err = core::ptr::null_mut(); }
13588                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13589                 };
13590                 Self {
13591                         contents,
13592                         result_ok: o.result_ok,
13593                 }
13594         }
13595 }
13596 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13597         fn clone(&self) -> Self {
13598                 if self.result_ok {
13599                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13600                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13601                         } }
13602                 } else {
13603                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13604                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13605                         } }
13606                 }
13607         }
13608 }
13609 #[no_mangle]
13610 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13611 /// but with all dynamically-allocated buffers duplicated in new buffers.
13612 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13613 #[repr(C)]
13614 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13615 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13616         /// A pointer to the contents in the success state.
13617         /// Reading from this pointer when `result_ok` is not set is undefined.
13618         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13619         /// A pointer to the contents in the error state.
13620         /// Reading from this pointer when `result_ok` is set is undefined.
13621         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13622 }
13623 #[repr(C)]
13624 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13625 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13626 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13627 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13628         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13629         /// `err` or `result` depending on the state of `result_ok`.
13630         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13631         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13632         pub result_ok: bool,
13633 }
13634 #[no_mangle]
13635 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13636 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13637         CResult_UpdateAddHTLCDecodeErrorZ {
13638                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13639                         result: Box::into_raw(Box::new(o)),
13640                 },
13641                 result_ok: true,
13642         }
13643 }
13644 #[no_mangle]
13645 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13646 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13647         CResult_UpdateAddHTLCDecodeErrorZ {
13648                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13649                         err: Box::into_raw(Box::new(e)),
13650                 },
13651                 result_ok: false,
13652         }
13653 }
13654 /// Checks if the given object is currently in the success state
13655 #[no_mangle]
13656 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13657         o.result_ok
13658 }
13659 #[no_mangle]
13660 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13661 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13662 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13663         fn drop(&mut self) {
13664                 if self.result_ok {
13665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13667                         }
13668                 } else {
13669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13671                         }
13672                 }
13673         }
13674 }
13675 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13676         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13677                 let contents = if o.result_ok {
13678                         let result = unsafe { o.contents.result };
13679                         unsafe { o.contents.result = core::ptr::null_mut() };
13680                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13681                 } else {
13682                         let err = unsafe { o.contents.err };
13683                         unsafe { o.contents.err = core::ptr::null_mut(); }
13684                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13685                 };
13686                 Self {
13687                         contents,
13688                         result_ok: o.result_ok,
13689                 }
13690         }
13691 }
13692 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13693         fn clone(&self) -> Self {
13694                 if self.result_ok {
13695                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13696                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13697                         } }
13698                 } else {
13699                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13700                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13701                         } }
13702                 }
13703         }
13704 }
13705 #[no_mangle]
13706 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13707 /// but with all dynamically-allocated buffers duplicated in new buffers.
13708 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13709 #[repr(C)]
13710 /// The contents of CResult_PingDecodeErrorZ
13711 pub union CResult_PingDecodeErrorZPtr {
13712         /// A pointer to the contents in the success state.
13713         /// Reading from this pointer when `result_ok` is not set is undefined.
13714         pub result: *mut crate::lightning::ln::msgs::Ping,
13715         /// A pointer to the contents in the error state.
13716         /// Reading from this pointer when `result_ok` is set is undefined.
13717         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13718 }
13719 #[repr(C)]
13720 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13721 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13722 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13723 pub struct CResult_PingDecodeErrorZ {
13724         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13725         /// `err` or `result` depending on the state of `result_ok`.
13726         pub contents: CResult_PingDecodeErrorZPtr,
13727         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13728         pub result_ok: bool,
13729 }
13730 #[no_mangle]
13731 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13732 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13733         CResult_PingDecodeErrorZ {
13734                 contents: CResult_PingDecodeErrorZPtr {
13735                         result: Box::into_raw(Box::new(o)),
13736                 },
13737                 result_ok: true,
13738         }
13739 }
13740 #[no_mangle]
13741 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13742 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13743         CResult_PingDecodeErrorZ {
13744                 contents: CResult_PingDecodeErrorZPtr {
13745                         err: Box::into_raw(Box::new(e)),
13746                 },
13747                 result_ok: false,
13748         }
13749 }
13750 /// Checks if the given object is currently in the success state
13751 #[no_mangle]
13752 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13753         o.result_ok
13754 }
13755 #[no_mangle]
13756 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13757 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13758 impl Drop for CResult_PingDecodeErrorZ {
13759         fn drop(&mut self) {
13760                 if self.result_ok {
13761                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13762                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13763                         }
13764                 } else {
13765                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13766                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13767                         }
13768                 }
13769         }
13770 }
13771 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13772         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13773                 let contents = if o.result_ok {
13774                         let result = unsafe { o.contents.result };
13775                         unsafe { o.contents.result = core::ptr::null_mut() };
13776                         CResult_PingDecodeErrorZPtr { result }
13777                 } else {
13778                         let err = unsafe { o.contents.err };
13779                         unsafe { o.contents.err = core::ptr::null_mut(); }
13780                         CResult_PingDecodeErrorZPtr { err }
13781                 };
13782                 Self {
13783                         contents,
13784                         result_ok: o.result_ok,
13785                 }
13786         }
13787 }
13788 impl Clone for CResult_PingDecodeErrorZ {
13789         fn clone(&self) -> Self {
13790                 if self.result_ok {
13791                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13792                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13793                         } }
13794                 } else {
13795                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13796                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13797                         } }
13798                 }
13799         }
13800 }
13801 #[no_mangle]
13802 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13803 /// but with all dynamically-allocated buffers duplicated in new buffers.
13804 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13805 #[repr(C)]
13806 /// The contents of CResult_PongDecodeErrorZ
13807 pub union CResult_PongDecodeErrorZPtr {
13808         /// A pointer to the contents in the success state.
13809         /// Reading from this pointer when `result_ok` is not set is undefined.
13810         pub result: *mut crate::lightning::ln::msgs::Pong,
13811         /// A pointer to the contents in the error state.
13812         /// Reading from this pointer when `result_ok` is set is undefined.
13813         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13814 }
13815 #[repr(C)]
13816 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13817 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13819 pub struct CResult_PongDecodeErrorZ {
13820         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13821         /// `err` or `result` depending on the state of `result_ok`.
13822         pub contents: CResult_PongDecodeErrorZPtr,
13823         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13824         pub result_ok: bool,
13825 }
13826 #[no_mangle]
13827 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13828 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13829         CResult_PongDecodeErrorZ {
13830                 contents: CResult_PongDecodeErrorZPtr {
13831                         result: Box::into_raw(Box::new(o)),
13832                 },
13833                 result_ok: true,
13834         }
13835 }
13836 #[no_mangle]
13837 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13838 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13839         CResult_PongDecodeErrorZ {
13840                 contents: CResult_PongDecodeErrorZPtr {
13841                         err: Box::into_raw(Box::new(e)),
13842                 },
13843                 result_ok: false,
13844         }
13845 }
13846 /// Checks if the given object is currently in the success state
13847 #[no_mangle]
13848 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13849         o.result_ok
13850 }
13851 #[no_mangle]
13852 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13853 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13854 impl Drop for CResult_PongDecodeErrorZ {
13855         fn drop(&mut self) {
13856                 if self.result_ok {
13857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13859                         }
13860                 } else {
13861                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13862                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13863                         }
13864                 }
13865         }
13866 }
13867 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13868         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13869                 let contents = if o.result_ok {
13870                         let result = unsafe { o.contents.result };
13871                         unsafe { o.contents.result = core::ptr::null_mut() };
13872                         CResult_PongDecodeErrorZPtr { result }
13873                 } else {
13874                         let err = unsafe { o.contents.err };
13875                         unsafe { o.contents.err = core::ptr::null_mut(); }
13876                         CResult_PongDecodeErrorZPtr { err }
13877                 };
13878                 Self {
13879                         contents,
13880                         result_ok: o.result_ok,
13881                 }
13882         }
13883 }
13884 impl Clone for CResult_PongDecodeErrorZ {
13885         fn clone(&self) -> Self {
13886                 if self.result_ok {
13887                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13888                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13889                         } }
13890                 } else {
13891                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13892                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13893                         } }
13894                 }
13895         }
13896 }
13897 #[no_mangle]
13898 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13899 /// but with all dynamically-allocated buffers duplicated in new buffers.
13900 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13901 #[repr(C)]
13902 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13903 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13904         /// A pointer to the contents in the success state.
13905         /// Reading from this pointer when `result_ok` is not set is undefined.
13906         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13907         /// A pointer to the contents in the error state.
13908         /// Reading from this pointer when `result_ok` is set is undefined.
13909         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13910 }
13911 #[repr(C)]
13912 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13913 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13914 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13915 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13916         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13917         /// `err` or `result` depending on the state of `result_ok`.
13918         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13919         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13920         pub result_ok: bool,
13921 }
13922 #[no_mangle]
13923 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13924 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13925         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13926                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13927                         result: Box::into_raw(Box::new(o)),
13928                 },
13929                 result_ok: true,
13930         }
13931 }
13932 #[no_mangle]
13933 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13934 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13935         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13936                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13937                         err: Box::into_raw(Box::new(e)),
13938                 },
13939                 result_ok: false,
13940         }
13941 }
13942 /// Checks if the given object is currently in the success state
13943 #[no_mangle]
13944 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13945         o.result_ok
13946 }
13947 #[no_mangle]
13948 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13949 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13950 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13951         fn drop(&mut self) {
13952                 if self.result_ok {
13953                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13954                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13955                         }
13956                 } else {
13957                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13958                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13959                         }
13960                 }
13961         }
13962 }
13963 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13964         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13965                 let contents = if o.result_ok {
13966                         let result = unsafe { o.contents.result };
13967                         unsafe { o.contents.result = core::ptr::null_mut() };
13968                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13969                 } else {
13970                         let err = unsafe { o.contents.err };
13971                         unsafe { o.contents.err = core::ptr::null_mut(); }
13972                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13973                 };
13974                 Self {
13975                         contents,
13976                         result_ok: o.result_ok,
13977                 }
13978         }
13979 }
13980 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13981         fn clone(&self) -> Self {
13982                 if self.result_ok {
13983                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13984                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13985                         } }
13986                 } else {
13987                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13988                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13989                         } }
13990                 }
13991         }
13992 }
13993 #[no_mangle]
13994 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13995 /// but with all dynamically-allocated buffers duplicated in new buffers.
13996 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13997 #[repr(C)]
13998 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13999 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14000         /// A pointer to the contents in the success state.
14001         /// Reading from this pointer when `result_ok` is not set is undefined.
14002         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14003         /// A pointer to the contents in the error state.
14004         /// Reading from this pointer when `result_ok` is set is undefined.
14005         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14006 }
14007 #[repr(C)]
14008 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14009 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14010 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14011 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14012         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14013         /// `err` or `result` depending on the state of `result_ok`.
14014         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14015         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14016         pub result_ok: bool,
14017 }
14018 #[no_mangle]
14019 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14020 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14021         CResult_ChannelAnnouncementDecodeErrorZ {
14022                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14023                         result: Box::into_raw(Box::new(o)),
14024                 },
14025                 result_ok: true,
14026         }
14027 }
14028 #[no_mangle]
14029 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14030 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14031         CResult_ChannelAnnouncementDecodeErrorZ {
14032                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14033                         err: Box::into_raw(Box::new(e)),
14034                 },
14035                 result_ok: false,
14036         }
14037 }
14038 /// Checks if the given object is currently in the success state
14039 #[no_mangle]
14040 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14041         o.result_ok
14042 }
14043 #[no_mangle]
14044 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14045 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14046 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14047         fn drop(&mut self) {
14048                 if self.result_ok {
14049                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14050                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14051                         }
14052                 } else {
14053                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14054                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14055                         }
14056                 }
14057         }
14058 }
14059 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14060         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14061                 let contents = if o.result_ok {
14062                         let result = unsafe { o.contents.result };
14063                         unsafe { o.contents.result = core::ptr::null_mut() };
14064                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14065                 } else {
14066                         let err = unsafe { o.contents.err };
14067                         unsafe { o.contents.err = core::ptr::null_mut(); }
14068                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14069                 };
14070                 Self {
14071                         contents,
14072                         result_ok: o.result_ok,
14073                 }
14074         }
14075 }
14076 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14077         fn clone(&self) -> Self {
14078                 if self.result_ok {
14079                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14080                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14081                         } }
14082                 } else {
14083                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14084                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14085                         } }
14086                 }
14087         }
14088 }
14089 #[no_mangle]
14090 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14091 /// but with all dynamically-allocated buffers duplicated in new buffers.
14092 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14093 #[repr(C)]
14094 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14095 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14096         /// A pointer to the contents in the success state.
14097         /// Reading from this pointer when `result_ok` is not set is undefined.
14098         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14099         /// A pointer to the contents in the error state.
14100         /// Reading from this pointer when `result_ok` is set is undefined.
14101         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14102 }
14103 #[repr(C)]
14104 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14105 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14106 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14107 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14108         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14109         /// `err` or `result` depending on the state of `result_ok`.
14110         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14111         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14112         pub result_ok: bool,
14113 }
14114 #[no_mangle]
14115 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14116 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14117         CResult_UnsignedChannelUpdateDecodeErrorZ {
14118                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14119                         result: Box::into_raw(Box::new(o)),
14120                 },
14121                 result_ok: true,
14122         }
14123 }
14124 #[no_mangle]
14125 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14126 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14127         CResult_UnsignedChannelUpdateDecodeErrorZ {
14128                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14129                         err: Box::into_raw(Box::new(e)),
14130                 },
14131                 result_ok: false,
14132         }
14133 }
14134 /// Checks if the given object is currently in the success state
14135 #[no_mangle]
14136 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14137         o.result_ok
14138 }
14139 #[no_mangle]
14140 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14141 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14142 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14143         fn drop(&mut self) {
14144                 if self.result_ok {
14145                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14146                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14147                         }
14148                 } else {
14149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14151                         }
14152                 }
14153         }
14154 }
14155 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14156         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14157                 let contents = if o.result_ok {
14158                         let result = unsafe { o.contents.result };
14159                         unsafe { o.contents.result = core::ptr::null_mut() };
14160                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14161                 } else {
14162                         let err = unsafe { o.contents.err };
14163                         unsafe { o.contents.err = core::ptr::null_mut(); }
14164                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14165                 };
14166                 Self {
14167                         contents,
14168                         result_ok: o.result_ok,
14169                 }
14170         }
14171 }
14172 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14173         fn clone(&self) -> Self {
14174                 if self.result_ok {
14175                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14176                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14177                         } }
14178                 } else {
14179                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14180                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14181                         } }
14182                 }
14183         }
14184 }
14185 #[no_mangle]
14186 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14187 /// but with all dynamically-allocated buffers duplicated in new buffers.
14188 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14189 #[repr(C)]
14190 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14191 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14192         /// A pointer to the contents in the success state.
14193         /// Reading from this pointer when `result_ok` is not set is undefined.
14194         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14195         /// A pointer to the contents in the error state.
14196         /// Reading from this pointer when `result_ok` is set is undefined.
14197         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14198 }
14199 #[repr(C)]
14200 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14201 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14202 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14203 pub struct CResult_ChannelUpdateDecodeErrorZ {
14204         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14205         /// `err` or `result` depending on the state of `result_ok`.
14206         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14207         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14208         pub result_ok: bool,
14209 }
14210 #[no_mangle]
14211 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14212 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14213         CResult_ChannelUpdateDecodeErrorZ {
14214                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14215                         result: Box::into_raw(Box::new(o)),
14216                 },
14217                 result_ok: true,
14218         }
14219 }
14220 #[no_mangle]
14221 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14222 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14223         CResult_ChannelUpdateDecodeErrorZ {
14224                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14225                         err: Box::into_raw(Box::new(e)),
14226                 },
14227                 result_ok: false,
14228         }
14229 }
14230 /// Checks if the given object is currently in the success state
14231 #[no_mangle]
14232 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14233         o.result_ok
14234 }
14235 #[no_mangle]
14236 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14237 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14238 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14239         fn drop(&mut self) {
14240                 if self.result_ok {
14241                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14242                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14243                         }
14244                 } else {
14245                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14246                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14247                         }
14248                 }
14249         }
14250 }
14251 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14252         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14253                 let contents = if o.result_ok {
14254                         let result = unsafe { o.contents.result };
14255                         unsafe { o.contents.result = core::ptr::null_mut() };
14256                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14257                 } else {
14258                         let err = unsafe { o.contents.err };
14259                         unsafe { o.contents.err = core::ptr::null_mut(); }
14260                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14261                 };
14262                 Self {
14263                         contents,
14264                         result_ok: o.result_ok,
14265                 }
14266         }
14267 }
14268 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14269         fn clone(&self) -> Self {
14270                 if self.result_ok {
14271                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14272                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14273                         } }
14274                 } else {
14275                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14276                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14277                         } }
14278                 }
14279         }
14280 }
14281 #[no_mangle]
14282 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14283 /// but with all dynamically-allocated buffers duplicated in new buffers.
14284 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14285 #[repr(C)]
14286 /// The contents of CResult_ErrorMessageDecodeErrorZ
14287 pub union CResult_ErrorMessageDecodeErrorZPtr {
14288         /// A pointer to the contents in the success state.
14289         /// Reading from this pointer when `result_ok` is not set is undefined.
14290         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14291         /// A pointer to the contents in the error state.
14292         /// Reading from this pointer when `result_ok` is set is undefined.
14293         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14294 }
14295 #[repr(C)]
14296 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14297 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14298 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14299 pub struct CResult_ErrorMessageDecodeErrorZ {
14300         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14301         /// `err` or `result` depending on the state of `result_ok`.
14302         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14303         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14304         pub result_ok: bool,
14305 }
14306 #[no_mangle]
14307 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14308 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14309         CResult_ErrorMessageDecodeErrorZ {
14310                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14311                         result: Box::into_raw(Box::new(o)),
14312                 },
14313                 result_ok: true,
14314         }
14315 }
14316 #[no_mangle]
14317 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14318 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14319         CResult_ErrorMessageDecodeErrorZ {
14320                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14321                         err: Box::into_raw(Box::new(e)),
14322                 },
14323                 result_ok: false,
14324         }
14325 }
14326 /// Checks if the given object is currently in the success state
14327 #[no_mangle]
14328 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14329         o.result_ok
14330 }
14331 #[no_mangle]
14332 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14333 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14334 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14335         fn drop(&mut self) {
14336                 if self.result_ok {
14337                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14338                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14339                         }
14340                 } else {
14341                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14342                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14343                         }
14344                 }
14345         }
14346 }
14347 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14348         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14349                 let contents = if o.result_ok {
14350                         let result = unsafe { o.contents.result };
14351                         unsafe { o.contents.result = core::ptr::null_mut() };
14352                         CResult_ErrorMessageDecodeErrorZPtr { result }
14353                 } else {
14354                         let err = unsafe { o.contents.err };
14355                         unsafe { o.contents.err = core::ptr::null_mut(); }
14356                         CResult_ErrorMessageDecodeErrorZPtr { err }
14357                 };
14358                 Self {
14359                         contents,
14360                         result_ok: o.result_ok,
14361                 }
14362         }
14363 }
14364 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14365         fn clone(&self) -> Self {
14366                 if self.result_ok {
14367                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14368                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14369                         } }
14370                 } else {
14371                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14372                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14373                         } }
14374                 }
14375         }
14376 }
14377 #[no_mangle]
14378 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14379 /// but with all dynamically-allocated buffers duplicated in new buffers.
14380 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14381 #[repr(C)]
14382 /// The contents of CResult_WarningMessageDecodeErrorZ
14383 pub union CResult_WarningMessageDecodeErrorZPtr {
14384         /// A pointer to the contents in the success state.
14385         /// Reading from this pointer when `result_ok` is not set is undefined.
14386         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14387         /// A pointer to the contents in the error state.
14388         /// Reading from this pointer when `result_ok` is set is undefined.
14389         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14390 }
14391 #[repr(C)]
14392 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14393 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14394 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14395 pub struct CResult_WarningMessageDecodeErrorZ {
14396         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14397         /// `err` or `result` depending on the state of `result_ok`.
14398         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14399         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14400         pub result_ok: bool,
14401 }
14402 #[no_mangle]
14403 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14404 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14405         CResult_WarningMessageDecodeErrorZ {
14406                 contents: CResult_WarningMessageDecodeErrorZPtr {
14407                         result: Box::into_raw(Box::new(o)),
14408                 },
14409                 result_ok: true,
14410         }
14411 }
14412 #[no_mangle]
14413 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14414 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14415         CResult_WarningMessageDecodeErrorZ {
14416                 contents: CResult_WarningMessageDecodeErrorZPtr {
14417                         err: Box::into_raw(Box::new(e)),
14418                 },
14419                 result_ok: false,
14420         }
14421 }
14422 /// Checks if the given object is currently in the success state
14423 #[no_mangle]
14424 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14425         o.result_ok
14426 }
14427 #[no_mangle]
14428 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14429 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14430 impl Drop for CResult_WarningMessageDecodeErrorZ {
14431         fn drop(&mut self) {
14432                 if self.result_ok {
14433                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14434                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14435                         }
14436                 } else {
14437                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14438                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14439                         }
14440                 }
14441         }
14442 }
14443 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14444         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14445                 let contents = if o.result_ok {
14446                         let result = unsafe { o.contents.result };
14447                         unsafe { o.contents.result = core::ptr::null_mut() };
14448                         CResult_WarningMessageDecodeErrorZPtr { result }
14449                 } else {
14450                         let err = unsafe { o.contents.err };
14451                         unsafe { o.contents.err = core::ptr::null_mut(); }
14452                         CResult_WarningMessageDecodeErrorZPtr { err }
14453                 };
14454                 Self {
14455                         contents,
14456                         result_ok: o.result_ok,
14457                 }
14458         }
14459 }
14460 impl Clone for CResult_WarningMessageDecodeErrorZ {
14461         fn clone(&self) -> Self {
14462                 if self.result_ok {
14463                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14464                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14465                         } }
14466                 } else {
14467                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14468                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14469                         } }
14470                 }
14471         }
14472 }
14473 #[no_mangle]
14474 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14475 /// but with all dynamically-allocated buffers duplicated in new buffers.
14476 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14477 #[repr(C)]
14478 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14479 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14480         /// A pointer to the contents in the success state.
14481         /// Reading from this pointer when `result_ok` is not set is undefined.
14482         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14483         /// A pointer to the contents in the error state.
14484         /// Reading from this pointer when `result_ok` is set is undefined.
14485         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14486 }
14487 #[repr(C)]
14488 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14489 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14490 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14491 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14492         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14493         /// `err` or `result` depending on the state of `result_ok`.
14494         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14495         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14496         pub result_ok: bool,
14497 }
14498 #[no_mangle]
14499 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14500 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14501         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14502                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14503                         result: Box::into_raw(Box::new(o)),
14504                 },
14505                 result_ok: true,
14506         }
14507 }
14508 #[no_mangle]
14509 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14510 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14511         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14512                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14513                         err: Box::into_raw(Box::new(e)),
14514                 },
14515                 result_ok: false,
14516         }
14517 }
14518 /// Checks if the given object is currently in the success state
14519 #[no_mangle]
14520 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14521         o.result_ok
14522 }
14523 #[no_mangle]
14524 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14525 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14526 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14527         fn drop(&mut self) {
14528                 if self.result_ok {
14529                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14530                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14531                         }
14532                 } else {
14533                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14534                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14535                         }
14536                 }
14537         }
14538 }
14539 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14540         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14541                 let contents = if o.result_ok {
14542                         let result = unsafe { o.contents.result };
14543                         unsafe { o.contents.result = core::ptr::null_mut() };
14544                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14545                 } else {
14546                         let err = unsafe { o.contents.err };
14547                         unsafe { o.contents.err = core::ptr::null_mut(); }
14548                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14549                 };
14550                 Self {
14551                         contents,
14552                         result_ok: o.result_ok,
14553                 }
14554         }
14555 }
14556 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14557         fn clone(&self) -> Self {
14558                 if self.result_ok {
14559                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14560                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14561                         } }
14562                 } else {
14563                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14564                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14565                         } }
14566                 }
14567         }
14568 }
14569 #[no_mangle]
14570 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14571 /// but with all dynamically-allocated buffers duplicated in new buffers.
14572 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14573 #[repr(C)]
14574 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14575 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14576         /// A pointer to the contents in the success state.
14577         /// Reading from this pointer when `result_ok` is not set is undefined.
14578         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14579         /// A pointer to the contents in the error state.
14580         /// Reading from this pointer when `result_ok` is set is undefined.
14581         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14582 }
14583 #[repr(C)]
14584 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14585 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14586 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14587 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14588         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14589         /// `err` or `result` depending on the state of `result_ok`.
14590         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14591         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14592         pub result_ok: bool,
14593 }
14594 #[no_mangle]
14595 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14596 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14597         CResult_NodeAnnouncementDecodeErrorZ {
14598                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14599                         result: Box::into_raw(Box::new(o)),
14600                 },
14601                 result_ok: true,
14602         }
14603 }
14604 #[no_mangle]
14605 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14606 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14607         CResult_NodeAnnouncementDecodeErrorZ {
14608                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14609                         err: Box::into_raw(Box::new(e)),
14610                 },
14611                 result_ok: false,
14612         }
14613 }
14614 /// Checks if the given object is currently in the success state
14615 #[no_mangle]
14616 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14617         o.result_ok
14618 }
14619 #[no_mangle]
14620 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14621 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14622 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14623         fn drop(&mut self) {
14624                 if self.result_ok {
14625                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14626                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14627                         }
14628                 } else {
14629                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14630                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14631                         }
14632                 }
14633         }
14634 }
14635 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14636         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14637                 let contents = if o.result_ok {
14638                         let result = unsafe { o.contents.result };
14639                         unsafe { o.contents.result = core::ptr::null_mut() };
14640                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14641                 } else {
14642                         let err = unsafe { o.contents.err };
14643                         unsafe { o.contents.err = core::ptr::null_mut(); }
14644                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14645                 };
14646                 Self {
14647                         contents,
14648                         result_ok: o.result_ok,
14649                 }
14650         }
14651 }
14652 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14653         fn clone(&self) -> Self {
14654                 if self.result_ok {
14655                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14656                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14657                         } }
14658                 } else {
14659                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14660                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14661                         } }
14662                 }
14663         }
14664 }
14665 #[no_mangle]
14666 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14667 /// but with all dynamically-allocated buffers duplicated in new buffers.
14668 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14669 #[repr(C)]
14670 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14671 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14672         /// A pointer to the contents in the success state.
14673         /// Reading from this pointer when `result_ok` is not set is undefined.
14674         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14675         /// A pointer to the contents in the error state.
14676         /// Reading from this pointer when `result_ok` is set is undefined.
14677         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14678 }
14679 #[repr(C)]
14680 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14681 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14682 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14683 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14684         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14685         /// `err` or `result` depending on the state of `result_ok`.
14686         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14687         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14688         pub result_ok: bool,
14689 }
14690 #[no_mangle]
14691 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14692 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14693         CResult_QueryShortChannelIdsDecodeErrorZ {
14694                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14695                         result: Box::into_raw(Box::new(o)),
14696                 },
14697                 result_ok: true,
14698         }
14699 }
14700 #[no_mangle]
14701 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14702 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14703         CResult_QueryShortChannelIdsDecodeErrorZ {
14704                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14705                         err: Box::into_raw(Box::new(e)),
14706                 },
14707                 result_ok: false,
14708         }
14709 }
14710 /// Checks if the given object is currently in the success state
14711 #[no_mangle]
14712 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14713         o.result_ok
14714 }
14715 #[no_mangle]
14716 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14717 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14718 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14719         fn drop(&mut self) {
14720                 if self.result_ok {
14721                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14722                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14723                         }
14724                 } else {
14725                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14726                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14727                         }
14728                 }
14729         }
14730 }
14731 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14732         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14733                 let contents = if o.result_ok {
14734                         let result = unsafe { o.contents.result };
14735                         unsafe { o.contents.result = core::ptr::null_mut() };
14736                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14737                 } else {
14738                         let err = unsafe { o.contents.err };
14739                         unsafe { o.contents.err = core::ptr::null_mut(); }
14740                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14741                 };
14742                 Self {
14743                         contents,
14744                         result_ok: o.result_ok,
14745                 }
14746         }
14747 }
14748 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14749         fn clone(&self) -> Self {
14750                 if self.result_ok {
14751                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14752                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14753                         } }
14754                 } else {
14755                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14756                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14757                         } }
14758                 }
14759         }
14760 }
14761 #[no_mangle]
14762 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14763 /// but with all dynamically-allocated buffers duplicated in new buffers.
14764 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14765 #[repr(C)]
14766 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14767 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14768         /// A pointer to the contents in the success state.
14769         /// Reading from this pointer when `result_ok` is not set is undefined.
14770         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14771         /// A pointer to the contents in the error state.
14772         /// Reading from this pointer when `result_ok` is set is undefined.
14773         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14774 }
14775 #[repr(C)]
14776 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14777 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14778 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14779 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14780         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14781         /// `err` or `result` depending on the state of `result_ok`.
14782         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14783         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14784         pub result_ok: bool,
14785 }
14786 #[no_mangle]
14787 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14788 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14789         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14790                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14791                         result: Box::into_raw(Box::new(o)),
14792                 },
14793                 result_ok: true,
14794         }
14795 }
14796 #[no_mangle]
14797 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14798 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14799         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14800                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14801                         err: Box::into_raw(Box::new(e)),
14802                 },
14803                 result_ok: false,
14804         }
14805 }
14806 /// Checks if the given object is currently in the success state
14807 #[no_mangle]
14808 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14809         o.result_ok
14810 }
14811 #[no_mangle]
14812 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14813 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14814 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14815         fn drop(&mut self) {
14816                 if self.result_ok {
14817                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14818                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14819                         }
14820                 } else {
14821                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14822                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14823                         }
14824                 }
14825         }
14826 }
14827 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14828         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14829                 let contents = if o.result_ok {
14830                         let result = unsafe { o.contents.result };
14831                         unsafe { o.contents.result = core::ptr::null_mut() };
14832                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14833                 } else {
14834                         let err = unsafe { o.contents.err };
14835                         unsafe { o.contents.err = core::ptr::null_mut(); }
14836                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14837                 };
14838                 Self {
14839                         contents,
14840                         result_ok: o.result_ok,
14841                 }
14842         }
14843 }
14844 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14845         fn clone(&self) -> Self {
14846                 if self.result_ok {
14847                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14848                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14849                         } }
14850                 } else {
14851                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14852                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14853                         } }
14854                 }
14855         }
14856 }
14857 #[no_mangle]
14858 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14859 /// but with all dynamically-allocated buffers duplicated in new buffers.
14860 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14861 #[repr(C)]
14862 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14863 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14864         /// A pointer to the contents in the success state.
14865         /// Reading from this pointer when `result_ok` is not set is undefined.
14866         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14867         /// A pointer to the contents in the error state.
14868         /// Reading from this pointer when `result_ok` is set is undefined.
14869         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14870 }
14871 #[repr(C)]
14872 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14873 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14874 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14875 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14876         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14877         /// `err` or `result` depending on the state of `result_ok`.
14878         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14879         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14880         pub result_ok: bool,
14881 }
14882 #[no_mangle]
14883 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14884 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14885         CResult_QueryChannelRangeDecodeErrorZ {
14886                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14887                         result: Box::into_raw(Box::new(o)),
14888                 },
14889                 result_ok: true,
14890         }
14891 }
14892 #[no_mangle]
14893 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14894 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14895         CResult_QueryChannelRangeDecodeErrorZ {
14896                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14897                         err: Box::into_raw(Box::new(e)),
14898                 },
14899                 result_ok: false,
14900         }
14901 }
14902 /// Checks if the given object is currently in the success state
14903 #[no_mangle]
14904 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14905         o.result_ok
14906 }
14907 #[no_mangle]
14908 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14909 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14910 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14911         fn drop(&mut self) {
14912                 if self.result_ok {
14913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14915                         }
14916                 } else {
14917                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14918                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14919                         }
14920                 }
14921         }
14922 }
14923 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14924         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14925                 let contents = if o.result_ok {
14926                         let result = unsafe { o.contents.result };
14927                         unsafe { o.contents.result = core::ptr::null_mut() };
14928                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14929                 } else {
14930                         let err = unsafe { o.contents.err };
14931                         unsafe { o.contents.err = core::ptr::null_mut(); }
14932                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14933                 };
14934                 Self {
14935                         contents,
14936                         result_ok: o.result_ok,
14937                 }
14938         }
14939 }
14940 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14941         fn clone(&self) -> Self {
14942                 if self.result_ok {
14943                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14944                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14945                         } }
14946                 } else {
14947                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14948                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14949                         } }
14950                 }
14951         }
14952 }
14953 #[no_mangle]
14954 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14955 /// but with all dynamically-allocated buffers duplicated in new buffers.
14956 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14957 #[repr(C)]
14958 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14959 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14960         /// A pointer to the contents in the success state.
14961         /// Reading from this pointer when `result_ok` is not set is undefined.
14962         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14963         /// A pointer to the contents in the error state.
14964         /// Reading from this pointer when `result_ok` is set is undefined.
14965         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14966 }
14967 #[repr(C)]
14968 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14969 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14970 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14971 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14972         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14973         /// `err` or `result` depending on the state of `result_ok`.
14974         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14975         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14976         pub result_ok: bool,
14977 }
14978 #[no_mangle]
14979 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14980 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14981         CResult_ReplyChannelRangeDecodeErrorZ {
14982                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14983                         result: Box::into_raw(Box::new(o)),
14984                 },
14985                 result_ok: true,
14986         }
14987 }
14988 #[no_mangle]
14989 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14990 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14991         CResult_ReplyChannelRangeDecodeErrorZ {
14992                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14993                         err: Box::into_raw(Box::new(e)),
14994                 },
14995                 result_ok: false,
14996         }
14997 }
14998 /// Checks if the given object is currently in the success state
14999 #[no_mangle]
15000 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15001         o.result_ok
15002 }
15003 #[no_mangle]
15004 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15005 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15006 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15007         fn drop(&mut self) {
15008                 if self.result_ok {
15009                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15010                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15011                         }
15012                 } else {
15013                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15014                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15015                         }
15016                 }
15017         }
15018 }
15019 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15020         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15021                 let contents = if o.result_ok {
15022                         let result = unsafe { o.contents.result };
15023                         unsafe { o.contents.result = core::ptr::null_mut() };
15024                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15025                 } else {
15026                         let err = unsafe { o.contents.err };
15027                         unsafe { o.contents.err = core::ptr::null_mut(); }
15028                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15029                 };
15030                 Self {
15031                         contents,
15032                         result_ok: o.result_ok,
15033                 }
15034         }
15035 }
15036 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15037         fn clone(&self) -> Self {
15038                 if self.result_ok {
15039                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15040                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15041                         } }
15042                 } else {
15043                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15044                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15045                         } }
15046                 }
15047         }
15048 }
15049 #[no_mangle]
15050 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15051 /// but with all dynamically-allocated buffers duplicated in new buffers.
15052 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15053 #[repr(C)]
15054 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15055 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15056         /// A pointer to the contents in the success state.
15057         /// Reading from this pointer when `result_ok` is not set is undefined.
15058         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15059         /// A pointer to the contents in the error state.
15060         /// Reading from this pointer when `result_ok` is set is undefined.
15061         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15062 }
15063 #[repr(C)]
15064 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15065 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15066 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15067 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15068         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15069         /// `err` or `result` depending on the state of `result_ok`.
15070         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15071         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15072         pub result_ok: bool,
15073 }
15074 #[no_mangle]
15075 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15076 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15077         CResult_GossipTimestampFilterDecodeErrorZ {
15078                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15079                         result: Box::into_raw(Box::new(o)),
15080                 },
15081                 result_ok: true,
15082         }
15083 }
15084 #[no_mangle]
15085 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15086 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15087         CResult_GossipTimestampFilterDecodeErrorZ {
15088                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15089                         err: Box::into_raw(Box::new(e)),
15090                 },
15091                 result_ok: false,
15092         }
15093 }
15094 /// Checks if the given object is currently in the success state
15095 #[no_mangle]
15096 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15097         o.result_ok
15098 }
15099 #[no_mangle]
15100 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15101 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15102 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15103         fn drop(&mut self) {
15104                 if self.result_ok {
15105                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15106                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15107                         }
15108                 } else {
15109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15111                         }
15112                 }
15113         }
15114 }
15115 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15116         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15117                 let contents = if o.result_ok {
15118                         let result = unsafe { o.contents.result };
15119                         unsafe { o.contents.result = core::ptr::null_mut() };
15120                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15121                 } else {
15122                         let err = unsafe { o.contents.err };
15123                         unsafe { o.contents.err = core::ptr::null_mut(); }
15124                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15125                 };
15126                 Self {
15127                         contents,
15128                         result_ok: o.result_ok,
15129                 }
15130         }
15131 }
15132 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15133         fn clone(&self) -> Self {
15134                 if self.result_ok {
15135                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15136                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15137                         } }
15138                 } else {
15139                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15140                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15141                         } }
15142                 }
15143         }
15144 }
15145 #[no_mangle]
15146 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15147 /// but with all dynamically-allocated buffers duplicated in new buffers.
15148 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15149 #[repr(C)]
15150 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15151 /// This corresponds to std::vector in C++
15152 pub struct CVec_PhantomRouteHintsZ {
15153         /// The elements in the array.
15154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15155         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15156         /// The number of elements pointed to by `data`.
15157         pub datalen: usize
15158 }
15159 impl CVec_PhantomRouteHintsZ {
15160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15161                 if self.datalen == 0 { return Vec::new(); }
15162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15163                 self.data = core::ptr::null_mut();
15164                 self.datalen = 0;
15165                 ret
15166         }
15167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15169         }
15170 }
15171 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15172         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15173                 let datalen = v.len();
15174                 let data = Box::into_raw(v.into_boxed_slice());
15175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15176         }
15177 }
15178 #[no_mangle]
15179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15180 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15181 impl Drop for CVec_PhantomRouteHintsZ {
15182         fn drop(&mut self) {
15183                 if self.datalen == 0 { return; }
15184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15185         }
15186 }
15187 impl Clone for CVec_PhantomRouteHintsZ {
15188         fn clone(&self) -> Self {
15189                 let mut res = Vec::new();
15190                 if self.datalen == 0 { return Self::from(res); }
15191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15192                 Self::from(res)
15193         }
15194 }
15195 #[repr(C)]
15196 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15197 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15198         /// A pointer to the contents in the success state.
15199         /// Reading from this pointer when `result_ok` is not set is undefined.
15200         pub result: *mut crate::lightning_invoice::Invoice,
15201         /// A pointer to the contents in the error state.
15202         /// Reading from this pointer when `result_ok` is set is undefined.
15203         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15204 }
15205 #[repr(C)]
15206 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15207 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15209 pub struct CResult_InvoiceSignOrCreationErrorZ {
15210         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15211         /// `err` or `result` depending on the state of `result_ok`.
15212         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15213         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15214         pub result_ok: bool,
15215 }
15216 #[no_mangle]
15217 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15218 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15219         CResult_InvoiceSignOrCreationErrorZ {
15220                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15221                         result: Box::into_raw(Box::new(o)),
15222                 },
15223                 result_ok: true,
15224         }
15225 }
15226 #[no_mangle]
15227 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15228 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15229         CResult_InvoiceSignOrCreationErrorZ {
15230                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15231                         err: Box::into_raw(Box::new(e)),
15232                 },
15233                 result_ok: false,
15234         }
15235 }
15236 /// Checks if the given object is currently in the success state
15237 #[no_mangle]
15238 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15239         o.result_ok
15240 }
15241 #[no_mangle]
15242 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15243 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15244 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15245         fn drop(&mut self) {
15246                 if self.result_ok {
15247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15249                         }
15250                 } else {
15251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15253                         }
15254                 }
15255         }
15256 }
15257 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15259                 let contents = if o.result_ok {
15260                         let result = unsafe { o.contents.result };
15261                         unsafe { o.contents.result = core::ptr::null_mut() };
15262                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15263                 } else {
15264                         let err = unsafe { o.contents.err };
15265                         unsafe { o.contents.err = core::ptr::null_mut(); }
15266                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15267                 };
15268                 Self {
15269                         contents,
15270                         result_ok: o.result_ok,
15271                 }
15272         }
15273 }
15274 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15275         fn clone(&self) -> Self {
15276                 if self.result_ok {
15277                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15278                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15279                         } }
15280                 } else {
15281                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15282                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15283                         } }
15284                 }
15285         }
15286 }
15287 #[no_mangle]
15288 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15289 /// but with all dynamically-allocated buffers duplicated in new buffers.
15290 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15291 #[repr(C)]
15292 /// An enum which can either contain a crate::lightning::chain::Filter or not
15293 pub enum COption_FilterZ {
15294         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15295         Some(crate::lightning::chain::Filter),
15296         /// When we're in this state, this COption_FilterZ contains nothing
15297         None
15298 }
15299 impl COption_FilterZ {
15300         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15301                 if let Self::None = self { false } else { true }
15302         }
15303         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15304                 !self.is_some()
15305         }
15306         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15307                 if let Self::Some(v) = self { v } else { unreachable!() }
15308         }
15309 }
15310 #[no_mangle]
15311 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15312 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15313         COption_FilterZ::Some(o)
15314 }
15315 #[no_mangle]
15316 /// Constructs a new COption_FilterZ containing nothing
15317 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15318         COption_FilterZ::None
15319 }
15320 #[no_mangle]
15321 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15322 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15323 #[repr(C)]
15324 /// The contents of CResult_LockedChannelMonitorNoneZ
15325 pub union CResult_LockedChannelMonitorNoneZPtr {
15326         /// A pointer to the contents in the success state.
15327         /// Reading from this pointer when `result_ok` is not set is undefined.
15328         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15329         /// Note that this value is always NULL, as there are no contents in the Err variant
15330         pub err: *mut core::ffi::c_void,
15331 }
15332 #[repr(C)]
15333 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15334 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15336 pub struct CResult_LockedChannelMonitorNoneZ {
15337         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15338         /// `err` or `result` depending on the state of `result_ok`.
15339         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15340         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15341         pub result_ok: bool,
15342 }
15343 #[no_mangle]
15344 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15345 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15346         CResult_LockedChannelMonitorNoneZ {
15347                 contents: CResult_LockedChannelMonitorNoneZPtr {
15348                         result: Box::into_raw(Box::new(o)),
15349                 },
15350                 result_ok: true,
15351         }
15352 }
15353 #[no_mangle]
15354 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15355 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15356         CResult_LockedChannelMonitorNoneZ {
15357                 contents: CResult_LockedChannelMonitorNoneZPtr {
15358                         err: core::ptr::null_mut(),
15359                 },
15360                 result_ok: false,
15361         }
15362 }
15363 /// Checks if the given object is currently in the success state
15364 #[no_mangle]
15365 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15366         o.result_ok
15367 }
15368 #[no_mangle]
15369 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15370 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15371 impl Drop for CResult_LockedChannelMonitorNoneZ {
15372         fn drop(&mut self) {
15373                 if self.result_ok {
15374                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15375                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15376                         }
15377                 } else {
15378                 }
15379         }
15380 }
15381 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15382         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15383                 let contents = if o.result_ok {
15384                         let result = unsafe { o.contents.result };
15385                         unsafe { o.contents.result = core::ptr::null_mut() };
15386                         CResult_LockedChannelMonitorNoneZPtr { result }
15387                 } else {
15388                         let _ = unsafe { Box::from_raw(o.contents.err) };
15389                         o.contents.err = core::ptr::null_mut();
15390                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15391                 };
15392                 Self {
15393                         contents,
15394                         result_ok: o.result_ok,
15395                 }
15396         }
15397 }
15398 #[repr(C)]
15399 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15400 /// This corresponds to std::vector in C++
15401 pub struct CVec_OutPointZ {
15402         /// The elements in the array.
15403         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15404         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15405         /// The number of elements pointed to by `data`.
15406         pub datalen: usize
15407 }
15408 impl CVec_OutPointZ {
15409         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15410                 if self.datalen == 0 { return Vec::new(); }
15411                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15412                 self.data = core::ptr::null_mut();
15413                 self.datalen = 0;
15414                 ret
15415         }
15416         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15417                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15418         }
15419 }
15420 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15421         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15422                 let datalen = v.len();
15423                 let data = Box::into_raw(v.into_boxed_slice());
15424                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15425         }
15426 }
15427 #[no_mangle]
15428 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15429 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15430 impl Drop for CVec_OutPointZ {
15431         fn drop(&mut self) {
15432                 if self.datalen == 0 { return; }
15433                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15434         }
15435 }
15436 impl Clone for CVec_OutPointZ {
15437         fn clone(&self) -> Self {
15438                 let mut res = Vec::new();
15439                 if self.datalen == 0 { return Self::from(res); }
15440                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15441                 Self::from(res)
15442         }
15443 }