Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830         /// A pointer to the contents in the success state.
2831         /// Reading from this pointer when `result_ok` is not set is undefined.
2832         pub result: *mut crate::c_types::TxOut,
2833         /// A pointer to the contents in the error state.
2834         /// Reading from this pointer when `result_ok` is set is undefined.
2835         pub err: *mut crate::lightning::chain::AccessError,
2836 }
2837 #[repr(C)]
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843         /// `err` or `result` depending on the state of `result_ok`.
2844         pub contents: CResult_TxOutAccessErrorZPtr,
2845         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846         pub result_ok: bool,
2847 }
2848 #[no_mangle]
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851         CResult_TxOutAccessErrorZ {
2852                 contents: CResult_TxOutAccessErrorZPtr {
2853                         result: Box::into_raw(Box::new(o)),
2854                 },
2855                 result_ok: true,
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861         CResult_TxOutAccessErrorZ {
2862                 contents: CResult_TxOutAccessErrorZPtr {
2863                         err: Box::into_raw(Box::new(e)),
2864                 },
2865                 result_ok: false,
2866         }
2867 }
2868 /// Checks if the given object is currently in the success state
2869 #[no_mangle]
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2871         o.result_ok
2872 }
2873 #[no_mangle]
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877         fn drop(&mut self) {
2878                 if self.result_ok {
2879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2881                         }
2882                 } else {
2883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2885                         }
2886                 }
2887         }
2888 }
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891                 let contents = if o.result_ok {
2892                         let result = unsafe { o.contents.result };
2893                         unsafe { o.contents.result = core::ptr::null_mut() };
2894                         CResult_TxOutAccessErrorZPtr { result }
2895                 } else {
2896                         let err = unsafe { o.contents.err };
2897                         unsafe { o.contents.err = core::ptr::null_mut(); }
2898                         CResult_TxOutAccessErrorZPtr { err }
2899                 };
2900                 Self {
2901                         contents,
2902                         result_ok: o.result_ok,
2903                 }
2904         }
2905 }
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907         fn clone(&self) -> Self {
2908                 if self.result_ok {
2909                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2911                         } }
2912                 } else {
2913                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2915                         } }
2916                 }
2917         }
2918 }
2919 #[no_mangle]
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2923 #[repr(C)]
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926         /// The element at position 0
2927         pub a: usize,
2928         /// The element at position 1
2929         pub b: crate::c_types::Transaction,
2930 }
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2933                 Self {
2934                         a: tup.0,
2935                         b: tup.1,
2936                 }
2937         }
2938 }
2939 impl C2Tuple_usizeTransactionZ {
2940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2941                 (self.a, self.b)
2942         }
2943 }
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945         fn clone(&self) -> Self {
2946                 Self {
2947                         a: Clone::clone(&self.a),
2948                         b: Clone::clone(&self.b),
2949                 }
2950         }
2951 }
2952 #[no_mangle]
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2957 #[no_mangle]
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959         C2Tuple_usizeTransactionZ { a, b, }
2960 }
2961
2962 #[no_mangle]
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2965 #[repr(C)]
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969         /// The elements in the array.
2970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972         /// The number of elements pointed to by `data`.
2973         pub datalen: usize
2974 }
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977                 if self.datalen == 0 { return Vec::new(); }
2978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979                 self.data = core::ptr::null_mut();
2980                 self.datalen = 0;
2981                 ret
2982         }
2983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2985         }
2986 }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989                 let datalen = v.len();
2990                 let data = Box::into_raw(v.into_boxed_slice());
2991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2992         }
2993 }
2994 #[no_mangle]
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998         fn drop(&mut self) {
2999                 if self.datalen == 0 { return; }
3000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3001         }
3002 }
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004         fn clone(&self) -> Self {
3005                 let mut res = Vec::new();
3006                 if self.datalen == 0 { return Self::from(res); }
3007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3008                 Self::from(res)
3009         }
3010 }
3011 #[repr(C)]
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015         /// The elements in the array.
3016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017         pub data: *mut crate::c_types::ThirtyTwoBytes,
3018         /// The number of elements pointed to by `data`.
3019         pub datalen: usize
3020 }
3021 impl CVec_TxidZ {
3022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023                 if self.datalen == 0 { return Vec::new(); }
3024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025                 self.data = core::ptr::null_mut();
3026                 self.datalen = 0;
3027                 ret
3028         }
3029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3031         }
3032 }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035                 let datalen = v.len();
3036                 let data = Box::into_raw(v.into_boxed_slice());
3037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3038         }
3039 }
3040 #[no_mangle]
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044         fn drop(&mut self) {
3045                 if self.datalen == 0 { return; }
3046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3047         }
3048 }
3049 impl Clone for CVec_TxidZ {
3050         fn clone(&self) -> Self {
3051                 let mut res = Vec::new();
3052                 if self.datalen == 0 { return Self::from(res); }
3053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3054                 Self::from(res)
3055         }
3056 }
3057 #[repr(C)]
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060         /// Note that this value is always NULL, as there are no contents in the OK variant
3061         pub result: *mut core::ffi::c_void,
3062         /// A pointer to the contents in the error state.
3063         /// Reading from this pointer when `result_ok` is set is undefined.
3064         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3065 }
3066 #[repr(C)]
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072         /// `err` or `result` depending on the state of `result_ok`.
3073         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075         pub result_ok: bool,
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080         CResult_NoneChannelMonitorUpdateErrZ {
3081                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082                         result: core::ptr::null_mut(),
3083                 },
3084                 result_ok: true,
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090         CResult_NoneChannelMonitorUpdateErrZ {
3091                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092                         err: Box::into_raw(Box::new(e)),
3093                 },
3094                 result_ok: false,
3095         }
3096 }
3097 /// Checks if the given object is currently in the success state
3098 #[no_mangle]
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3100         o.result_ok
3101 }
3102 #[no_mangle]
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106         fn drop(&mut self) {
3107                 if self.result_ok {
3108                 } else {
3109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3111                         }
3112                 }
3113         }
3114 }
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117                 let contents = if o.result_ok {
3118                         let _ = unsafe { Box::from_raw(o.contents.result) };
3119                         o.contents.result = core::ptr::null_mut();
3120                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3121                 } else {
3122                         let err = unsafe { o.contents.err };
3123                         unsafe { o.contents.err = core::ptr::null_mut(); }
3124                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3125                 };
3126                 Self {
3127                         contents,
3128                         result_ok: o.result_ok,
3129                 }
3130         }
3131 }
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133         fn clone(&self) -> Self {
3134                 if self.result_ok {
3135                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136                                 result: core::ptr::null_mut()
3137                         } }
3138                 } else {
3139                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3141                         } }
3142                 }
3143         }
3144 }
3145 #[no_mangle]
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3149 #[repr(C)]
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153         /// The elements in the array.
3154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156         /// The number of elements pointed to by `data`.
3157         pub datalen: usize
3158 }
3159 impl CVec_MonitorEventZ {
3160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161                 if self.datalen == 0 { return Vec::new(); }
3162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163                 self.data = core::ptr::null_mut();
3164                 self.datalen = 0;
3165                 ret
3166         }
3167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3169         }
3170 }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173                 let datalen = v.len();
3174                 let data = Box::into_raw(v.into_boxed_slice());
3175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176         }
3177 }
3178 #[no_mangle]
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182         fn drop(&mut self) {
3183                 if self.datalen == 0 { return; }
3184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3185         }
3186 }
3187 impl Clone for CVec_MonitorEventZ {
3188         fn clone(&self) -> Self {
3189                 let mut res = Vec::new();
3190                 if self.datalen == 0 { return Self::from(res); }
3191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3192                 Self::from(res)
3193         }
3194 }
3195 #[repr(C)]
3196 #[derive(Clone)]
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3202         None
3203 }
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206                 if let Self::None = self { false } else { true }
3207         }
3208         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3209                 !self.is_some()
3210         }
3211         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212                 if let Self::Some(v) = self { v } else { unreachable!() }
3213         }
3214 }
3215 #[no_mangle]
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218         COption_C2Tuple_usizeTransactionZZ::Some(o)
3219 }
3220 #[no_mangle]
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223         COption_C2Tuple_usizeTransactionZZ::None
3224 }
3225 #[no_mangle]
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3228 #[no_mangle]
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3232 #[repr(C)]
3233 #[derive(Clone)]
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237         Some(crate::lightning::util::events::ClosureReason),
3238         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3239         None
3240 }
3241 impl COption_ClosureReasonZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255         COption_ClosureReasonZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260         COption_ClosureReasonZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3265 #[no_mangle]
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3269 #[repr(C)]
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272         /// A pointer to the contents in the success state.
3273         /// Reading from this pointer when `result_ok` is not set is undefined.
3274         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275         /// A pointer to the contents in the error state.
3276         /// Reading from this pointer when `result_ok` is set is undefined.
3277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3278 }
3279 #[repr(C)]
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285         /// `err` or `result` depending on the state of `result_ok`.
3286         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288         pub result_ok: bool,
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293         CResult_COption_ClosureReasonZDecodeErrorZ {
3294                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                         result: Box::into_raw(Box::new(o)),
3296                 },
3297                 result_ok: true,
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303         CResult_COption_ClosureReasonZDecodeErrorZ {
3304                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305                         err: Box::into_raw(Box::new(e)),
3306                 },
3307                 result_ok: false,
3308         }
3309 }
3310 /// Checks if the given object is currently in the success state
3311 #[no_mangle]
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3313         o.result_ok
3314 }
3315 #[no_mangle]
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319         fn drop(&mut self) {
3320                 if self.result_ok {
3321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3323                         }
3324                 } else {
3325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3327                         }
3328                 }
3329         }
3330 }
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333                 let contents = if o.result_ok {
3334                         let result = unsafe { o.contents.result };
3335                         unsafe { o.contents.result = core::ptr::null_mut() };
3336                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3337                 } else {
3338                         let err = unsafe { o.contents.err };
3339                         unsafe { o.contents.err = core::ptr::null_mut(); }
3340                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3341                 };
3342                 Self {
3343                         contents,
3344                         result_ok: o.result_ok,
3345                 }
3346         }
3347 }
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349         fn clone(&self) -> Self {
3350                 if self.result_ok {
3351                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3353                         } }
3354                 } else {
3355                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3357                         } }
3358                 }
3359         }
3360 }
3361 #[no_mangle]
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3372         None
3373 }
3374 impl COption_NetworkUpdateZ {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388         COption_NetworkUpdateZ::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393         COption_NetworkUpdateZ::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3398 #[no_mangle]
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_SpendableOutputDescriptorZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 #[derive(Clone)]
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453         Some(crate::lightning::util::events::Event),
3454         /// When we're in this state, this COption_EventZ contains nothing
3455         None
3456 }
3457 impl COption_EventZ {
3458         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459                 if let Self::None = self { false } else { true }
3460         }
3461         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3462                 !self.is_some()
3463         }
3464         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465                 if let Self::Some(v) = self { v } else { unreachable!() }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471         COption_EventZ::Some(o)
3472 }
3473 #[no_mangle]
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476         COption_EventZ::None
3477 }
3478 #[no_mangle]
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3481 #[no_mangle]
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3485 #[repr(C)]
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488         /// A pointer to the contents in the success state.
3489         /// Reading from this pointer when `result_ok` is not set is undefined.
3490         pub result: *mut crate::c_types::derived::COption_EventZ,
3491         /// A pointer to the contents in the error state.
3492         /// Reading from this pointer when `result_ok` is set is undefined.
3493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3494 }
3495 #[repr(C)]
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501         /// `err` or `result` depending on the state of `result_ok`.
3502         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504         pub result_ok: bool,
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509         CResult_COption_EventZDecodeErrorZ {
3510                 contents: CResult_COption_EventZDecodeErrorZPtr {
3511                         result: Box::into_raw(Box::new(o)),
3512                 },
3513                 result_ok: true,
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519         CResult_COption_EventZDecodeErrorZ {
3520                 contents: CResult_COption_EventZDecodeErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 /// Checks if the given object is currently in the success state
3527 #[no_mangle]
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3529         o.result_ok
3530 }
3531 #[no_mangle]
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535         fn drop(&mut self) {
3536                 if self.result_ok {
3537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3539                         }
3540                 } else {
3541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3543                         }
3544                 }
3545         }
3546 }
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549                 let contents = if o.result_ok {
3550                         let result = unsafe { o.contents.result };
3551                         unsafe { o.contents.result = core::ptr::null_mut() };
3552                         CResult_COption_EventZDecodeErrorZPtr { result }
3553                 } else {
3554                         let err = unsafe { o.contents.err };
3555                         unsafe { o.contents.err = core::ptr::null_mut(); }
3556                         CResult_COption_EventZDecodeErrorZPtr { err }
3557                 };
3558                 Self {
3559                         contents,
3560                         result_ok: o.result_ok,
3561                 }
3562         }
3563 }
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565         fn clone(&self) -> Self {
3566                 if self.result_ok {
3567                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3569                         } }
3570                 } else {
3571                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3573                         } }
3574                 }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3581 #[repr(C)]
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585         /// The elements in the array.
3586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588         /// The number of elements pointed to by `data`.
3589         pub datalen: usize
3590 }
3591 impl CVec_MessageSendEventZ {
3592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593                 if self.datalen == 0 { return Vec::new(); }
3594                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595                 self.data = core::ptr::null_mut();
3596                 self.datalen = 0;
3597                 ret
3598         }
3599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3601         }
3602 }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605                 let datalen = v.len();
3606                 let data = Box::into_raw(v.into_boxed_slice());
3607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614         fn drop(&mut self) {
3615                 if self.datalen == 0 { return; }
3616                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3617         }
3618 }
3619 impl Clone for CVec_MessageSendEventZ {
3620         fn clone(&self) -> Self {
3621                 let mut res = Vec::new();
3622                 if self.datalen == 0 { return Self::from(res); }
3623                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3624                 Self::from(res)
3625         }
3626 }
3627 #[repr(C)]
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630         /// A pointer to the contents in the success state.
3631         /// Reading from this pointer when `result_ok` is not set is undefined.
3632         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633         /// A pointer to the contents in the error state.
3634         /// Reading from this pointer when `result_ok` is set is undefined.
3635         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3636 }
3637 #[repr(C)]
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643         /// `err` or `result` depending on the state of `result_ok`.
3644         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646         pub result_ok: bool,
3647 }
3648 #[no_mangle]
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651         CResult_FixedPenaltyScorerDecodeErrorZ {
3652                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653                         result: Box::into_raw(Box::new(o)),
3654                 },
3655                 result_ok: true,
3656         }
3657 }
3658 #[no_mangle]
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661         CResult_FixedPenaltyScorerDecodeErrorZ {
3662                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663                         err: Box::into_raw(Box::new(e)),
3664                 },
3665                 result_ok: false,
3666         }
3667 }
3668 /// Checks if the given object is currently in the success state
3669 #[no_mangle]
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3671         o.result_ok
3672 }
3673 #[no_mangle]
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3681                         }
3682                 } else {
3683                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3685                         }
3686                 }
3687         }
3688 }
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691                 let contents = if o.result_ok {
3692                         let result = unsafe { o.contents.result };
3693                         unsafe { o.contents.result = core::ptr::null_mut() };
3694                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3695                 } else {
3696                         let err = unsafe { o.contents.err };
3697                         unsafe { o.contents.err = core::ptr::null_mut(); }
3698                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3699                 };
3700                 Self {
3701                         contents,
3702                         result_ok: o.result_ok,
3703                 }
3704         }
3705 }
3706 #[repr(C)]
3707 /// The contents of CResult_ScoringParametersDecodeErrorZ
3708 pub union CResult_ScoringParametersDecodeErrorZPtr {
3709         /// A pointer to the contents in the success state.
3710         /// Reading from this pointer when `result_ok` is not set is undefined.
3711         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3712         /// A pointer to the contents in the error state.
3713         /// Reading from this pointer when `result_ok` is set is undefined.
3714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3715 }
3716 #[repr(C)]
3717 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3718 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3720 pub struct CResult_ScoringParametersDecodeErrorZ {
3721         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3722         /// `err` or `result` depending on the state of `result_ok`.
3723         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3724         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3725         pub result_ok: bool,
3726 }
3727 #[no_mangle]
3728 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3729 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3730         CResult_ScoringParametersDecodeErrorZ {
3731                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3732                         result: Box::into_raw(Box::new(o)),
3733                 },
3734                 result_ok: true,
3735         }
3736 }
3737 #[no_mangle]
3738 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3739 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3740         CResult_ScoringParametersDecodeErrorZ {
3741                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3742                         err: Box::into_raw(Box::new(e)),
3743                 },
3744                 result_ok: false,
3745         }
3746 }
3747 /// Checks if the given object is currently in the success state
3748 #[no_mangle]
3749 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3750         o.result_ok
3751 }
3752 #[no_mangle]
3753 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3754 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3755 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3756         fn drop(&mut self) {
3757                 if self.result_ok {
3758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3760                         }
3761                 } else {
3762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3764                         }
3765                 }
3766         }
3767 }
3768 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3770                 let contents = if o.result_ok {
3771                         let result = unsafe { o.contents.result };
3772                         unsafe { o.contents.result = core::ptr::null_mut() };
3773                         CResult_ScoringParametersDecodeErrorZPtr { result }
3774                 } else {
3775                         let err = unsafe { o.contents.err };
3776                         unsafe { o.contents.err = core::ptr::null_mut(); }
3777                         CResult_ScoringParametersDecodeErrorZPtr { err }
3778                 };
3779                 Self {
3780                         contents,
3781                         result_ok: o.result_ok,
3782                 }
3783         }
3784 }
3785 #[repr(C)]
3786 /// The contents of CResult_ScorerDecodeErrorZ
3787 pub union CResult_ScorerDecodeErrorZPtr {
3788         /// A pointer to the contents in the success state.
3789         /// Reading from this pointer when `result_ok` is not set is undefined.
3790         pub result: *mut crate::lightning::routing::scoring::Scorer,
3791         /// A pointer to the contents in the error state.
3792         /// Reading from this pointer when `result_ok` is set is undefined.
3793         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3794 }
3795 #[repr(C)]
3796 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3797 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3798 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3799 pub struct CResult_ScorerDecodeErrorZ {
3800         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3801         /// `err` or `result` depending on the state of `result_ok`.
3802         pub contents: CResult_ScorerDecodeErrorZPtr,
3803         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3804         pub result_ok: bool,
3805 }
3806 #[no_mangle]
3807 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3808 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3809         CResult_ScorerDecodeErrorZ {
3810                 contents: CResult_ScorerDecodeErrorZPtr {
3811                         result: Box::into_raw(Box::new(o)),
3812                 },
3813                 result_ok: true,
3814         }
3815 }
3816 #[no_mangle]
3817 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3818 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3819         CResult_ScorerDecodeErrorZ {
3820                 contents: CResult_ScorerDecodeErrorZPtr {
3821                         err: Box::into_raw(Box::new(e)),
3822                 },
3823                 result_ok: false,
3824         }
3825 }
3826 /// Checks if the given object is currently in the success state
3827 #[no_mangle]
3828 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3829         o.result_ok
3830 }
3831 #[no_mangle]
3832 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3833 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3834 impl Drop for CResult_ScorerDecodeErrorZ {
3835         fn drop(&mut self) {
3836                 if self.result_ok {
3837                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3838                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3839                         }
3840                 } else {
3841                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3842                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3843                         }
3844                 }
3845         }
3846 }
3847 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3848         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3849                 let contents = if o.result_ok {
3850                         let result = unsafe { o.contents.result };
3851                         unsafe { o.contents.result = core::ptr::null_mut() };
3852                         CResult_ScorerDecodeErrorZPtr { result }
3853                 } else {
3854                         let err = unsafe { o.contents.err };
3855                         unsafe { o.contents.err = core::ptr::null_mut(); }
3856                         CResult_ScorerDecodeErrorZPtr { err }
3857                 };
3858                 Self {
3859                         contents,
3860                         result_ok: o.result_ok,
3861                 }
3862         }
3863 }
3864 #[repr(C)]
3865 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3866 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3867         /// A pointer to the contents in the success state.
3868         /// Reading from this pointer when `result_ok` is not set is undefined.
3869         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3870         /// A pointer to the contents in the error state.
3871         /// Reading from this pointer when `result_ok` is set is undefined.
3872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3873 }
3874 #[repr(C)]
3875 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3876 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3878 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3879         /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3880         /// `err` or `result` depending on the state of `result_ok`.
3881         pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3882         /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3883         pub result_ok: bool,
3884 }
3885 #[no_mangle]
3886 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3887 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3888         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3889                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3890                         result: Box::into_raw(Box::new(o)),
3891                 },
3892                 result_ok: true,
3893         }
3894 }
3895 #[no_mangle]
3896 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3897 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3898         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3899                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3900                         err: Box::into_raw(Box::new(e)),
3901                 },
3902                 result_ok: false,
3903         }
3904 }
3905 /// Checks if the given object is currently in the success state
3906 #[no_mangle]
3907 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3908         o.result_ok
3909 }
3910 #[no_mangle]
3911 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3912 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3913 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3914         fn drop(&mut self) {
3915                 if self.result_ok {
3916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3918                         }
3919                 } else {
3920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3922                         }
3923                 }
3924         }
3925 }
3926 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3928                 let contents = if o.result_ok {
3929                         let result = unsafe { o.contents.result };
3930                         unsafe { o.contents.result = core::ptr::null_mut() };
3931                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3932                 } else {
3933                         let err = unsafe { o.contents.err };
3934                         unsafe { o.contents.err = core::ptr::null_mut(); }
3935                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3936                 };
3937                 Self {
3938                         contents,
3939                         result_ok: o.result_ok,
3940                 }
3941         }
3942 }
3943 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3944         fn clone(&self) -> Self {
3945                 if self.result_ok {
3946                         Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3947                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3948                         } }
3949                 } else {
3950                         Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3952                         } }
3953                 }
3954         }
3955 }
3956 #[no_mangle]
3957 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3958 /// but with all dynamically-allocated buffers duplicated in new buffers.
3959 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3960 #[repr(C)]
3961 /// A tuple of 2 elements. See the individual fields for the types contained.
3962 pub struct C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3963         /// The element at position 0
3964         pub a: crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3965         /// The element at position 1
3966         pub b: crate::lightning::routing::network_graph::NetworkGraph,
3967 }
3968 impl From<(crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph)> for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3969         fn from (tup: (crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph)) -> Self {
3970                 Self {
3971                         a: tup.0,
3972                         b: tup.1,
3973                 }
3974         }
3975 }
3976 impl C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3977         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::routing::network_graph::NetworkGraph) {
3978                 (self.a, self.b)
3979         }
3980 }
3981 impl Clone for C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3982         fn clone(&self) -> Self {
3983                 Self {
3984                         a: Clone::clone(&self.a),
3985                         b: crate::lightning::routing::network_graph::NetworkGraph { inner: self.b.inner, is_owned: false},              }
3986         }
3987 }
3988 #[no_mangle]
3989 /// Creates a new tuple which has the same data as `orig`
3990 /// but with all dynamically-allocated buffers duplicated in new buffers.
3991 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig: &C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { Clone::clone(&orig) }
3992 /// Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements.
3993 #[no_mangle]
3994 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a: crate::lightning::routing::scoring::ProbabilisticScoringParameters, b: &'static crate::lightning::routing::network_graph::NetworkGraph) -> C2Tuple_ProbabilisticScoringParametersNetworkGraphZ {
3995         C2Tuple_ProbabilisticScoringParametersNetworkGraphZ { a, b: crate::lightning::routing::network_graph::NetworkGraph { inner: b.inner, is_owned: false}, }
3996 }
3997
3998 #[no_mangle]
3999 /// Frees any resources used by the C2Tuple_ProbabilisticScoringParametersNetworkGraphZ.
4000 pub extern "C" fn C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ) { }
4001 #[repr(C)]
4002 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
4003 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
4004         /// A pointer to the contents in the success state.
4005         /// Reading from this pointer when `result_ok` is not set is undefined.
4006         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
4007         /// A pointer to the contents in the error state.
4008         /// Reading from this pointer when `result_ok` is set is undefined.
4009         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4010 }
4011 #[repr(C)]
4012 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4013 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4015 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
4016         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4017         /// `err` or `result` depending on the state of `result_ok`.
4018         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
4019         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4020         pub result_ok: bool,
4021 }
4022 #[no_mangle]
4023 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
4024 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
4025         CResult_ProbabilisticScorerDecodeErrorZ {
4026                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4027                         result: Box::into_raw(Box::new(o)),
4028                 },
4029                 result_ok: true,
4030         }
4031 }
4032 #[no_mangle]
4033 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
4034 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
4035         CResult_ProbabilisticScorerDecodeErrorZ {
4036                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
4037                         err: Box::into_raw(Box::new(e)),
4038                 },
4039                 result_ok: false,
4040         }
4041 }
4042 /// Checks if the given object is currently in the success state
4043 #[no_mangle]
4044 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
4045         o.result_ok
4046 }
4047 #[no_mangle]
4048 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
4049 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
4050 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
4051         fn drop(&mut self) {
4052                 if self.result_ok {
4053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4055                         }
4056                 } else {
4057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4059                         }
4060                 }
4061         }
4062 }
4063 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
4064         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
4065                 let contents = if o.result_ok {
4066                         let result = unsafe { o.contents.result };
4067                         unsafe { o.contents.result = core::ptr::null_mut() };
4068                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
4069                 } else {
4070                         let err = unsafe { o.contents.err };
4071                         unsafe { o.contents.err = core::ptr::null_mut(); }
4072                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
4073                 };
4074                 Self {
4075                         contents,
4076                         result_ok: o.result_ok,
4077                 }
4078         }
4079 }
4080 #[repr(C)]
4081 /// The contents of CResult_InitFeaturesDecodeErrorZ
4082 pub union CResult_InitFeaturesDecodeErrorZPtr {
4083         /// A pointer to the contents in the success state.
4084         /// Reading from this pointer when `result_ok` is not set is undefined.
4085         pub result: *mut crate::lightning::ln::features::InitFeatures,
4086         /// A pointer to the contents in the error state.
4087         /// Reading from this pointer when `result_ok` is set is undefined.
4088         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4089 }
4090 #[repr(C)]
4091 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4092 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4094 pub struct CResult_InitFeaturesDecodeErrorZ {
4095         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4096         /// `err` or `result` depending on the state of `result_ok`.
4097         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
4098         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4099         pub result_ok: bool,
4100 }
4101 #[no_mangle]
4102 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4103 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4104         CResult_InitFeaturesDecodeErrorZ {
4105                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4106                         result: Box::into_raw(Box::new(o)),
4107                 },
4108                 result_ok: true,
4109         }
4110 }
4111 #[no_mangle]
4112 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4113 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4114         CResult_InitFeaturesDecodeErrorZ {
4115                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4116                         err: Box::into_raw(Box::new(e)),
4117                 },
4118                 result_ok: false,
4119         }
4120 }
4121 /// Checks if the given object is currently in the success state
4122 #[no_mangle]
4123 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4124         o.result_ok
4125 }
4126 #[no_mangle]
4127 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4128 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4129 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4130         fn drop(&mut self) {
4131                 if self.result_ok {
4132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4134                         }
4135                 } else {
4136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4138                         }
4139                 }
4140         }
4141 }
4142 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4143         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4144                 let contents = if o.result_ok {
4145                         let result = unsafe { o.contents.result };
4146                         unsafe { o.contents.result = core::ptr::null_mut() };
4147                         CResult_InitFeaturesDecodeErrorZPtr { result }
4148                 } else {
4149                         let err = unsafe { o.contents.err };
4150                         unsafe { o.contents.err = core::ptr::null_mut(); }
4151                         CResult_InitFeaturesDecodeErrorZPtr { err }
4152                 };
4153                 Self {
4154                         contents,
4155                         result_ok: o.result_ok,
4156                 }
4157         }
4158 }
4159 #[repr(C)]
4160 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4161 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4162         /// A pointer to the contents in the success state.
4163         /// Reading from this pointer when `result_ok` is not set is undefined.
4164         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4165         /// A pointer to the contents in the error state.
4166         /// Reading from this pointer when `result_ok` is set is undefined.
4167         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4168 }
4169 #[repr(C)]
4170 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4171 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4172 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4173 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4174         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4175         /// `err` or `result` depending on the state of `result_ok`.
4176         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4177         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4178         pub result_ok: bool,
4179 }
4180 #[no_mangle]
4181 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4182 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4183         CResult_ChannelFeaturesDecodeErrorZ {
4184                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4185                         result: Box::into_raw(Box::new(o)),
4186                 },
4187                 result_ok: true,
4188         }
4189 }
4190 #[no_mangle]
4191 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4192 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4193         CResult_ChannelFeaturesDecodeErrorZ {
4194                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4195                         err: Box::into_raw(Box::new(e)),
4196                 },
4197                 result_ok: false,
4198         }
4199 }
4200 /// Checks if the given object is currently in the success state
4201 #[no_mangle]
4202 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4203         o.result_ok
4204 }
4205 #[no_mangle]
4206 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4207 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4208 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4209         fn drop(&mut self) {
4210                 if self.result_ok {
4211                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4212                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4213                         }
4214                 } else {
4215                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4216                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4217                         }
4218                 }
4219         }
4220 }
4221 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4222         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4223                 let contents = if o.result_ok {
4224                         let result = unsafe { o.contents.result };
4225                         unsafe { o.contents.result = core::ptr::null_mut() };
4226                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4227                 } else {
4228                         let err = unsafe { o.contents.err };
4229                         unsafe { o.contents.err = core::ptr::null_mut(); }
4230                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4231                 };
4232                 Self {
4233                         contents,
4234                         result_ok: o.result_ok,
4235                 }
4236         }
4237 }
4238 #[repr(C)]
4239 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4240 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4241         /// A pointer to the contents in the success state.
4242         /// Reading from this pointer when `result_ok` is not set is undefined.
4243         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4244         /// A pointer to the contents in the error state.
4245         /// Reading from this pointer when `result_ok` is set is undefined.
4246         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4247 }
4248 #[repr(C)]
4249 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4250 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4251 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4252 pub struct CResult_NodeFeaturesDecodeErrorZ {
4253         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4254         /// `err` or `result` depending on the state of `result_ok`.
4255         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4256         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4257         pub result_ok: bool,
4258 }
4259 #[no_mangle]
4260 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4261 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4262         CResult_NodeFeaturesDecodeErrorZ {
4263                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4264                         result: Box::into_raw(Box::new(o)),
4265                 },
4266                 result_ok: true,
4267         }
4268 }
4269 #[no_mangle]
4270 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4271 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4272         CResult_NodeFeaturesDecodeErrorZ {
4273                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4274                         err: Box::into_raw(Box::new(e)),
4275                 },
4276                 result_ok: false,
4277         }
4278 }
4279 /// Checks if the given object is currently in the success state
4280 #[no_mangle]
4281 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4282         o.result_ok
4283 }
4284 #[no_mangle]
4285 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4286 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4287 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4288         fn drop(&mut self) {
4289                 if self.result_ok {
4290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4292                         }
4293                 } else {
4294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4296                         }
4297                 }
4298         }
4299 }
4300 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4301         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4302                 let contents = if o.result_ok {
4303                         let result = unsafe { o.contents.result };
4304                         unsafe { o.contents.result = core::ptr::null_mut() };
4305                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4306                 } else {
4307                         let err = unsafe { o.contents.err };
4308                         unsafe { o.contents.err = core::ptr::null_mut(); }
4309                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4310                 };
4311                 Self {
4312                         contents,
4313                         result_ok: o.result_ok,
4314                 }
4315         }
4316 }
4317 #[repr(C)]
4318 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4319 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4320         /// A pointer to the contents in the success state.
4321         /// Reading from this pointer when `result_ok` is not set is undefined.
4322         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4323         /// A pointer to the contents in the error state.
4324         /// Reading from this pointer when `result_ok` is set is undefined.
4325         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4326 }
4327 #[repr(C)]
4328 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4329 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4330 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4331 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4332         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4333         /// `err` or `result` depending on the state of `result_ok`.
4334         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4335         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4336         pub result_ok: bool,
4337 }
4338 #[no_mangle]
4339 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4340 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4341         CResult_InvoiceFeaturesDecodeErrorZ {
4342                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4343                         result: Box::into_raw(Box::new(o)),
4344                 },
4345                 result_ok: true,
4346         }
4347 }
4348 #[no_mangle]
4349 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4350 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4351         CResult_InvoiceFeaturesDecodeErrorZ {
4352                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4353                         err: Box::into_raw(Box::new(e)),
4354                 },
4355                 result_ok: false,
4356         }
4357 }
4358 /// Checks if the given object is currently in the success state
4359 #[no_mangle]
4360 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4361         o.result_ok
4362 }
4363 #[no_mangle]
4364 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4365 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4366 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4367         fn drop(&mut self) {
4368                 if self.result_ok {
4369                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4370                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4371                         }
4372                 } else {
4373                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4374                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4375                         }
4376                 }
4377         }
4378 }
4379 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4380         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4381                 let contents = if o.result_ok {
4382                         let result = unsafe { o.contents.result };
4383                         unsafe { o.contents.result = core::ptr::null_mut() };
4384                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4385                 } else {
4386                         let err = unsafe { o.contents.err };
4387                         unsafe { o.contents.err = core::ptr::null_mut(); }
4388                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4389                 };
4390                 Self {
4391                         contents,
4392                         result_ok: o.result_ok,
4393                 }
4394         }
4395 }
4396 #[repr(C)]
4397 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4398 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4399         /// A pointer to the contents in the success state.
4400         /// Reading from this pointer when `result_ok` is not set is undefined.
4401         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4402         /// A pointer to the contents in the error state.
4403         /// Reading from this pointer when `result_ok` is set is undefined.
4404         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4405 }
4406 #[repr(C)]
4407 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4408 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4409 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4410 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4411         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4412         /// `err` or `result` depending on the state of `result_ok`.
4413         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4414         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4415         pub result_ok: bool,
4416 }
4417 #[no_mangle]
4418 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4419 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4420         CResult_ChannelTypeFeaturesDecodeErrorZ {
4421                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4422                         result: Box::into_raw(Box::new(o)),
4423                 },
4424                 result_ok: true,
4425         }
4426 }
4427 #[no_mangle]
4428 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4429 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4430         CResult_ChannelTypeFeaturesDecodeErrorZ {
4431                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4432                         err: Box::into_raw(Box::new(e)),
4433                 },
4434                 result_ok: false,
4435         }
4436 }
4437 /// Checks if the given object is currently in the success state
4438 #[no_mangle]
4439 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4440         o.result_ok
4441 }
4442 #[no_mangle]
4443 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4444 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4445 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4446         fn drop(&mut self) {
4447                 if self.result_ok {
4448                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4449                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4450                         }
4451                 } else {
4452                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4453                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4454                         }
4455                 }
4456         }
4457 }
4458 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4459         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4460                 let contents = if o.result_ok {
4461                         let result = unsafe { o.contents.result };
4462                         unsafe { o.contents.result = core::ptr::null_mut() };
4463                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4464                 } else {
4465                         let err = unsafe { o.contents.err };
4466                         unsafe { o.contents.err = core::ptr::null_mut(); }
4467                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4468                 };
4469                 Self {
4470                         contents,
4471                         result_ok: o.result_ok,
4472                 }
4473         }
4474 }
4475 #[repr(C)]
4476 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4477 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4478         /// A pointer to the contents in the success state.
4479         /// Reading from this pointer when `result_ok` is not set is undefined.
4480         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4481         /// A pointer to the contents in the error state.
4482         /// Reading from this pointer when `result_ok` is set is undefined.
4483         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4484 }
4485 #[repr(C)]
4486 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4487 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4488 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4489 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4490         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4491         /// `err` or `result` depending on the state of `result_ok`.
4492         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4493         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4494         pub result_ok: bool,
4495 }
4496 #[no_mangle]
4497 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4498 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4499         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4500                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4501                         result: Box::into_raw(Box::new(o)),
4502                 },
4503                 result_ok: true,
4504         }
4505 }
4506 #[no_mangle]
4507 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4508 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4509         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4510                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4511                         err: Box::into_raw(Box::new(e)),
4512                 },
4513                 result_ok: false,
4514         }
4515 }
4516 /// Checks if the given object is currently in the success state
4517 #[no_mangle]
4518 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4519         o.result_ok
4520 }
4521 #[no_mangle]
4522 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4523 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4524 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4525         fn drop(&mut self) {
4526                 if self.result_ok {
4527                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4528                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4529                         }
4530                 } else {
4531                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4532                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4533                         }
4534                 }
4535         }
4536 }
4537 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4538         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4539                 let contents = if o.result_ok {
4540                         let result = unsafe { o.contents.result };
4541                         unsafe { o.contents.result = core::ptr::null_mut() };
4542                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4543                 } else {
4544                         let err = unsafe { o.contents.err };
4545                         unsafe { o.contents.err = core::ptr::null_mut(); }
4546                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4547                 };
4548                 Self {
4549                         contents,
4550                         result_ok: o.result_ok,
4551                 }
4552         }
4553 }
4554 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4555         fn clone(&self) -> Self {
4556                 if self.result_ok {
4557                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4558                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4559                         } }
4560                 } else {
4561                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4562                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4563                         } }
4564                 }
4565         }
4566 }
4567 #[no_mangle]
4568 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4569 /// but with all dynamically-allocated buffers duplicated in new buffers.
4570 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4571 #[repr(C)]
4572 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4573 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4574         /// A pointer to the contents in the success state.
4575         /// Reading from this pointer when `result_ok` is not set is undefined.
4576         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4577         /// A pointer to the contents in the error state.
4578         /// Reading from this pointer when `result_ok` is set is undefined.
4579         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4580 }
4581 #[repr(C)]
4582 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4583 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4585 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4586         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4587         /// `err` or `result` depending on the state of `result_ok`.
4588         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4589         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4590         pub result_ok: bool,
4591 }
4592 #[no_mangle]
4593 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4594 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4595         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4596                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4597                         result: Box::into_raw(Box::new(o)),
4598                 },
4599                 result_ok: true,
4600         }
4601 }
4602 #[no_mangle]
4603 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4604 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4605         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4606                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4607                         err: Box::into_raw(Box::new(e)),
4608                 },
4609                 result_ok: false,
4610         }
4611 }
4612 /// Checks if the given object is currently in the success state
4613 #[no_mangle]
4614 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4615         o.result_ok
4616 }
4617 #[no_mangle]
4618 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4619 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4620 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4621         fn drop(&mut self) {
4622                 if self.result_ok {
4623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4625                         }
4626                 } else {
4627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4629                         }
4630                 }
4631         }
4632 }
4633 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4634         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4635                 let contents = if o.result_ok {
4636                         let result = unsafe { o.contents.result };
4637                         unsafe { o.contents.result = core::ptr::null_mut() };
4638                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4639                 } else {
4640                         let err = unsafe { o.contents.err };
4641                         unsafe { o.contents.err = core::ptr::null_mut(); }
4642                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4643                 };
4644                 Self {
4645                         contents,
4646                         result_ok: o.result_ok,
4647                 }
4648         }
4649 }
4650 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4651         fn clone(&self) -> Self {
4652                 if self.result_ok {
4653                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4654                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4655                         } }
4656                 } else {
4657                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4658                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4659                         } }
4660                 }
4661         }
4662 }
4663 #[no_mangle]
4664 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4665 /// but with all dynamically-allocated buffers duplicated in new buffers.
4666 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4667 #[repr(C)]
4668 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4669 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4670         /// A pointer to the contents in the success state.
4671         /// Reading from this pointer when `result_ok` is not set is undefined.
4672         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4673         /// A pointer to the contents in the error state.
4674         /// Reading from this pointer when `result_ok` is set is undefined.
4675         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4676 }
4677 #[repr(C)]
4678 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4679 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4680 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4681 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4682         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4683         /// `err` or `result` depending on the state of `result_ok`.
4684         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4685         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4686         pub result_ok: bool,
4687 }
4688 #[no_mangle]
4689 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4690 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4691         CResult_SpendableOutputDescriptorDecodeErrorZ {
4692                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4693                         result: Box::into_raw(Box::new(o)),
4694                 },
4695                 result_ok: true,
4696         }
4697 }
4698 #[no_mangle]
4699 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4700 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4701         CResult_SpendableOutputDescriptorDecodeErrorZ {
4702                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4703                         err: Box::into_raw(Box::new(e)),
4704                 },
4705                 result_ok: false,
4706         }
4707 }
4708 /// Checks if the given object is currently in the success state
4709 #[no_mangle]
4710 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4711         o.result_ok
4712 }
4713 #[no_mangle]
4714 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4715 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4716 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4717         fn drop(&mut self) {
4718                 if self.result_ok {
4719                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4720                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4721                         }
4722                 } else {
4723                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4724                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4725                         }
4726                 }
4727         }
4728 }
4729 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4730         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4731                 let contents = if o.result_ok {
4732                         let result = unsafe { o.contents.result };
4733                         unsafe { o.contents.result = core::ptr::null_mut() };
4734                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4735                 } else {
4736                         let err = unsafe { o.contents.err };
4737                         unsafe { o.contents.err = core::ptr::null_mut(); }
4738                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4739                 };
4740                 Self {
4741                         contents,
4742                         result_ok: o.result_ok,
4743                 }
4744         }
4745 }
4746 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4747         fn clone(&self) -> Self {
4748                 if self.result_ok {
4749                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4750                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4751                         } }
4752                 } else {
4753                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4754                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4755                         } }
4756                 }
4757         }
4758 }
4759 #[no_mangle]
4760 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4761 /// but with all dynamically-allocated buffers duplicated in new buffers.
4762 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4763 #[repr(C)]
4764 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4765 /// This corresponds to std::vector in C++
4766 pub struct CVec_PaymentPreimageZ {
4767         /// The elements in the array.
4768         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4769         pub data: *mut crate::c_types::ThirtyTwoBytes,
4770         /// The number of elements pointed to by `data`.
4771         pub datalen: usize
4772 }
4773 impl CVec_PaymentPreimageZ {
4774         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4775                 if self.datalen == 0 { return Vec::new(); }
4776                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4777                 self.data = core::ptr::null_mut();
4778                 self.datalen = 0;
4779                 ret
4780         }
4781         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4782                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4783         }
4784 }
4785 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4786         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4787                 let datalen = v.len();
4788                 let data = Box::into_raw(v.into_boxed_slice());
4789                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4790         }
4791 }
4792 #[no_mangle]
4793 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4794 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4795 impl Drop for CVec_PaymentPreimageZ {
4796         fn drop(&mut self) {
4797                 if self.datalen == 0 { return; }
4798                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4799         }
4800 }
4801 impl Clone for CVec_PaymentPreimageZ {
4802         fn clone(&self) -> Self {
4803                 let mut res = Vec::new();
4804                 if self.datalen == 0 { return Self::from(res); }
4805                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4806                 Self::from(res)
4807         }
4808 }
4809 #[repr(C)]
4810 /// A tuple of 2 elements. See the individual fields for the types contained.
4811 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4812         /// The element at position 0
4813         pub a: crate::c_types::Signature,
4814         /// The element at position 1
4815         pub b: crate::c_types::derived::CVec_SignatureZ,
4816 }
4817 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4818         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4819                 Self {
4820                         a: tup.0,
4821                         b: tup.1,
4822                 }
4823         }
4824 }
4825 impl C2Tuple_SignatureCVec_SignatureZZ {
4826         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4827                 (self.a, self.b)
4828         }
4829 }
4830 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4831         fn clone(&self) -> Self {
4832                 Self {
4833                         a: Clone::clone(&self.a),
4834                         b: Clone::clone(&self.b),
4835                 }
4836         }
4837 }
4838 #[no_mangle]
4839 /// Creates a new tuple which has the same data as `orig`
4840 /// but with all dynamically-allocated buffers duplicated in new buffers.
4841 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4842 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4843 #[no_mangle]
4844 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4845         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4846 }
4847
4848 #[no_mangle]
4849 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4850 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4851 #[repr(C)]
4852 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4853 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4854         /// A pointer to the contents in the success state.
4855         /// Reading from this pointer when `result_ok` is not set is undefined.
4856         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4857         /// Note that this value is always NULL, as there are no contents in the Err variant
4858         pub err: *mut core::ffi::c_void,
4859 }
4860 #[repr(C)]
4861 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4862 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4863 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4864 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4865         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4866         /// `err` or `result` depending on the state of `result_ok`.
4867         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4868         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4869         pub result_ok: bool,
4870 }
4871 #[no_mangle]
4872 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4873 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4874         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4875                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4876                         result: Box::into_raw(Box::new(o)),
4877                 },
4878                 result_ok: true,
4879         }
4880 }
4881 #[no_mangle]
4882 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4883 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4884         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4885                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4886                         err: core::ptr::null_mut(),
4887                 },
4888                 result_ok: false,
4889         }
4890 }
4891 /// Checks if the given object is currently in the success state
4892 #[no_mangle]
4893 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4894         o.result_ok
4895 }
4896 #[no_mangle]
4897 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4898 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4899 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4900         fn drop(&mut self) {
4901                 if self.result_ok {
4902                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4903                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4904                         }
4905                 } else {
4906                 }
4907         }
4908 }
4909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4911                 let contents = if o.result_ok {
4912                         let result = unsafe { o.contents.result };
4913                         unsafe { o.contents.result = core::ptr::null_mut() };
4914                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4915                 } else {
4916                         let _ = unsafe { Box::from_raw(o.contents.err) };
4917                         o.contents.err = core::ptr::null_mut();
4918                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4919                 };
4920                 Self {
4921                         contents,
4922                         result_ok: o.result_ok,
4923                 }
4924         }
4925 }
4926 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4927         fn clone(&self) -> Self {
4928                 if self.result_ok {
4929                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4930                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4931                         } }
4932                 } else {
4933                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4934                                 err: core::ptr::null_mut()
4935                         } }
4936                 }
4937         }
4938 }
4939 #[no_mangle]
4940 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4941 /// but with all dynamically-allocated buffers duplicated in new buffers.
4942 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4943 #[repr(C)]
4944 /// The contents of CResult_SignatureNoneZ
4945 pub union CResult_SignatureNoneZPtr {
4946         /// A pointer to the contents in the success state.
4947         /// Reading from this pointer when `result_ok` is not set is undefined.
4948         pub result: *mut crate::c_types::Signature,
4949         /// Note that this value is always NULL, as there are no contents in the Err variant
4950         pub err: *mut core::ffi::c_void,
4951 }
4952 #[repr(C)]
4953 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4954 /// containing a crate::c_types::Signature on success and a () on failure.
4955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4956 pub struct CResult_SignatureNoneZ {
4957         /// The contents of this CResult_SignatureNoneZ, accessible via either
4958         /// `err` or `result` depending on the state of `result_ok`.
4959         pub contents: CResult_SignatureNoneZPtr,
4960         /// Whether this CResult_SignatureNoneZ represents a success state.
4961         pub result_ok: bool,
4962 }
4963 #[no_mangle]
4964 /// Creates a new CResult_SignatureNoneZ in the success state.
4965 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4966         CResult_SignatureNoneZ {
4967                 contents: CResult_SignatureNoneZPtr {
4968                         result: Box::into_raw(Box::new(o)),
4969                 },
4970                 result_ok: true,
4971         }
4972 }
4973 #[no_mangle]
4974 /// Creates a new CResult_SignatureNoneZ in the error state.
4975 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4976         CResult_SignatureNoneZ {
4977                 contents: CResult_SignatureNoneZPtr {
4978                         err: core::ptr::null_mut(),
4979                 },
4980                 result_ok: false,
4981         }
4982 }
4983 /// Checks if the given object is currently in the success state
4984 #[no_mangle]
4985 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4986         o.result_ok
4987 }
4988 #[no_mangle]
4989 /// Frees any resources used by the CResult_SignatureNoneZ.
4990 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4991 impl Drop for CResult_SignatureNoneZ {
4992         fn drop(&mut self) {
4993                 if self.result_ok {
4994                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4995                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4996                         }
4997                 } else {
4998                 }
4999         }
5000 }
5001 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
5002         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
5003                 let contents = if o.result_ok {
5004                         let result = unsafe { o.contents.result };
5005                         unsafe { o.contents.result = core::ptr::null_mut() };
5006                         CResult_SignatureNoneZPtr { result }
5007                 } else {
5008                         let _ = unsafe { Box::from_raw(o.contents.err) };
5009                         o.contents.err = core::ptr::null_mut();
5010                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
5011                 };
5012                 Self {
5013                         contents,
5014                         result_ok: o.result_ok,
5015                 }
5016         }
5017 }
5018 impl Clone for CResult_SignatureNoneZ {
5019         fn clone(&self) -> Self {
5020                 if self.result_ok {
5021                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
5022                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
5023                         } }
5024                 } else {
5025                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
5026                                 err: core::ptr::null_mut()
5027                         } }
5028                 }
5029         }
5030 }
5031 #[no_mangle]
5032 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
5033 /// but with all dynamically-allocated buffers duplicated in new buffers.
5034 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
5035 #[repr(C)]
5036 /// A tuple of 2 elements. See the individual fields for the types contained.
5037 pub struct C2Tuple_SignatureSignatureZ {
5038         /// The element at position 0
5039         pub a: crate::c_types::Signature,
5040         /// The element at position 1
5041         pub b: crate::c_types::Signature,
5042 }
5043 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
5044         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
5045                 Self {
5046                         a: tup.0,
5047                         b: tup.1,
5048                 }
5049         }
5050 }
5051 impl C2Tuple_SignatureSignatureZ {
5052         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
5053                 (self.a, self.b)
5054         }
5055 }
5056 impl Clone for C2Tuple_SignatureSignatureZ {
5057         fn clone(&self) -> Self {
5058                 Self {
5059                         a: Clone::clone(&self.a),
5060                         b: Clone::clone(&self.b),
5061                 }
5062         }
5063 }
5064 #[no_mangle]
5065 /// Creates a new tuple which has the same data as `orig`
5066 /// but with all dynamically-allocated buffers duplicated in new buffers.
5067 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
5068 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
5069 #[no_mangle]
5070 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
5071         C2Tuple_SignatureSignatureZ { a, b, }
5072 }
5073
5074 #[no_mangle]
5075 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
5076 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
5077 #[repr(C)]
5078 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5079 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5080         /// A pointer to the contents in the success state.
5081         /// Reading from this pointer when `result_ok` is not set is undefined.
5082         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
5083         /// Note that this value is always NULL, as there are no contents in the Err variant
5084         pub err: *mut core::ffi::c_void,
5085 }
5086 #[repr(C)]
5087 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5088 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5090 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
5091         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5092         /// `err` or `result` depending on the state of `result_ok`.
5093         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
5094         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5095         pub result_ok: bool,
5096 }
5097 #[no_mangle]
5098 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
5099 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5100         CResult_C2Tuple_SignatureSignatureZNoneZ {
5101                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5102                         result: Box::into_raw(Box::new(o)),
5103                 },
5104                 result_ok: true,
5105         }
5106 }
5107 #[no_mangle]
5108 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5109 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5110         CResult_C2Tuple_SignatureSignatureZNoneZ {
5111                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5112                         err: core::ptr::null_mut(),
5113                 },
5114                 result_ok: false,
5115         }
5116 }
5117 /// Checks if the given object is currently in the success state
5118 #[no_mangle]
5119 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5120         o.result_ok
5121 }
5122 #[no_mangle]
5123 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5124 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5125 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5126         fn drop(&mut self) {
5127                 if self.result_ok {
5128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5130                         }
5131                 } else {
5132                 }
5133         }
5134 }
5135 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5136         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5137                 let contents = if o.result_ok {
5138                         let result = unsafe { o.contents.result };
5139                         unsafe { o.contents.result = core::ptr::null_mut() };
5140                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5141                 } else {
5142                         let _ = unsafe { Box::from_raw(o.contents.err) };
5143                         o.contents.err = core::ptr::null_mut();
5144                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5145                 };
5146                 Self {
5147                         contents,
5148                         result_ok: o.result_ok,
5149                 }
5150         }
5151 }
5152 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5153         fn clone(&self) -> Self {
5154                 if self.result_ok {
5155                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5156                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5157                         } }
5158                 } else {
5159                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5160                                 err: core::ptr::null_mut()
5161                         } }
5162                 }
5163         }
5164 }
5165 #[no_mangle]
5166 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5167 /// but with all dynamically-allocated buffers duplicated in new buffers.
5168 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5169 #[repr(C)]
5170 /// The contents of CResult_SecretKeyNoneZ
5171 pub union CResult_SecretKeyNoneZPtr {
5172         /// A pointer to the contents in the success state.
5173         /// Reading from this pointer when `result_ok` is not set is undefined.
5174         pub result: *mut crate::c_types::SecretKey,
5175         /// Note that this value is always NULL, as there are no contents in the Err variant
5176         pub err: *mut core::ffi::c_void,
5177 }
5178 #[repr(C)]
5179 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5180 /// containing a crate::c_types::SecretKey on success and a () on failure.
5181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5182 pub struct CResult_SecretKeyNoneZ {
5183         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5184         /// `err` or `result` depending on the state of `result_ok`.
5185         pub contents: CResult_SecretKeyNoneZPtr,
5186         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5187         pub result_ok: bool,
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5191 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5192         CResult_SecretKeyNoneZ {
5193                 contents: CResult_SecretKeyNoneZPtr {
5194                         result: Box::into_raw(Box::new(o)),
5195                 },
5196                 result_ok: true,
5197         }
5198 }
5199 #[no_mangle]
5200 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5201 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5202         CResult_SecretKeyNoneZ {
5203                 contents: CResult_SecretKeyNoneZPtr {
5204                         err: core::ptr::null_mut(),
5205                 },
5206                 result_ok: false,
5207         }
5208 }
5209 /// Checks if the given object is currently in the success state
5210 #[no_mangle]
5211 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5212         o.result_ok
5213 }
5214 #[no_mangle]
5215 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5216 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5217 impl Drop for CResult_SecretKeyNoneZ {
5218         fn drop(&mut self) {
5219                 if self.result_ok {
5220                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5221                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5222                         }
5223                 } else {
5224                 }
5225         }
5226 }
5227 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5228         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5229                 let contents = if o.result_ok {
5230                         let result = unsafe { o.contents.result };
5231                         unsafe { o.contents.result = core::ptr::null_mut() };
5232                         CResult_SecretKeyNoneZPtr { result }
5233                 } else {
5234                         let _ = unsafe { Box::from_raw(o.contents.err) };
5235                         o.contents.err = core::ptr::null_mut();
5236                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5237                 };
5238                 Self {
5239                         contents,
5240                         result_ok: o.result_ok,
5241                 }
5242         }
5243 }
5244 impl Clone for CResult_SecretKeyNoneZ {
5245         fn clone(&self) -> Self {
5246                 if self.result_ok {
5247                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5248                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5249                         } }
5250                 } else {
5251                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5252                                 err: core::ptr::null_mut()
5253                         } }
5254                 }
5255         }
5256 }
5257 #[no_mangle]
5258 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5259 /// but with all dynamically-allocated buffers duplicated in new buffers.
5260 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5261 #[repr(C)]
5262 /// The contents of CResult_SignDecodeErrorZ
5263 pub union CResult_SignDecodeErrorZPtr {
5264         /// A pointer to the contents in the success state.
5265         /// Reading from this pointer when `result_ok` is not set is undefined.
5266         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5267         /// A pointer to the contents in the error state.
5268         /// Reading from this pointer when `result_ok` is set is undefined.
5269         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5270 }
5271 #[repr(C)]
5272 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5273 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5274 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5275 pub struct CResult_SignDecodeErrorZ {
5276         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5277         /// `err` or `result` depending on the state of `result_ok`.
5278         pub contents: CResult_SignDecodeErrorZPtr,
5279         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5280         pub result_ok: bool,
5281 }
5282 #[no_mangle]
5283 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5284 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5285         CResult_SignDecodeErrorZ {
5286                 contents: CResult_SignDecodeErrorZPtr {
5287                         result: Box::into_raw(Box::new(o)),
5288                 },
5289                 result_ok: true,
5290         }
5291 }
5292 #[no_mangle]
5293 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5294 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5295         CResult_SignDecodeErrorZ {
5296                 contents: CResult_SignDecodeErrorZPtr {
5297                         err: Box::into_raw(Box::new(e)),
5298                 },
5299                 result_ok: false,
5300         }
5301 }
5302 /// Checks if the given object is currently in the success state
5303 #[no_mangle]
5304 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5305         o.result_ok
5306 }
5307 #[no_mangle]
5308 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5309 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5310 impl Drop for CResult_SignDecodeErrorZ {
5311         fn drop(&mut self) {
5312                 if self.result_ok {
5313                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5314                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5315                         }
5316                 } else {
5317                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5318                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5319                         }
5320                 }
5321         }
5322 }
5323 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5324         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5325                 let contents = if o.result_ok {
5326                         let result = unsafe { o.contents.result };
5327                         unsafe { o.contents.result = core::ptr::null_mut() };
5328                         CResult_SignDecodeErrorZPtr { result }
5329                 } else {
5330                         let err = unsafe { o.contents.err };
5331                         unsafe { o.contents.err = core::ptr::null_mut(); }
5332                         CResult_SignDecodeErrorZPtr { err }
5333                 };
5334                 Self {
5335                         contents,
5336                         result_ok: o.result_ok,
5337                 }
5338         }
5339 }
5340 impl Clone for CResult_SignDecodeErrorZ {
5341         fn clone(&self) -> Self {
5342                 if self.result_ok {
5343                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5344                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5345                         } }
5346                 } else {
5347                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5348                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5349                         } }
5350                 }
5351         }
5352 }
5353 #[no_mangle]
5354 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5355 /// but with all dynamically-allocated buffers duplicated in new buffers.
5356 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5357 #[repr(C)]
5358 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5359 /// This corresponds to std::vector in C++
5360 pub struct CVec_u5Z {
5361         /// The elements in the array.
5362         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5363         pub data: *mut crate::c_types::u5,
5364         /// The number of elements pointed to by `data`.
5365         pub datalen: usize
5366 }
5367 impl CVec_u5Z {
5368         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5369                 if self.datalen == 0 { return Vec::new(); }
5370                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5371                 self.data = core::ptr::null_mut();
5372                 self.datalen = 0;
5373                 ret
5374         }
5375         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5376                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5377         }
5378 }
5379 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5380         fn from(v: Vec<crate::c_types::u5>) -> Self {
5381                 let datalen = v.len();
5382                 let data = Box::into_raw(v.into_boxed_slice());
5383                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5384         }
5385 }
5386 #[no_mangle]
5387 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5388 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5389 impl Drop for CVec_u5Z {
5390         fn drop(&mut self) {
5391                 if self.datalen == 0 { return; }
5392                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5393         }
5394 }
5395 impl Clone for CVec_u5Z {
5396         fn clone(&self) -> Self {
5397                 let mut res = Vec::new();
5398                 if self.datalen == 0 { return Self::from(res); }
5399                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5400                 Self::from(res)
5401         }
5402 }
5403 #[repr(C)]
5404 /// The contents of CResult_RecoverableSignatureNoneZ
5405 pub union CResult_RecoverableSignatureNoneZPtr {
5406         /// A pointer to the contents in the success state.
5407         /// Reading from this pointer when `result_ok` is not set is undefined.
5408         pub result: *mut crate::c_types::RecoverableSignature,
5409         /// Note that this value is always NULL, as there are no contents in the Err variant
5410         pub err: *mut core::ffi::c_void,
5411 }
5412 #[repr(C)]
5413 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5414 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5416 pub struct CResult_RecoverableSignatureNoneZ {
5417         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5418         /// `err` or `result` depending on the state of `result_ok`.
5419         pub contents: CResult_RecoverableSignatureNoneZPtr,
5420         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5421         pub result_ok: bool,
5422 }
5423 #[no_mangle]
5424 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5425 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5426         CResult_RecoverableSignatureNoneZ {
5427                 contents: CResult_RecoverableSignatureNoneZPtr {
5428                         result: Box::into_raw(Box::new(o)),
5429                 },
5430                 result_ok: true,
5431         }
5432 }
5433 #[no_mangle]
5434 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5435 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5436         CResult_RecoverableSignatureNoneZ {
5437                 contents: CResult_RecoverableSignatureNoneZPtr {
5438                         err: core::ptr::null_mut(),
5439                 },
5440                 result_ok: false,
5441         }
5442 }
5443 /// Checks if the given object is currently in the success state
5444 #[no_mangle]
5445 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5446         o.result_ok
5447 }
5448 #[no_mangle]
5449 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5450 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5451 impl Drop for CResult_RecoverableSignatureNoneZ {
5452         fn drop(&mut self) {
5453                 if self.result_ok {
5454                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5455                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5456                         }
5457                 } else {
5458                 }
5459         }
5460 }
5461 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5462         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5463                 let contents = if o.result_ok {
5464                         let result = unsafe { o.contents.result };
5465                         unsafe { o.contents.result = core::ptr::null_mut() };
5466                         CResult_RecoverableSignatureNoneZPtr { result }
5467                 } else {
5468                         let _ = unsafe { Box::from_raw(o.contents.err) };
5469                         o.contents.err = core::ptr::null_mut();
5470                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5471                 };
5472                 Self {
5473                         contents,
5474                         result_ok: o.result_ok,
5475                 }
5476         }
5477 }
5478 impl Clone for CResult_RecoverableSignatureNoneZ {
5479         fn clone(&self) -> Self {
5480                 if self.result_ok {
5481                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5482                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5483                         } }
5484                 } else {
5485                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5486                                 err: core::ptr::null_mut()
5487                         } }
5488                 }
5489         }
5490 }
5491 #[no_mangle]
5492 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5493 /// but with all dynamically-allocated buffers duplicated in new buffers.
5494 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5495 #[repr(C)]
5496 /// A dynamically-allocated array of u8s of arbitrary size.
5497 /// This corresponds to std::vector in C++
5498 pub struct CVec_u8Z {
5499         /// The elements in the array.
5500         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5501         pub data: *mut u8,
5502         /// The number of elements pointed to by `data`.
5503         pub datalen: usize
5504 }
5505 impl CVec_u8Z {
5506         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5507                 if self.datalen == 0 { return Vec::new(); }
5508                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5509                 self.data = core::ptr::null_mut();
5510                 self.datalen = 0;
5511                 ret
5512         }
5513         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5514                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5515         }
5516 }
5517 impl From<Vec<u8>> for CVec_u8Z {
5518         fn from(v: Vec<u8>) -> Self {
5519                 let datalen = v.len();
5520                 let data = Box::into_raw(v.into_boxed_slice());
5521                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5522         }
5523 }
5524 #[no_mangle]
5525 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5526 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5527 impl Drop for CVec_u8Z {
5528         fn drop(&mut self) {
5529                 if self.datalen == 0 { return; }
5530                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5531         }
5532 }
5533 impl Clone for CVec_u8Z {
5534         fn clone(&self) -> Self {
5535                 let mut res = Vec::new();
5536                 if self.datalen == 0 { return Self::from(res); }
5537                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5538                 Self::from(res)
5539         }
5540 }
5541 #[repr(C)]
5542 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5543 /// This corresponds to std::vector in C++
5544 pub struct CVec_CVec_u8ZZ {
5545         /// The elements in the array.
5546         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5547         pub data: *mut crate::c_types::derived::CVec_u8Z,
5548         /// The number of elements pointed to by `data`.
5549         pub datalen: usize
5550 }
5551 impl CVec_CVec_u8ZZ {
5552         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5553                 if self.datalen == 0 { return Vec::new(); }
5554                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5555                 self.data = core::ptr::null_mut();
5556                 self.datalen = 0;
5557                 ret
5558         }
5559         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5560                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5561         }
5562 }
5563 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5564         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5565                 let datalen = v.len();
5566                 let data = Box::into_raw(v.into_boxed_slice());
5567                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5568         }
5569 }
5570 #[no_mangle]
5571 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5572 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5573 impl Drop for CVec_CVec_u8ZZ {
5574         fn drop(&mut self) {
5575                 if self.datalen == 0 { return; }
5576                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5577         }
5578 }
5579 impl Clone for CVec_CVec_u8ZZ {
5580         fn clone(&self) -> Self {
5581                 let mut res = Vec::new();
5582                 if self.datalen == 0 { return Self::from(res); }
5583                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5584                 Self::from(res)
5585         }
5586 }
5587 #[repr(C)]
5588 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5589 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5590         /// A pointer to the contents in the success state.
5591         /// Reading from this pointer when `result_ok` is not set is undefined.
5592         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5593         /// Note that this value is always NULL, as there are no contents in the Err variant
5594         pub err: *mut core::ffi::c_void,
5595 }
5596 #[repr(C)]
5597 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5598 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5599 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5600 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5601         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5602         /// `err` or `result` depending on the state of `result_ok`.
5603         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5604         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5605         pub result_ok: bool,
5606 }
5607 #[no_mangle]
5608 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5609 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5610         CResult_CVec_CVec_u8ZZNoneZ {
5611                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5612                         result: Box::into_raw(Box::new(o)),
5613                 },
5614                 result_ok: true,
5615         }
5616 }
5617 #[no_mangle]
5618 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5619 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5620         CResult_CVec_CVec_u8ZZNoneZ {
5621                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5622                         err: core::ptr::null_mut(),
5623                 },
5624                 result_ok: false,
5625         }
5626 }
5627 /// Checks if the given object is currently in the success state
5628 #[no_mangle]
5629 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5630         o.result_ok
5631 }
5632 #[no_mangle]
5633 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5634 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5635 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5636         fn drop(&mut self) {
5637                 if self.result_ok {
5638                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5639                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5640                         }
5641                 } else {
5642                 }
5643         }
5644 }
5645 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5646         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5647                 let contents = if o.result_ok {
5648                         let result = unsafe { o.contents.result };
5649                         unsafe { o.contents.result = core::ptr::null_mut() };
5650                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5651                 } else {
5652                         let _ = unsafe { Box::from_raw(o.contents.err) };
5653                         o.contents.err = core::ptr::null_mut();
5654                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5655                 };
5656                 Self {
5657                         contents,
5658                         result_ok: o.result_ok,
5659                 }
5660         }
5661 }
5662 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5663         fn clone(&self) -> Self {
5664                 if self.result_ok {
5665                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5666                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5667                         } }
5668                 } else {
5669                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5670                                 err: core::ptr::null_mut()
5671                         } }
5672                 }
5673         }
5674 }
5675 #[no_mangle]
5676 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5677 /// but with all dynamically-allocated buffers duplicated in new buffers.
5678 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5679 #[repr(C)]
5680 /// The contents of CResult_InMemorySignerDecodeErrorZ
5681 pub union CResult_InMemorySignerDecodeErrorZPtr {
5682         /// A pointer to the contents in the success state.
5683         /// Reading from this pointer when `result_ok` is not set is undefined.
5684         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5685         /// A pointer to the contents in the error state.
5686         /// Reading from this pointer when `result_ok` is set is undefined.
5687         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5688 }
5689 #[repr(C)]
5690 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5691 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5692 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5693 pub struct CResult_InMemorySignerDecodeErrorZ {
5694         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5695         /// `err` or `result` depending on the state of `result_ok`.
5696         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5697         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5698         pub result_ok: bool,
5699 }
5700 #[no_mangle]
5701 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5702 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5703         CResult_InMemorySignerDecodeErrorZ {
5704                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5705                         result: Box::into_raw(Box::new(o)),
5706                 },
5707                 result_ok: true,
5708         }
5709 }
5710 #[no_mangle]
5711 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5712 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5713         CResult_InMemorySignerDecodeErrorZ {
5714                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5715                         err: Box::into_raw(Box::new(e)),
5716                 },
5717                 result_ok: false,
5718         }
5719 }
5720 /// Checks if the given object is currently in the success state
5721 #[no_mangle]
5722 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5723         o.result_ok
5724 }
5725 #[no_mangle]
5726 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5727 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5728 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5729         fn drop(&mut self) {
5730                 if self.result_ok {
5731                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5732                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5733                         }
5734                 } else {
5735                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5736                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5737                         }
5738                 }
5739         }
5740 }
5741 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5742         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5743                 let contents = if o.result_ok {
5744                         let result = unsafe { o.contents.result };
5745                         unsafe { o.contents.result = core::ptr::null_mut() };
5746                         CResult_InMemorySignerDecodeErrorZPtr { result }
5747                 } else {
5748                         let err = unsafe { o.contents.err };
5749                         unsafe { o.contents.err = core::ptr::null_mut(); }
5750                         CResult_InMemorySignerDecodeErrorZPtr { err }
5751                 };
5752                 Self {
5753                         contents,
5754                         result_ok: o.result_ok,
5755                 }
5756         }
5757 }
5758 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5759         fn clone(&self) -> Self {
5760                 if self.result_ok {
5761                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5762                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5763                         } }
5764                 } else {
5765                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5766                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5767                         } }
5768                 }
5769         }
5770 }
5771 #[no_mangle]
5772 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5773 /// but with all dynamically-allocated buffers duplicated in new buffers.
5774 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5775 #[repr(C)]
5776 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5777 /// This corresponds to std::vector in C++
5778 pub struct CVec_TxOutZ {
5779         /// The elements in the array.
5780         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5781         pub data: *mut crate::c_types::TxOut,
5782         /// The number of elements pointed to by `data`.
5783         pub datalen: usize
5784 }
5785 impl CVec_TxOutZ {
5786         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5787                 if self.datalen == 0 { return Vec::new(); }
5788                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5789                 self.data = core::ptr::null_mut();
5790                 self.datalen = 0;
5791                 ret
5792         }
5793         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5794                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5795         }
5796 }
5797 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5798         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5799                 let datalen = v.len();
5800                 let data = Box::into_raw(v.into_boxed_slice());
5801                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5802         }
5803 }
5804 #[no_mangle]
5805 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5806 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5807 impl Drop for CVec_TxOutZ {
5808         fn drop(&mut self) {
5809                 if self.datalen == 0 { return; }
5810                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5811         }
5812 }
5813 impl Clone for CVec_TxOutZ {
5814         fn clone(&self) -> Self {
5815                 let mut res = Vec::new();
5816                 if self.datalen == 0 { return Self::from(res); }
5817                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5818                 Self::from(res)
5819         }
5820 }
5821 #[repr(C)]
5822 /// The contents of CResult_TransactionNoneZ
5823 pub union CResult_TransactionNoneZPtr {
5824         /// A pointer to the contents in the success state.
5825         /// Reading from this pointer when `result_ok` is not set is undefined.
5826         pub result: *mut crate::c_types::Transaction,
5827         /// Note that this value is always NULL, as there are no contents in the Err variant
5828         pub err: *mut core::ffi::c_void,
5829 }
5830 #[repr(C)]
5831 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5832 /// containing a crate::c_types::Transaction on success and a () on failure.
5833 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5834 pub struct CResult_TransactionNoneZ {
5835         /// The contents of this CResult_TransactionNoneZ, accessible via either
5836         /// `err` or `result` depending on the state of `result_ok`.
5837         pub contents: CResult_TransactionNoneZPtr,
5838         /// Whether this CResult_TransactionNoneZ represents a success state.
5839         pub result_ok: bool,
5840 }
5841 #[no_mangle]
5842 /// Creates a new CResult_TransactionNoneZ in the success state.
5843 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5844         CResult_TransactionNoneZ {
5845                 contents: CResult_TransactionNoneZPtr {
5846                         result: Box::into_raw(Box::new(o)),
5847                 },
5848                 result_ok: true,
5849         }
5850 }
5851 #[no_mangle]
5852 /// Creates a new CResult_TransactionNoneZ in the error state.
5853 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5854         CResult_TransactionNoneZ {
5855                 contents: CResult_TransactionNoneZPtr {
5856                         err: core::ptr::null_mut(),
5857                 },
5858                 result_ok: false,
5859         }
5860 }
5861 /// Checks if the given object is currently in the success state
5862 #[no_mangle]
5863 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5864         o.result_ok
5865 }
5866 #[no_mangle]
5867 /// Frees any resources used by the CResult_TransactionNoneZ.
5868 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5869 impl Drop for CResult_TransactionNoneZ {
5870         fn drop(&mut self) {
5871                 if self.result_ok {
5872                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5873                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5874                         }
5875                 } else {
5876                 }
5877         }
5878 }
5879 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5880         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5881                 let contents = if o.result_ok {
5882                         let result = unsafe { o.contents.result };
5883                         unsafe { o.contents.result = core::ptr::null_mut() };
5884                         CResult_TransactionNoneZPtr { result }
5885                 } else {
5886                         let _ = unsafe { Box::from_raw(o.contents.err) };
5887                         o.contents.err = core::ptr::null_mut();
5888                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5889                 };
5890                 Self {
5891                         contents,
5892                         result_ok: o.result_ok,
5893                 }
5894         }
5895 }
5896 impl Clone for CResult_TransactionNoneZ {
5897         fn clone(&self) -> Self {
5898                 if self.result_ok {
5899                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5900                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5901                         } }
5902                 } else {
5903                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5904                                 err: core::ptr::null_mut()
5905                         } }
5906                 }
5907         }
5908 }
5909 #[no_mangle]
5910 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5911 /// but with all dynamically-allocated buffers duplicated in new buffers.
5912 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5913 #[repr(C)]
5914 /// A tuple of 2 elements. See the individual fields for the types contained.
5915 pub struct C2Tuple_BlockHashChannelMonitorZ {
5916         /// The element at position 0
5917         pub a: crate::c_types::ThirtyTwoBytes,
5918         /// The element at position 1
5919         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5920 }
5921 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5922         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5923                 Self {
5924                         a: tup.0,
5925                         b: tup.1,
5926                 }
5927         }
5928 }
5929 impl C2Tuple_BlockHashChannelMonitorZ {
5930         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5931                 (self.a, self.b)
5932         }
5933 }
5934 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5935 #[no_mangle]
5936 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5937         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5938 }
5939
5940 #[no_mangle]
5941 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5942 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5943 #[repr(C)]
5944 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5945 /// This corresponds to std::vector in C++
5946 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5947         /// The elements in the array.
5948         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5949         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5950         /// The number of elements pointed to by `data`.
5951         pub datalen: usize
5952 }
5953 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5954         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5955                 if self.datalen == 0 { return Vec::new(); }
5956                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5957                 self.data = core::ptr::null_mut();
5958                 self.datalen = 0;
5959                 ret
5960         }
5961         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5962                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5963         }
5964 }
5965 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5966         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5967                 let datalen = v.len();
5968                 let data = Box::into_raw(v.into_boxed_slice());
5969                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5970         }
5971 }
5972 #[no_mangle]
5973 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5974 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5975 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5976         fn drop(&mut self) {
5977                 if self.datalen == 0 { return; }
5978                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5979         }
5980 }
5981 #[repr(C)]
5982 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5983 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5984         /// A pointer to the contents in the success state.
5985         /// Reading from this pointer when `result_ok` is not set is undefined.
5986         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5987         /// A pointer to the contents in the error state.
5988         /// Reading from this pointer when `result_ok` is set is undefined.
5989         pub err: *mut crate::c_types::IOError,
5990 }
5991 #[repr(C)]
5992 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5993 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5994 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5995 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5996         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5997         /// `err` or `result` depending on the state of `result_ok`.
5998         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5999         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6000         pub result_ok: bool,
6001 }
6002 #[no_mangle]
6003 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
6004 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6005         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6006                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6007                         result: Box::into_raw(Box::new(o)),
6008                 },
6009                 result_ok: true,
6010         }
6011 }
6012 #[no_mangle]
6013 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
6014 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6015         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6016                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6017                         err: Box::into_raw(Box::new(e)),
6018                 },
6019                 result_ok: false,
6020         }
6021 }
6022 /// Checks if the given object is currently in the success state
6023 #[no_mangle]
6024 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
6025         o.result_ok
6026 }
6027 #[no_mangle]
6028 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
6029 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
6030 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6031         fn drop(&mut self) {
6032                 if self.result_ok {
6033                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6034                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6035                         }
6036                 } else {
6037                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6038                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6039                         }
6040                 }
6041         }
6042 }
6043 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6044         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
6045                 let contents = if o.result_ok {
6046                         let result = unsafe { o.contents.result };
6047                         unsafe { o.contents.result = core::ptr::null_mut() };
6048                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
6049                 } else {
6050                         let err = unsafe { o.contents.err };
6051                         unsafe { o.contents.err = core::ptr::null_mut(); }
6052                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
6053                 };
6054                 Self {
6055                         contents,
6056                         result_ok: o.result_ok,
6057                 }
6058         }
6059 }
6060 #[repr(C)]
6061 #[derive(Clone)]
6062 /// An enum which can either contain a u16 or not
6063 pub enum COption_u16Z {
6064         /// When we're in this state, this COption_u16Z contains a u16
6065         Some(u16),
6066         /// When we're in this state, this COption_u16Z contains nothing
6067         None
6068 }
6069 impl COption_u16Z {
6070         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
6071                 if let Self::None = self { false } else { true }
6072         }
6073         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
6074                 !self.is_some()
6075         }
6076         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
6077                 if let Self::Some(v) = self { v } else { unreachable!() }
6078         }
6079 }
6080 #[no_mangle]
6081 /// Constructs a new COption_u16Z containing a u16
6082 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
6083         COption_u16Z::Some(o)
6084 }
6085 #[no_mangle]
6086 /// Constructs a new COption_u16Z containing nothing
6087 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
6088         COption_u16Z::None
6089 }
6090 #[no_mangle]
6091 /// Frees any resources associated with the u16, if we are in the Some state
6092 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
6093 #[no_mangle]
6094 /// Creates a new COption_u16Z which has the same data as `orig`
6095 /// but with all dynamically-allocated buffers duplicated in new buffers.
6096 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
6097 #[repr(C)]
6098 /// The contents of CResult_NoneAPIErrorZ
6099 pub union CResult_NoneAPIErrorZPtr {
6100         /// Note that this value is always NULL, as there are no contents in the OK variant
6101         pub result: *mut core::ffi::c_void,
6102         /// A pointer to the contents in the error state.
6103         /// Reading from this pointer when `result_ok` is set is undefined.
6104         pub err: *mut crate::lightning::util::errors::APIError,
6105 }
6106 #[repr(C)]
6107 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6108 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6109 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6110 pub struct CResult_NoneAPIErrorZ {
6111         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6112         /// `err` or `result` depending on the state of `result_ok`.
6113         pub contents: CResult_NoneAPIErrorZPtr,
6114         /// Whether this CResult_NoneAPIErrorZ represents a success state.
6115         pub result_ok: bool,
6116 }
6117 #[no_mangle]
6118 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6119 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6120         CResult_NoneAPIErrorZ {
6121                 contents: CResult_NoneAPIErrorZPtr {
6122                         result: core::ptr::null_mut(),
6123                 },
6124                 result_ok: true,
6125         }
6126 }
6127 #[no_mangle]
6128 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6129 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6130         CResult_NoneAPIErrorZ {
6131                 contents: CResult_NoneAPIErrorZPtr {
6132                         err: Box::into_raw(Box::new(e)),
6133                 },
6134                 result_ok: false,
6135         }
6136 }
6137 /// Checks if the given object is currently in the success state
6138 #[no_mangle]
6139 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6140         o.result_ok
6141 }
6142 #[no_mangle]
6143 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6144 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6145 impl Drop for CResult_NoneAPIErrorZ {
6146         fn drop(&mut self) {
6147                 if self.result_ok {
6148                 } else {
6149                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6150                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6151                         }
6152                 }
6153         }
6154 }
6155 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6156         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6157                 let contents = if o.result_ok {
6158                         let _ = unsafe { Box::from_raw(o.contents.result) };
6159                         o.contents.result = core::ptr::null_mut();
6160                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6161                 } else {
6162                         let err = unsafe { o.contents.err };
6163                         unsafe { o.contents.err = core::ptr::null_mut(); }
6164                         CResult_NoneAPIErrorZPtr { err }
6165                 };
6166                 Self {
6167                         contents,
6168                         result_ok: o.result_ok,
6169                 }
6170         }
6171 }
6172 impl Clone for CResult_NoneAPIErrorZ {
6173         fn clone(&self) -> Self {
6174                 if self.result_ok {
6175                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6176                                 result: core::ptr::null_mut()
6177                         } }
6178                 } else {
6179                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6180                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6181                         } }
6182                 }
6183         }
6184 }
6185 #[no_mangle]
6186 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6187 /// but with all dynamically-allocated buffers duplicated in new buffers.
6188 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6189 #[repr(C)]
6190 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6191 /// This corresponds to std::vector in C++
6192 pub struct CVec_CResult_NoneAPIErrorZZ {
6193         /// The elements in the array.
6194         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6195         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6196         /// The number of elements pointed to by `data`.
6197         pub datalen: usize
6198 }
6199 impl CVec_CResult_NoneAPIErrorZZ {
6200         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6201                 if self.datalen == 0 { return Vec::new(); }
6202                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6203                 self.data = core::ptr::null_mut();
6204                 self.datalen = 0;
6205                 ret
6206         }
6207         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6208                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6209         }
6210 }
6211 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6212         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6213                 let datalen = v.len();
6214                 let data = Box::into_raw(v.into_boxed_slice());
6215                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6216         }
6217 }
6218 #[no_mangle]
6219 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6220 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6221 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6222         fn drop(&mut self) {
6223                 if self.datalen == 0 { return; }
6224                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6225         }
6226 }
6227 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6228         fn clone(&self) -> Self {
6229                 let mut res = Vec::new();
6230                 if self.datalen == 0 { return Self::from(res); }
6231                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6232                 Self::from(res)
6233         }
6234 }
6235 #[repr(C)]
6236 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6237 /// This corresponds to std::vector in C++
6238 pub struct CVec_APIErrorZ {
6239         /// The elements in the array.
6240         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6241         pub data: *mut crate::lightning::util::errors::APIError,
6242         /// The number of elements pointed to by `data`.
6243         pub datalen: usize
6244 }
6245 impl CVec_APIErrorZ {
6246         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6247                 if self.datalen == 0 { return Vec::new(); }
6248                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6249                 self.data = core::ptr::null_mut();
6250                 self.datalen = 0;
6251                 ret
6252         }
6253         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6254                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6255         }
6256 }
6257 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6258         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6259                 let datalen = v.len();
6260                 let data = Box::into_raw(v.into_boxed_slice());
6261                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6262         }
6263 }
6264 #[no_mangle]
6265 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6266 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6267 impl Drop for CVec_APIErrorZ {
6268         fn drop(&mut self) {
6269                 if self.datalen == 0 { return; }
6270                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6271         }
6272 }
6273 impl Clone for CVec_APIErrorZ {
6274         fn clone(&self) -> Self {
6275                 let mut res = Vec::new();
6276                 if self.datalen == 0 { return Self::from(res); }
6277                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6278                 Self::from(res)
6279         }
6280 }
6281 #[repr(C)]
6282 /// The contents of CResult__u832APIErrorZ
6283 pub union CResult__u832APIErrorZPtr {
6284         /// A pointer to the contents in the success state.
6285         /// Reading from this pointer when `result_ok` is not set is undefined.
6286         pub result: *mut crate::c_types::ThirtyTwoBytes,
6287         /// A pointer to the contents in the error state.
6288         /// Reading from this pointer when `result_ok` is set is undefined.
6289         pub err: *mut crate::lightning::util::errors::APIError,
6290 }
6291 #[repr(C)]
6292 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6293 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6294 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6295 pub struct CResult__u832APIErrorZ {
6296         /// The contents of this CResult__u832APIErrorZ, accessible via either
6297         /// `err` or `result` depending on the state of `result_ok`.
6298         pub contents: CResult__u832APIErrorZPtr,
6299         /// Whether this CResult__u832APIErrorZ represents a success state.
6300         pub result_ok: bool,
6301 }
6302 #[no_mangle]
6303 /// Creates a new CResult__u832APIErrorZ in the success state.
6304 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6305         CResult__u832APIErrorZ {
6306                 contents: CResult__u832APIErrorZPtr {
6307                         result: Box::into_raw(Box::new(o)),
6308                 },
6309                 result_ok: true,
6310         }
6311 }
6312 #[no_mangle]
6313 /// Creates a new CResult__u832APIErrorZ in the error state.
6314 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6315         CResult__u832APIErrorZ {
6316                 contents: CResult__u832APIErrorZPtr {
6317                         err: Box::into_raw(Box::new(e)),
6318                 },
6319                 result_ok: false,
6320         }
6321 }
6322 /// Checks if the given object is currently in the success state
6323 #[no_mangle]
6324 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6325         o.result_ok
6326 }
6327 #[no_mangle]
6328 /// Frees any resources used by the CResult__u832APIErrorZ.
6329 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6330 impl Drop for CResult__u832APIErrorZ {
6331         fn drop(&mut self) {
6332                 if self.result_ok {
6333                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6334                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6335                         }
6336                 } else {
6337                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6338                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6339                         }
6340                 }
6341         }
6342 }
6343 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6344         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6345                 let contents = if o.result_ok {
6346                         let result = unsafe { o.contents.result };
6347                         unsafe { o.contents.result = core::ptr::null_mut() };
6348                         CResult__u832APIErrorZPtr { result }
6349                 } else {
6350                         let err = unsafe { o.contents.err };
6351                         unsafe { o.contents.err = core::ptr::null_mut(); }
6352                         CResult__u832APIErrorZPtr { err }
6353                 };
6354                 Self {
6355                         contents,
6356                         result_ok: o.result_ok,
6357                 }
6358         }
6359 }
6360 impl Clone for CResult__u832APIErrorZ {
6361         fn clone(&self) -> Self {
6362                 if self.result_ok {
6363                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6364                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6365                         } }
6366                 } else {
6367                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6368                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6369                         } }
6370                 }
6371         }
6372 }
6373 #[no_mangle]
6374 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6375 /// but with all dynamically-allocated buffers duplicated in new buffers.
6376 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6377 #[repr(C)]
6378 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6379 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6380         /// A pointer to the contents in the success state.
6381         /// Reading from this pointer when `result_ok` is not set is undefined.
6382         pub result: *mut crate::c_types::ThirtyTwoBytes,
6383         /// A pointer to the contents in the error state.
6384         /// Reading from this pointer when `result_ok` is set is undefined.
6385         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6386 }
6387 #[repr(C)]
6388 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6389 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6390 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6391 pub struct CResult_PaymentIdPaymentSendFailureZ {
6392         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6393         /// `err` or `result` depending on the state of `result_ok`.
6394         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6395         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6396         pub result_ok: bool,
6397 }
6398 #[no_mangle]
6399 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6400 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6401         CResult_PaymentIdPaymentSendFailureZ {
6402                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6403                         result: Box::into_raw(Box::new(o)),
6404                 },
6405                 result_ok: true,
6406         }
6407 }
6408 #[no_mangle]
6409 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6410 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6411         CResult_PaymentIdPaymentSendFailureZ {
6412                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6413                         err: Box::into_raw(Box::new(e)),
6414                 },
6415                 result_ok: false,
6416         }
6417 }
6418 /// Checks if the given object is currently in the success state
6419 #[no_mangle]
6420 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6421         o.result_ok
6422 }
6423 #[no_mangle]
6424 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6425 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6426 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6427         fn drop(&mut self) {
6428                 if self.result_ok {
6429                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6430                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6431                         }
6432                 } else {
6433                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6434                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6435                         }
6436                 }
6437         }
6438 }
6439 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6440         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6441                 let contents = if o.result_ok {
6442                         let result = unsafe { o.contents.result };
6443                         unsafe { o.contents.result = core::ptr::null_mut() };
6444                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6445                 } else {
6446                         let err = unsafe { o.contents.err };
6447                         unsafe { o.contents.err = core::ptr::null_mut(); }
6448                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6449                 };
6450                 Self {
6451                         contents,
6452                         result_ok: o.result_ok,
6453                 }
6454         }
6455 }
6456 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6457         fn clone(&self) -> Self {
6458                 if self.result_ok {
6459                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6460                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6461                         } }
6462                 } else {
6463                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6464                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6465                         } }
6466                 }
6467         }
6468 }
6469 #[no_mangle]
6470 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6471 /// but with all dynamically-allocated buffers duplicated in new buffers.
6472 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6473 #[repr(C)]
6474 /// The contents of CResult_NonePaymentSendFailureZ
6475 pub union CResult_NonePaymentSendFailureZPtr {
6476         /// Note that this value is always NULL, as there are no contents in the OK variant
6477         pub result: *mut core::ffi::c_void,
6478         /// A pointer to the contents in the error state.
6479         /// Reading from this pointer when `result_ok` is set is undefined.
6480         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6481 }
6482 #[repr(C)]
6483 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6484 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6485 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6486 pub struct CResult_NonePaymentSendFailureZ {
6487         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6488         /// `err` or `result` depending on the state of `result_ok`.
6489         pub contents: CResult_NonePaymentSendFailureZPtr,
6490         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6491         pub result_ok: bool,
6492 }
6493 #[no_mangle]
6494 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6495 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6496         CResult_NonePaymentSendFailureZ {
6497                 contents: CResult_NonePaymentSendFailureZPtr {
6498                         result: core::ptr::null_mut(),
6499                 },
6500                 result_ok: true,
6501         }
6502 }
6503 #[no_mangle]
6504 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6505 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6506         CResult_NonePaymentSendFailureZ {
6507                 contents: CResult_NonePaymentSendFailureZPtr {
6508                         err: Box::into_raw(Box::new(e)),
6509                 },
6510                 result_ok: false,
6511         }
6512 }
6513 /// Checks if the given object is currently in the success state
6514 #[no_mangle]
6515 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6516         o.result_ok
6517 }
6518 #[no_mangle]
6519 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6520 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6521 impl Drop for CResult_NonePaymentSendFailureZ {
6522         fn drop(&mut self) {
6523                 if self.result_ok {
6524                 } else {
6525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6527                         }
6528                 }
6529         }
6530 }
6531 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6532         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6533                 let contents = if o.result_ok {
6534                         let _ = unsafe { Box::from_raw(o.contents.result) };
6535                         o.contents.result = core::ptr::null_mut();
6536                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6537                 } else {
6538                         let err = unsafe { o.contents.err };
6539                         unsafe { o.contents.err = core::ptr::null_mut(); }
6540                         CResult_NonePaymentSendFailureZPtr { err }
6541                 };
6542                 Self {
6543                         contents,
6544                         result_ok: o.result_ok,
6545                 }
6546         }
6547 }
6548 impl Clone for CResult_NonePaymentSendFailureZ {
6549         fn clone(&self) -> Self {
6550                 if self.result_ok {
6551                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6552                                 result: core::ptr::null_mut()
6553                         } }
6554                 } else {
6555                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6556                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6557                         } }
6558                 }
6559         }
6560 }
6561 #[no_mangle]
6562 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6563 /// but with all dynamically-allocated buffers duplicated in new buffers.
6564 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6565 #[repr(C)]
6566 /// A tuple of 2 elements. See the individual fields for the types contained.
6567 pub struct C2Tuple_PaymentHashPaymentIdZ {
6568         /// The element at position 0
6569         pub a: crate::c_types::ThirtyTwoBytes,
6570         /// The element at position 1
6571         pub b: crate::c_types::ThirtyTwoBytes,
6572 }
6573 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6574         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6575                 Self {
6576                         a: tup.0,
6577                         b: tup.1,
6578                 }
6579         }
6580 }
6581 impl C2Tuple_PaymentHashPaymentIdZ {
6582         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6583                 (self.a, self.b)
6584         }
6585 }
6586 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6587         fn clone(&self) -> Self {
6588                 Self {
6589                         a: Clone::clone(&self.a),
6590                         b: Clone::clone(&self.b),
6591                 }
6592         }
6593 }
6594 #[no_mangle]
6595 /// Creates a new tuple which has the same data as `orig`
6596 /// but with all dynamically-allocated buffers duplicated in new buffers.
6597 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6598 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6599 #[no_mangle]
6600 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6601         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6602 }
6603
6604 #[no_mangle]
6605 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6606 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6607 #[repr(C)]
6608 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6609 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6610         /// A pointer to the contents in the success state.
6611         /// Reading from this pointer when `result_ok` is not set is undefined.
6612         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6613         /// A pointer to the contents in the error state.
6614         /// Reading from this pointer when `result_ok` is set is undefined.
6615         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6616 }
6617 #[repr(C)]
6618 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6619 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6620 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6621 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6622         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6623         /// `err` or `result` depending on the state of `result_ok`.
6624         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6625         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6626         pub result_ok: bool,
6627 }
6628 #[no_mangle]
6629 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6630 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6631         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6632                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6633                         result: Box::into_raw(Box::new(o)),
6634                 },
6635                 result_ok: true,
6636         }
6637 }
6638 #[no_mangle]
6639 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6640 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6641         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6642                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6643                         err: Box::into_raw(Box::new(e)),
6644                 },
6645                 result_ok: false,
6646         }
6647 }
6648 /// Checks if the given object is currently in the success state
6649 #[no_mangle]
6650 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6651         o.result_ok
6652 }
6653 #[no_mangle]
6654 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6655 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6656 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6657         fn drop(&mut self) {
6658                 if self.result_ok {
6659                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6660                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6661                         }
6662                 } else {
6663                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6664                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6665                         }
6666                 }
6667         }
6668 }
6669 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6670         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6671                 let contents = if o.result_ok {
6672                         let result = unsafe { o.contents.result };
6673                         unsafe { o.contents.result = core::ptr::null_mut() };
6674                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6675                 } else {
6676                         let err = unsafe { o.contents.err };
6677                         unsafe { o.contents.err = core::ptr::null_mut(); }
6678                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6679                 };
6680                 Self {
6681                         contents,
6682                         result_ok: o.result_ok,
6683                 }
6684         }
6685 }
6686 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6687         fn clone(&self) -> Self {
6688                 if self.result_ok {
6689                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6690                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6691                         } }
6692                 } else {
6693                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6694                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6695                         } }
6696                 }
6697         }
6698 }
6699 #[no_mangle]
6700 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6701 /// but with all dynamically-allocated buffers duplicated in new buffers.
6702 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6703 #[repr(C)]
6704 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6705 /// This corresponds to std::vector in C++
6706 pub struct CVec_NetAddressZ {
6707         /// The elements in the array.
6708         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6709         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6710         /// The number of elements pointed to by `data`.
6711         pub datalen: usize
6712 }
6713 impl CVec_NetAddressZ {
6714         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6715                 if self.datalen == 0 { return Vec::new(); }
6716                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6717                 self.data = core::ptr::null_mut();
6718                 self.datalen = 0;
6719                 ret
6720         }
6721         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6722                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6723         }
6724 }
6725 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6726         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6727                 let datalen = v.len();
6728                 let data = Box::into_raw(v.into_boxed_slice());
6729                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6730         }
6731 }
6732 #[no_mangle]
6733 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6734 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6735 impl Drop for CVec_NetAddressZ {
6736         fn drop(&mut self) {
6737                 if self.datalen == 0 { return; }
6738                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6739         }
6740 }
6741 impl Clone for CVec_NetAddressZ {
6742         fn clone(&self) -> Self {
6743                 let mut res = Vec::new();
6744                 if self.datalen == 0 { return Self::from(res); }
6745                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6746                 Self::from(res)
6747         }
6748 }
6749 #[repr(C)]
6750 /// A tuple of 2 elements. See the individual fields for the types contained.
6751 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6752         /// The element at position 0
6753         pub a: crate::c_types::ThirtyTwoBytes,
6754         /// The element at position 1
6755         pub b: crate::c_types::ThirtyTwoBytes,
6756 }
6757 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6758         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6759                 Self {
6760                         a: tup.0,
6761                         b: tup.1,
6762                 }
6763         }
6764 }
6765 impl C2Tuple_PaymentHashPaymentSecretZ {
6766         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6767                 (self.a, self.b)
6768         }
6769 }
6770 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6771         fn clone(&self) -> Self {
6772                 Self {
6773                         a: Clone::clone(&self.a),
6774                         b: Clone::clone(&self.b),
6775                 }
6776         }
6777 }
6778 #[no_mangle]
6779 /// Creates a new tuple which has the same data as `orig`
6780 /// but with all dynamically-allocated buffers duplicated in new buffers.
6781 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6782 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6783 #[no_mangle]
6784 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6785         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6786 }
6787
6788 #[no_mangle]
6789 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6790 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6791 #[repr(C)]
6792 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6793 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6794         /// A pointer to the contents in the success state.
6795         /// Reading from this pointer when `result_ok` is not set is undefined.
6796         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6797         /// Note that this value is always NULL, as there are no contents in the Err variant
6798         pub err: *mut core::ffi::c_void,
6799 }
6800 #[repr(C)]
6801 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6802 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6803 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6804 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6805         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6806         /// `err` or `result` depending on the state of `result_ok`.
6807         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6808         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6809         pub result_ok: bool,
6810 }
6811 #[no_mangle]
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6814         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6815                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6816                         result: Box::into_raw(Box::new(o)),
6817                 },
6818                 result_ok: true,
6819         }
6820 }
6821 #[no_mangle]
6822 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6823 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6824         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6825                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6826                         err: core::ptr::null_mut(),
6827                 },
6828                 result_ok: false,
6829         }
6830 }
6831 /// Checks if the given object is currently in the success state
6832 #[no_mangle]
6833 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6834         o.result_ok
6835 }
6836 #[no_mangle]
6837 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6838 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6839 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6840         fn drop(&mut self) {
6841                 if self.result_ok {
6842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6844                         }
6845                 } else {
6846                 }
6847         }
6848 }
6849 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6850         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6851                 let contents = if o.result_ok {
6852                         let result = unsafe { o.contents.result };
6853                         unsafe { o.contents.result = core::ptr::null_mut() };
6854                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6855                 } else {
6856                         let _ = unsafe { Box::from_raw(o.contents.err) };
6857                         o.contents.err = core::ptr::null_mut();
6858                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6859                 };
6860                 Self {
6861                         contents,
6862                         result_ok: o.result_ok,
6863                 }
6864         }
6865 }
6866 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6867         fn clone(&self) -> Self {
6868                 if self.result_ok {
6869                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6870                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6871                         } }
6872                 } else {
6873                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6874                                 err: core::ptr::null_mut()
6875                         } }
6876                 }
6877         }
6878 }
6879 #[no_mangle]
6880 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6881 /// but with all dynamically-allocated buffers duplicated in new buffers.
6882 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6883 #[repr(C)]
6884 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6885 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6886         /// A pointer to the contents in the success state.
6887         /// Reading from this pointer when `result_ok` is not set is undefined.
6888         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6889         /// A pointer to the contents in the error state.
6890         /// Reading from this pointer when `result_ok` is set is undefined.
6891         pub err: *mut crate::lightning::util::errors::APIError,
6892 }
6893 #[repr(C)]
6894 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6895 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6896 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6897 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6898         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6899         /// `err` or `result` depending on the state of `result_ok`.
6900         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6901         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6902         pub result_ok: bool,
6903 }
6904 #[no_mangle]
6905 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6906 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6907         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6908                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6909                         result: Box::into_raw(Box::new(o)),
6910                 },
6911                 result_ok: true,
6912         }
6913 }
6914 #[no_mangle]
6915 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6916 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6917         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6918                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6919                         err: Box::into_raw(Box::new(e)),
6920                 },
6921                 result_ok: false,
6922         }
6923 }
6924 /// Checks if the given object is currently in the success state
6925 #[no_mangle]
6926 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6927         o.result_ok
6928 }
6929 #[no_mangle]
6930 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6931 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6932 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6933         fn drop(&mut self) {
6934                 if self.result_ok {
6935                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6936                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6937                         }
6938                 } else {
6939                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6940                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6941                         }
6942                 }
6943         }
6944 }
6945 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6946         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6947                 let contents = if o.result_ok {
6948                         let result = unsafe { o.contents.result };
6949                         unsafe { o.contents.result = core::ptr::null_mut() };
6950                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6951                 } else {
6952                         let err = unsafe { o.contents.err };
6953                         unsafe { o.contents.err = core::ptr::null_mut(); }
6954                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6955                 };
6956                 Self {
6957                         contents,
6958                         result_ok: o.result_ok,
6959                 }
6960         }
6961 }
6962 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6963         fn clone(&self) -> Self {
6964                 if self.result_ok {
6965                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6966                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6967                         } }
6968                 } else {
6969                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6970                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6971                         } }
6972                 }
6973         }
6974 }
6975 #[no_mangle]
6976 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6977 /// but with all dynamically-allocated buffers duplicated in new buffers.
6978 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6979 #[repr(C)]
6980 /// The contents of CResult_PaymentSecretNoneZ
6981 pub union CResult_PaymentSecretNoneZPtr {
6982         /// A pointer to the contents in the success state.
6983         /// Reading from this pointer when `result_ok` is not set is undefined.
6984         pub result: *mut crate::c_types::ThirtyTwoBytes,
6985         /// Note that this value is always NULL, as there are no contents in the Err variant
6986         pub err: *mut core::ffi::c_void,
6987 }
6988 #[repr(C)]
6989 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6990 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6992 pub struct CResult_PaymentSecretNoneZ {
6993         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6994         /// `err` or `result` depending on the state of `result_ok`.
6995         pub contents: CResult_PaymentSecretNoneZPtr,
6996         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6997         pub result_ok: bool,
6998 }
6999 #[no_mangle]
7000 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
7001 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
7002         CResult_PaymentSecretNoneZ {
7003                 contents: CResult_PaymentSecretNoneZPtr {
7004                         result: Box::into_raw(Box::new(o)),
7005                 },
7006                 result_ok: true,
7007         }
7008 }
7009 #[no_mangle]
7010 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
7011 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
7012         CResult_PaymentSecretNoneZ {
7013                 contents: CResult_PaymentSecretNoneZPtr {
7014                         err: core::ptr::null_mut(),
7015                 },
7016                 result_ok: false,
7017         }
7018 }
7019 /// Checks if the given object is currently in the success state
7020 #[no_mangle]
7021 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
7022         o.result_ok
7023 }
7024 #[no_mangle]
7025 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
7026 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
7027 impl Drop for CResult_PaymentSecretNoneZ {
7028         fn drop(&mut self) {
7029                 if self.result_ok {
7030                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7031                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7032                         }
7033                 } else {
7034                 }
7035         }
7036 }
7037 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
7038         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
7039                 let contents = if o.result_ok {
7040                         let result = unsafe { o.contents.result };
7041                         unsafe { o.contents.result = core::ptr::null_mut() };
7042                         CResult_PaymentSecretNoneZPtr { result }
7043                 } else {
7044                         let _ = unsafe { Box::from_raw(o.contents.err) };
7045                         o.contents.err = core::ptr::null_mut();
7046                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
7047                 };
7048                 Self {
7049                         contents,
7050                         result_ok: o.result_ok,
7051                 }
7052         }
7053 }
7054 impl Clone for CResult_PaymentSecretNoneZ {
7055         fn clone(&self) -> Self {
7056                 if self.result_ok {
7057                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
7058                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7059                         } }
7060                 } else {
7061                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
7062                                 err: core::ptr::null_mut()
7063                         } }
7064                 }
7065         }
7066 }
7067 #[no_mangle]
7068 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
7069 /// but with all dynamically-allocated buffers duplicated in new buffers.
7070 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
7071 #[repr(C)]
7072 /// The contents of CResult_PaymentSecretAPIErrorZ
7073 pub union CResult_PaymentSecretAPIErrorZPtr {
7074         /// A pointer to the contents in the success state.
7075         /// Reading from this pointer when `result_ok` is not set is undefined.
7076         pub result: *mut crate::c_types::ThirtyTwoBytes,
7077         /// A pointer to the contents in the error state.
7078         /// Reading from this pointer when `result_ok` is set is undefined.
7079         pub err: *mut crate::lightning::util::errors::APIError,
7080 }
7081 #[repr(C)]
7082 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7083 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7084 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7085 pub struct CResult_PaymentSecretAPIErrorZ {
7086         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7087         /// `err` or `result` depending on the state of `result_ok`.
7088         pub contents: CResult_PaymentSecretAPIErrorZPtr,
7089         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7090         pub result_ok: bool,
7091 }
7092 #[no_mangle]
7093 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
7094 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
7095         CResult_PaymentSecretAPIErrorZ {
7096                 contents: CResult_PaymentSecretAPIErrorZPtr {
7097                         result: Box::into_raw(Box::new(o)),
7098                 },
7099                 result_ok: true,
7100         }
7101 }
7102 #[no_mangle]
7103 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7104 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7105         CResult_PaymentSecretAPIErrorZ {
7106                 contents: CResult_PaymentSecretAPIErrorZPtr {
7107                         err: Box::into_raw(Box::new(e)),
7108                 },
7109                 result_ok: false,
7110         }
7111 }
7112 /// Checks if the given object is currently in the success state
7113 #[no_mangle]
7114 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7115         o.result_ok
7116 }
7117 #[no_mangle]
7118 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7119 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7120 impl Drop for CResult_PaymentSecretAPIErrorZ {
7121         fn drop(&mut self) {
7122                 if self.result_ok {
7123                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7124                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7125                         }
7126                 } else {
7127                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7128                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7129                         }
7130                 }
7131         }
7132 }
7133 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7134         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7135                 let contents = if o.result_ok {
7136                         let result = unsafe { o.contents.result };
7137                         unsafe { o.contents.result = core::ptr::null_mut() };
7138                         CResult_PaymentSecretAPIErrorZPtr { result }
7139                 } else {
7140                         let err = unsafe { o.contents.err };
7141                         unsafe { o.contents.err = core::ptr::null_mut(); }
7142                         CResult_PaymentSecretAPIErrorZPtr { err }
7143                 };
7144                 Self {
7145                         contents,
7146                         result_ok: o.result_ok,
7147                 }
7148         }
7149 }
7150 impl Clone for CResult_PaymentSecretAPIErrorZ {
7151         fn clone(&self) -> Self {
7152                 if self.result_ok {
7153                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7154                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7155                         } }
7156                 } else {
7157                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7158                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7159                         } }
7160                 }
7161         }
7162 }
7163 #[no_mangle]
7164 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7165 /// but with all dynamically-allocated buffers duplicated in new buffers.
7166 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7167 #[repr(C)]
7168 /// The contents of CResult_PaymentPreimageAPIErrorZ
7169 pub union CResult_PaymentPreimageAPIErrorZPtr {
7170         /// A pointer to the contents in the success state.
7171         /// Reading from this pointer when `result_ok` is not set is undefined.
7172         pub result: *mut crate::c_types::ThirtyTwoBytes,
7173         /// A pointer to the contents in the error state.
7174         /// Reading from this pointer when `result_ok` is set is undefined.
7175         pub err: *mut crate::lightning::util::errors::APIError,
7176 }
7177 #[repr(C)]
7178 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7179 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7180 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7181 pub struct CResult_PaymentPreimageAPIErrorZ {
7182         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7183         /// `err` or `result` depending on the state of `result_ok`.
7184         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7185         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7186         pub result_ok: bool,
7187 }
7188 #[no_mangle]
7189 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7190 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7191         CResult_PaymentPreimageAPIErrorZ {
7192                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7193                         result: Box::into_raw(Box::new(o)),
7194                 },
7195                 result_ok: true,
7196         }
7197 }
7198 #[no_mangle]
7199 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7200 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7201         CResult_PaymentPreimageAPIErrorZ {
7202                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7203                         err: Box::into_raw(Box::new(e)),
7204                 },
7205                 result_ok: false,
7206         }
7207 }
7208 /// Checks if the given object is currently in the success state
7209 #[no_mangle]
7210 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7211         o.result_ok
7212 }
7213 #[no_mangle]
7214 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7215 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7216 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7217         fn drop(&mut self) {
7218                 if self.result_ok {
7219                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7220                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7221                         }
7222                 } else {
7223                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7224                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7225                         }
7226                 }
7227         }
7228 }
7229 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7230         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7231                 let contents = if o.result_ok {
7232                         let result = unsafe { o.contents.result };
7233                         unsafe { o.contents.result = core::ptr::null_mut() };
7234                         CResult_PaymentPreimageAPIErrorZPtr { result }
7235                 } else {
7236                         let err = unsafe { o.contents.err };
7237                         unsafe { o.contents.err = core::ptr::null_mut(); }
7238                         CResult_PaymentPreimageAPIErrorZPtr { err }
7239                 };
7240                 Self {
7241                         contents,
7242                         result_ok: o.result_ok,
7243                 }
7244         }
7245 }
7246 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7247         fn clone(&self) -> Self {
7248                 if self.result_ok {
7249                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7250                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7251                         } }
7252                 } else {
7253                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7254                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7255                         } }
7256                 }
7257         }
7258 }
7259 #[no_mangle]
7260 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7261 /// but with all dynamically-allocated buffers duplicated in new buffers.
7262 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7263 #[repr(C)]
7264 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7265 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7266         /// A pointer to the contents in the success state.
7267         /// Reading from this pointer when `result_ok` is not set is undefined.
7268         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7269         /// A pointer to the contents in the error state.
7270         /// Reading from this pointer when `result_ok` is set is undefined.
7271         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7272 }
7273 #[repr(C)]
7274 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7275 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7276 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7277 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7278         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7279         /// `err` or `result` depending on the state of `result_ok`.
7280         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7281         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7282         pub result_ok: bool,
7283 }
7284 #[no_mangle]
7285 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7286 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7287         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7288                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7289                         result: Box::into_raw(Box::new(o)),
7290                 },
7291                 result_ok: true,
7292         }
7293 }
7294 #[no_mangle]
7295 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7296 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7297         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7298                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7299                         err: Box::into_raw(Box::new(e)),
7300                 },
7301                 result_ok: false,
7302         }
7303 }
7304 /// Checks if the given object is currently in the success state
7305 #[no_mangle]
7306 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7307         o.result_ok
7308 }
7309 #[no_mangle]
7310 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7311 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7312 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7313         fn drop(&mut self) {
7314                 if self.result_ok {
7315                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7316                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7317                         }
7318                 } else {
7319                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7320                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7321                         }
7322                 }
7323         }
7324 }
7325 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7326         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7327                 let contents = if o.result_ok {
7328                         let result = unsafe { o.contents.result };
7329                         unsafe { o.contents.result = core::ptr::null_mut() };
7330                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7331                 } else {
7332                         let err = unsafe { o.contents.err };
7333                         unsafe { o.contents.err = core::ptr::null_mut(); }
7334                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7335                 };
7336                 Self {
7337                         contents,
7338                         result_ok: o.result_ok,
7339                 }
7340         }
7341 }
7342 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7343         fn clone(&self) -> Self {
7344                 if self.result_ok {
7345                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7346                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7347                         } }
7348                 } else {
7349                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7350                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7351                         } }
7352                 }
7353         }
7354 }
7355 #[no_mangle]
7356 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7357 /// but with all dynamically-allocated buffers duplicated in new buffers.
7358 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7359 #[repr(C)]
7360 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7361 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7362         /// A pointer to the contents in the success state.
7363         /// Reading from this pointer when `result_ok` is not set is undefined.
7364         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7365         /// A pointer to the contents in the error state.
7366         /// Reading from this pointer when `result_ok` is set is undefined.
7367         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7368 }
7369 #[repr(C)]
7370 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7371 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7373 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7374         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7375         /// `err` or `result` depending on the state of `result_ok`.
7376         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7377         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7378         pub result_ok: bool,
7379 }
7380 #[no_mangle]
7381 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7382 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7383         CResult_ChannelCounterpartyDecodeErrorZ {
7384                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7385                         result: Box::into_raw(Box::new(o)),
7386                 },
7387                 result_ok: true,
7388         }
7389 }
7390 #[no_mangle]
7391 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7392 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7393         CResult_ChannelCounterpartyDecodeErrorZ {
7394                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7395                         err: Box::into_raw(Box::new(e)),
7396                 },
7397                 result_ok: false,
7398         }
7399 }
7400 /// Checks if the given object is currently in the success state
7401 #[no_mangle]
7402 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7403         o.result_ok
7404 }
7405 #[no_mangle]
7406 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7407 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7408 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7409         fn drop(&mut self) {
7410                 if self.result_ok {
7411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7413                         }
7414                 } else {
7415                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7416                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7417                         }
7418                 }
7419         }
7420 }
7421 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7422         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7423                 let contents = if o.result_ok {
7424                         let result = unsafe { o.contents.result };
7425                         unsafe { o.contents.result = core::ptr::null_mut() };
7426                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7427                 } else {
7428                         let err = unsafe { o.contents.err };
7429                         unsafe { o.contents.err = core::ptr::null_mut(); }
7430                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7431                 };
7432                 Self {
7433                         contents,
7434                         result_ok: o.result_ok,
7435                 }
7436         }
7437 }
7438 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7439         fn clone(&self) -> Self {
7440                 if self.result_ok {
7441                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7442                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7443                         } }
7444                 } else {
7445                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7446                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7447                         } }
7448                 }
7449         }
7450 }
7451 #[no_mangle]
7452 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7453 /// but with all dynamically-allocated buffers duplicated in new buffers.
7454 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7455 #[repr(C)]
7456 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7457 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7458         /// A pointer to the contents in the success state.
7459         /// Reading from this pointer when `result_ok` is not set is undefined.
7460         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7461         /// A pointer to the contents in the error state.
7462         /// Reading from this pointer when `result_ok` is set is undefined.
7463         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7464 }
7465 #[repr(C)]
7466 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7467 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7468 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7469 pub struct CResult_ChannelDetailsDecodeErrorZ {
7470         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7471         /// `err` or `result` depending on the state of `result_ok`.
7472         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7473         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7474         pub result_ok: bool,
7475 }
7476 #[no_mangle]
7477 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7478 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7479         CResult_ChannelDetailsDecodeErrorZ {
7480                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7481                         result: Box::into_raw(Box::new(o)),
7482                 },
7483                 result_ok: true,
7484         }
7485 }
7486 #[no_mangle]
7487 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7488 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7489         CResult_ChannelDetailsDecodeErrorZ {
7490                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7491                         err: Box::into_raw(Box::new(e)),
7492                 },
7493                 result_ok: false,
7494         }
7495 }
7496 /// Checks if the given object is currently in the success state
7497 #[no_mangle]
7498 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7499         o.result_ok
7500 }
7501 #[no_mangle]
7502 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7503 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7504 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7505         fn drop(&mut self) {
7506                 if self.result_ok {
7507                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7508                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7509                         }
7510                 } else {
7511                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7512                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7513                         }
7514                 }
7515         }
7516 }
7517 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7518         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7519                 let contents = if o.result_ok {
7520                         let result = unsafe { o.contents.result };
7521                         unsafe { o.contents.result = core::ptr::null_mut() };
7522                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7523                 } else {
7524                         let err = unsafe { o.contents.err };
7525                         unsafe { o.contents.err = core::ptr::null_mut(); }
7526                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7527                 };
7528                 Self {
7529                         contents,
7530                         result_ok: o.result_ok,
7531                 }
7532         }
7533 }
7534 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7535         fn clone(&self) -> Self {
7536                 if self.result_ok {
7537                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7538                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7539                         } }
7540                 } else {
7541                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7542                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7543                         } }
7544                 }
7545         }
7546 }
7547 #[no_mangle]
7548 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7549 /// but with all dynamically-allocated buffers duplicated in new buffers.
7550 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7551 #[repr(C)]
7552 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7553 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7554         /// A pointer to the contents in the success state.
7555         /// Reading from this pointer when `result_ok` is not set is undefined.
7556         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7557         /// A pointer to the contents in the error state.
7558         /// Reading from this pointer when `result_ok` is set is undefined.
7559         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7560 }
7561 #[repr(C)]
7562 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7563 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7564 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7566         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7567         /// `err` or `result` depending on the state of `result_ok`.
7568         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7569         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7570         pub result_ok: bool,
7571 }
7572 #[no_mangle]
7573 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7574 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7575         CResult_PhantomRouteHintsDecodeErrorZ {
7576                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7577                         result: Box::into_raw(Box::new(o)),
7578                 },
7579                 result_ok: true,
7580         }
7581 }
7582 #[no_mangle]
7583 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7584 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7585         CResult_PhantomRouteHintsDecodeErrorZ {
7586                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7587                         err: Box::into_raw(Box::new(e)),
7588                 },
7589                 result_ok: false,
7590         }
7591 }
7592 /// Checks if the given object is currently in the success state
7593 #[no_mangle]
7594 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7595         o.result_ok
7596 }
7597 #[no_mangle]
7598 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7599 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7600 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7601         fn drop(&mut self) {
7602                 if self.result_ok {
7603                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7604                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7605                         }
7606                 } else {
7607                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7608                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7609                         }
7610                 }
7611         }
7612 }
7613 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7614         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7615                 let contents = if o.result_ok {
7616                         let result = unsafe { o.contents.result };
7617                         unsafe { o.contents.result = core::ptr::null_mut() };
7618                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7619                 } else {
7620                         let err = unsafe { o.contents.err };
7621                         unsafe { o.contents.err = core::ptr::null_mut(); }
7622                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7623                 };
7624                 Self {
7625                         contents,
7626                         result_ok: o.result_ok,
7627                 }
7628         }
7629 }
7630 #[repr(C)]
7631 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7632 /// This corresponds to std::vector in C++
7633 pub struct CVec_ChannelMonitorZ {
7634         /// The elements in the array.
7635         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7636         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7637         /// The number of elements pointed to by `data`.
7638         pub datalen: usize
7639 }
7640 impl CVec_ChannelMonitorZ {
7641         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7642                 if self.datalen == 0 { return Vec::new(); }
7643                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7644                 self.data = core::ptr::null_mut();
7645                 self.datalen = 0;
7646                 ret
7647         }
7648         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7649                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7650         }
7651 }
7652 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7653         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7654                 let datalen = v.len();
7655                 let data = Box::into_raw(v.into_boxed_slice());
7656                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7657         }
7658 }
7659 #[no_mangle]
7660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7661 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7662 impl Drop for CVec_ChannelMonitorZ {
7663         fn drop(&mut self) {
7664                 if self.datalen == 0 { return; }
7665                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7666         }
7667 }
7668 #[repr(C)]
7669 /// A tuple of 2 elements. See the individual fields for the types contained.
7670 pub struct C2Tuple_BlockHashChannelManagerZ {
7671         /// The element at position 0
7672         pub a: crate::c_types::ThirtyTwoBytes,
7673         /// The element at position 1
7674         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7675 }
7676 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7677         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7678                 Self {
7679                         a: tup.0,
7680                         b: tup.1,
7681                 }
7682         }
7683 }
7684 impl C2Tuple_BlockHashChannelManagerZ {
7685         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7686                 (self.a, self.b)
7687         }
7688 }
7689 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7690 #[no_mangle]
7691 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7692         C2Tuple_BlockHashChannelManagerZ { a, b, }
7693 }
7694
7695 #[no_mangle]
7696 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7697 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7698 #[repr(C)]
7699 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7700 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7701         /// A pointer to the contents in the success state.
7702         /// Reading from this pointer when `result_ok` is not set is undefined.
7703         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7704         /// A pointer to the contents in the error state.
7705         /// Reading from this pointer when `result_ok` is set is undefined.
7706         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7707 }
7708 #[repr(C)]
7709 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7710 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7711 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7712 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7713         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7714         /// `err` or `result` depending on the state of `result_ok`.
7715         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7716         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7717         pub result_ok: bool,
7718 }
7719 #[no_mangle]
7720 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7721 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7722         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7723                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7724                         result: Box::into_raw(Box::new(o)),
7725                 },
7726                 result_ok: true,
7727         }
7728 }
7729 #[no_mangle]
7730 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7731 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7732         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7733                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7734                         err: Box::into_raw(Box::new(e)),
7735                 },
7736                 result_ok: false,
7737         }
7738 }
7739 /// Checks if the given object is currently in the success state
7740 #[no_mangle]
7741 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7742         o.result_ok
7743 }
7744 #[no_mangle]
7745 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7746 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7747 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7748         fn drop(&mut self) {
7749                 if self.result_ok {
7750                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7751                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7752                         }
7753                 } else {
7754                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7755                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7756                         }
7757                 }
7758         }
7759 }
7760 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7761         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7762                 let contents = if o.result_ok {
7763                         let result = unsafe { o.contents.result };
7764                         unsafe { o.contents.result = core::ptr::null_mut() };
7765                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7766                 } else {
7767                         let err = unsafe { o.contents.err };
7768                         unsafe { o.contents.err = core::ptr::null_mut(); }
7769                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7770                 };
7771                 Self {
7772                         contents,
7773                         result_ok: o.result_ok,
7774                 }
7775         }
7776 }
7777 #[repr(C)]
7778 /// The contents of CResult_ChannelConfigDecodeErrorZ
7779 pub union CResult_ChannelConfigDecodeErrorZPtr {
7780         /// A pointer to the contents in the success state.
7781         /// Reading from this pointer when `result_ok` is not set is undefined.
7782         pub result: *mut crate::lightning::util::config::ChannelConfig,
7783         /// A pointer to the contents in the error state.
7784         /// Reading from this pointer when `result_ok` is set is undefined.
7785         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7786 }
7787 #[repr(C)]
7788 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7789 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7790 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7791 pub struct CResult_ChannelConfigDecodeErrorZ {
7792         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7793         /// `err` or `result` depending on the state of `result_ok`.
7794         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7795         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7796         pub result_ok: bool,
7797 }
7798 #[no_mangle]
7799 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7800 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7801         CResult_ChannelConfigDecodeErrorZ {
7802                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7803                         result: Box::into_raw(Box::new(o)),
7804                 },
7805                 result_ok: true,
7806         }
7807 }
7808 #[no_mangle]
7809 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7810 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7811         CResult_ChannelConfigDecodeErrorZ {
7812                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7813                         err: Box::into_raw(Box::new(e)),
7814                 },
7815                 result_ok: false,
7816         }
7817 }
7818 /// Checks if the given object is currently in the success state
7819 #[no_mangle]
7820 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7821         o.result_ok
7822 }
7823 #[no_mangle]
7824 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7825 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7826 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7827         fn drop(&mut self) {
7828                 if self.result_ok {
7829                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7830                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7831                         }
7832                 } else {
7833                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7834                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7835                         }
7836                 }
7837         }
7838 }
7839 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7840         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7841                 let contents = if o.result_ok {
7842                         let result = unsafe { o.contents.result };
7843                         unsafe { o.contents.result = core::ptr::null_mut() };
7844                         CResult_ChannelConfigDecodeErrorZPtr { result }
7845                 } else {
7846                         let err = unsafe { o.contents.err };
7847                         unsafe { o.contents.err = core::ptr::null_mut(); }
7848                         CResult_ChannelConfigDecodeErrorZPtr { err }
7849                 };
7850                 Self {
7851                         contents,
7852                         result_ok: o.result_ok,
7853                 }
7854         }
7855 }
7856 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7857         fn clone(&self) -> Self {
7858                 if self.result_ok {
7859                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7860                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7861                         } }
7862                 } else {
7863                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7864                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7865                         } }
7866                 }
7867         }
7868 }
7869 #[no_mangle]
7870 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7871 /// but with all dynamically-allocated buffers duplicated in new buffers.
7872 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7873 #[repr(C)]
7874 /// The contents of CResult_OutPointDecodeErrorZ
7875 pub union CResult_OutPointDecodeErrorZPtr {
7876         /// A pointer to the contents in the success state.
7877         /// Reading from this pointer when `result_ok` is not set is undefined.
7878         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7879         /// A pointer to the contents in the error state.
7880         /// Reading from this pointer when `result_ok` is set is undefined.
7881         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7882 }
7883 #[repr(C)]
7884 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7885 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7886 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7887 pub struct CResult_OutPointDecodeErrorZ {
7888         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7889         /// `err` or `result` depending on the state of `result_ok`.
7890         pub contents: CResult_OutPointDecodeErrorZPtr,
7891         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7892         pub result_ok: bool,
7893 }
7894 #[no_mangle]
7895 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7896 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7897         CResult_OutPointDecodeErrorZ {
7898                 contents: CResult_OutPointDecodeErrorZPtr {
7899                         result: Box::into_raw(Box::new(o)),
7900                 },
7901                 result_ok: true,
7902         }
7903 }
7904 #[no_mangle]
7905 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7906 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7907         CResult_OutPointDecodeErrorZ {
7908                 contents: CResult_OutPointDecodeErrorZPtr {
7909                         err: Box::into_raw(Box::new(e)),
7910                 },
7911                 result_ok: false,
7912         }
7913 }
7914 /// Checks if the given object is currently in the success state
7915 #[no_mangle]
7916 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7917         o.result_ok
7918 }
7919 #[no_mangle]
7920 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7921 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7922 impl Drop for CResult_OutPointDecodeErrorZ {
7923         fn drop(&mut self) {
7924                 if self.result_ok {
7925                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7926                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7927                         }
7928                 } else {
7929                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7930                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7931                         }
7932                 }
7933         }
7934 }
7935 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7936         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7937                 let contents = if o.result_ok {
7938                         let result = unsafe { o.contents.result };
7939                         unsafe { o.contents.result = core::ptr::null_mut() };
7940                         CResult_OutPointDecodeErrorZPtr { result }
7941                 } else {
7942                         let err = unsafe { o.contents.err };
7943                         unsafe { o.contents.err = core::ptr::null_mut(); }
7944                         CResult_OutPointDecodeErrorZPtr { err }
7945                 };
7946                 Self {
7947                         contents,
7948                         result_ok: o.result_ok,
7949                 }
7950         }
7951 }
7952 impl Clone for CResult_OutPointDecodeErrorZ {
7953         fn clone(&self) -> Self {
7954                 if self.result_ok {
7955                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7956                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7957                         } }
7958                 } else {
7959                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7960                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7961                         } }
7962                 }
7963         }
7964 }
7965 #[no_mangle]
7966 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7967 /// but with all dynamically-allocated buffers duplicated in new buffers.
7968 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7969 #[repr(C)]
7970 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7971 pub enum COption_TypeZ {
7972         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7973         Some(crate::lightning::ln::wire::Type),
7974         /// When we're in this state, this COption_TypeZ contains nothing
7975         None
7976 }
7977 impl COption_TypeZ {
7978         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7979                 if let Self::None = self { false } else { true }
7980         }
7981         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7982                 !self.is_some()
7983         }
7984         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7985                 if let Self::Some(v) = self { v } else { unreachable!() }
7986         }
7987 }
7988 #[no_mangle]
7989 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7990 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7991         COption_TypeZ::Some(o)
7992 }
7993 #[no_mangle]
7994 /// Constructs a new COption_TypeZ containing nothing
7995 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7996         COption_TypeZ::None
7997 }
7998 #[no_mangle]
7999 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
8000 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
8001 #[repr(C)]
8002 /// The contents of CResult_COption_TypeZDecodeErrorZ
8003 pub union CResult_COption_TypeZDecodeErrorZPtr {
8004         /// A pointer to the contents in the success state.
8005         /// Reading from this pointer when `result_ok` is not set is undefined.
8006         pub result: *mut crate::c_types::derived::COption_TypeZ,
8007         /// A pointer to the contents in the error state.
8008         /// Reading from this pointer when `result_ok` is set is undefined.
8009         pub err: *mut crate::lightning::ln::msgs::DecodeError,
8010 }
8011 #[repr(C)]
8012 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8013 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8014 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8015 pub struct CResult_COption_TypeZDecodeErrorZ {
8016         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8017         /// `err` or `result` depending on the state of `result_ok`.
8018         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
8019         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8020         pub result_ok: bool,
8021 }
8022 #[no_mangle]
8023 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
8024 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
8025         CResult_COption_TypeZDecodeErrorZ {
8026                 contents: CResult_COption_TypeZDecodeErrorZPtr {
8027                         result: Box::into_raw(Box::new(o)),
8028                 },
8029                 result_ok: true,
8030         }
8031 }
8032 #[no_mangle]
8033 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
8034 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
8035         CResult_COption_TypeZDecodeErrorZ {
8036                 contents: CResult_COption_TypeZDecodeErrorZPtr {
8037                         err: Box::into_raw(Box::new(e)),
8038                 },
8039                 result_ok: false,
8040         }
8041 }
8042 /// Checks if the given object is currently in the success state
8043 #[no_mangle]
8044 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
8045         o.result_ok
8046 }
8047 #[no_mangle]
8048 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
8049 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
8050 impl Drop for CResult_COption_TypeZDecodeErrorZ {
8051         fn drop(&mut self) {
8052                 if self.result_ok {
8053                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8054                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8055                         }
8056                 } else {
8057                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8058                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8059                         }
8060                 }
8061         }
8062 }
8063 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
8064         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
8065                 let contents = if o.result_ok {
8066                         let result = unsafe { o.contents.result };
8067                         unsafe { o.contents.result = core::ptr::null_mut() };
8068                         CResult_COption_TypeZDecodeErrorZPtr { result }
8069                 } else {
8070                         let err = unsafe { o.contents.err };
8071                         unsafe { o.contents.err = core::ptr::null_mut(); }
8072                         CResult_COption_TypeZDecodeErrorZPtr { err }
8073                 };
8074                 Self {
8075                         contents,
8076                         result_ok: o.result_ok,
8077                 }
8078         }
8079 }
8080 #[repr(C)]
8081 /// The contents of CResult_PaymentIdPaymentErrorZ
8082 pub union CResult_PaymentIdPaymentErrorZPtr {
8083         /// A pointer to the contents in the success state.
8084         /// Reading from this pointer when `result_ok` is not set is undefined.
8085         pub result: *mut crate::c_types::ThirtyTwoBytes,
8086         /// A pointer to the contents in the error state.
8087         /// Reading from this pointer when `result_ok` is set is undefined.
8088         pub err: *mut crate::lightning_invoice::payment::PaymentError,
8089 }
8090 #[repr(C)]
8091 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8092 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8093 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8094 pub struct CResult_PaymentIdPaymentErrorZ {
8095         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8096         /// `err` or `result` depending on the state of `result_ok`.
8097         pub contents: CResult_PaymentIdPaymentErrorZPtr,
8098         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8099         pub result_ok: bool,
8100 }
8101 #[no_mangle]
8102 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8103 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8104         CResult_PaymentIdPaymentErrorZ {
8105                 contents: CResult_PaymentIdPaymentErrorZPtr {
8106                         result: Box::into_raw(Box::new(o)),
8107                 },
8108                 result_ok: true,
8109         }
8110 }
8111 #[no_mangle]
8112 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8113 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8114         CResult_PaymentIdPaymentErrorZ {
8115                 contents: CResult_PaymentIdPaymentErrorZPtr {
8116                         err: Box::into_raw(Box::new(e)),
8117                 },
8118                 result_ok: false,
8119         }
8120 }
8121 /// Checks if the given object is currently in the success state
8122 #[no_mangle]
8123 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8124         o.result_ok
8125 }
8126 #[no_mangle]
8127 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8128 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8129 impl Drop for CResult_PaymentIdPaymentErrorZ {
8130         fn drop(&mut self) {
8131                 if self.result_ok {
8132                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8133                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8134                         }
8135                 } else {
8136                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8137                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8138                         }
8139                 }
8140         }
8141 }
8142 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8143         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8144                 let contents = if o.result_ok {
8145                         let result = unsafe { o.contents.result };
8146                         unsafe { o.contents.result = core::ptr::null_mut() };
8147                         CResult_PaymentIdPaymentErrorZPtr { result }
8148                 } else {
8149                         let err = unsafe { o.contents.err };
8150                         unsafe { o.contents.err = core::ptr::null_mut(); }
8151                         CResult_PaymentIdPaymentErrorZPtr { err }
8152                 };
8153                 Self {
8154                         contents,
8155                         result_ok: o.result_ok,
8156                 }
8157         }
8158 }
8159 impl Clone for CResult_PaymentIdPaymentErrorZ {
8160         fn clone(&self) -> Self {
8161                 if self.result_ok {
8162                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8163                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8164                         } }
8165                 } else {
8166                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8167                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8168                         } }
8169                 }
8170         }
8171 }
8172 #[no_mangle]
8173 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8174 /// but with all dynamically-allocated buffers duplicated in new buffers.
8175 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8176 #[repr(C)]
8177 /// The contents of CResult_SiPrefixNoneZ
8178 pub union CResult_SiPrefixNoneZPtr {
8179         /// A pointer to the contents in the success state.
8180         /// Reading from this pointer when `result_ok` is not set is undefined.
8181         pub result: *mut crate::lightning_invoice::SiPrefix,
8182         /// Note that this value is always NULL, as there are no contents in the Err variant
8183         pub err: *mut core::ffi::c_void,
8184 }
8185 #[repr(C)]
8186 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8187 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8189 pub struct CResult_SiPrefixNoneZ {
8190         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8191         /// `err` or `result` depending on the state of `result_ok`.
8192         pub contents: CResult_SiPrefixNoneZPtr,
8193         /// Whether this CResult_SiPrefixNoneZ represents a success state.
8194         pub result_ok: bool,
8195 }
8196 #[no_mangle]
8197 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8198 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8199         CResult_SiPrefixNoneZ {
8200                 contents: CResult_SiPrefixNoneZPtr {
8201                         result: Box::into_raw(Box::new(o)),
8202                 },
8203                 result_ok: true,
8204         }
8205 }
8206 #[no_mangle]
8207 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8208 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8209         CResult_SiPrefixNoneZ {
8210                 contents: CResult_SiPrefixNoneZPtr {
8211                         err: core::ptr::null_mut(),
8212                 },
8213                 result_ok: false,
8214         }
8215 }
8216 /// Checks if the given object is currently in the success state
8217 #[no_mangle]
8218 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8219         o.result_ok
8220 }
8221 #[no_mangle]
8222 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8223 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8224 impl Drop for CResult_SiPrefixNoneZ {
8225         fn drop(&mut self) {
8226                 if self.result_ok {
8227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8229                         }
8230                 } else {
8231                 }
8232         }
8233 }
8234 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8236                 let contents = if o.result_ok {
8237                         let result = unsafe { o.contents.result };
8238                         unsafe { o.contents.result = core::ptr::null_mut() };
8239                         CResult_SiPrefixNoneZPtr { result }
8240                 } else {
8241                         let _ = unsafe { Box::from_raw(o.contents.err) };
8242                         o.contents.err = core::ptr::null_mut();
8243                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8244                 };
8245                 Self {
8246                         contents,
8247                         result_ok: o.result_ok,
8248                 }
8249         }
8250 }
8251 impl Clone for CResult_SiPrefixNoneZ {
8252         fn clone(&self) -> Self {
8253                 if self.result_ok {
8254                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8255                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8256                         } }
8257                 } else {
8258                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8259                                 err: core::ptr::null_mut()
8260                         } }
8261                 }
8262         }
8263 }
8264 #[no_mangle]
8265 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8266 /// but with all dynamically-allocated buffers duplicated in new buffers.
8267 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8268 #[repr(C)]
8269 /// The contents of CResult_InvoiceNoneZ
8270 pub union CResult_InvoiceNoneZPtr {
8271         /// A pointer to the contents in the success state.
8272         /// Reading from this pointer when `result_ok` is not set is undefined.
8273         pub result: *mut crate::lightning_invoice::Invoice,
8274         /// Note that this value is always NULL, as there are no contents in the Err variant
8275         pub err: *mut core::ffi::c_void,
8276 }
8277 #[repr(C)]
8278 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8279 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8280 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8281 pub struct CResult_InvoiceNoneZ {
8282         /// The contents of this CResult_InvoiceNoneZ, accessible via either
8283         /// `err` or `result` depending on the state of `result_ok`.
8284         pub contents: CResult_InvoiceNoneZPtr,
8285         /// Whether this CResult_InvoiceNoneZ represents a success state.
8286         pub result_ok: bool,
8287 }
8288 #[no_mangle]
8289 /// Creates a new CResult_InvoiceNoneZ in the success state.
8290 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8291         CResult_InvoiceNoneZ {
8292                 contents: CResult_InvoiceNoneZPtr {
8293                         result: Box::into_raw(Box::new(o)),
8294                 },
8295                 result_ok: true,
8296         }
8297 }
8298 #[no_mangle]
8299 /// Creates a new CResult_InvoiceNoneZ in the error state.
8300 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8301         CResult_InvoiceNoneZ {
8302                 contents: CResult_InvoiceNoneZPtr {
8303                         err: core::ptr::null_mut(),
8304                 },
8305                 result_ok: false,
8306         }
8307 }
8308 /// Checks if the given object is currently in the success state
8309 #[no_mangle]
8310 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8311         o.result_ok
8312 }
8313 #[no_mangle]
8314 /// Frees any resources used by the CResult_InvoiceNoneZ.
8315 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8316 impl Drop for CResult_InvoiceNoneZ {
8317         fn drop(&mut self) {
8318                 if self.result_ok {
8319                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8320                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8321                         }
8322                 } else {
8323                 }
8324         }
8325 }
8326 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8327         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8328                 let contents = if o.result_ok {
8329                         let result = unsafe { o.contents.result };
8330                         unsafe { o.contents.result = core::ptr::null_mut() };
8331                         CResult_InvoiceNoneZPtr { result }
8332                 } else {
8333                         let _ = unsafe { Box::from_raw(o.contents.err) };
8334                         o.contents.err = core::ptr::null_mut();
8335                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8336                 };
8337                 Self {
8338                         contents,
8339                         result_ok: o.result_ok,
8340                 }
8341         }
8342 }
8343 impl Clone for CResult_InvoiceNoneZ {
8344         fn clone(&self) -> Self {
8345                 if self.result_ok {
8346                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8347                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8348                         } }
8349                 } else {
8350                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8351                                 err: core::ptr::null_mut()
8352                         } }
8353                 }
8354         }
8355 }
8356 #[no_mangle]
8357 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8358 /// but with all dynamically-allocated buffers duplicated in new buffers.
8359 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8360 #[repr(C)]
8361 /// The contents of CResult_SignedRawInvoiceNoneZ
8362 pub union CResult_SignedRawInvoiceNoneZPtr {
8363         /// A pointer to the contents in the success state.
8364         /// Reading from this pointer when `result_ok` is not set is undefined.
8365         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8366         /// Note that this value is always NULL, as there are no contents in the Err variant
8367         pub err: *mut core::ffi::c_void,
8368 }
8369 #[repr(C)]
8370 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8371 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8372 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8373 pub struct CResult_SignedRawInvoiceNoneZ {
8374         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8375         /// `err` or `result` depending on the state of `result_ok`.
8376         pub contents: CResult_SignedRawInvoiceNoneZPtr,
8377         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8378         pub result_ok: bool,
8379 }
8380 #[no_mangle]
8381 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8382 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8383         CResult_SignedRawInvoiceNoneZ {
8384                 contents: CResult_SignedRawInvoiceNoneZPtr {
8385                         result: Box::into_raw(Box::new(o)),
8386                 },
8387                 result_ok: true,
8388         }
8389 }
8390 #[no_mangle]
8391 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8392 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8393         CResult_SignedRawInvoiceNoneZ {
8394                 contents: CResult_SignedRawInvoiceNoneZPtr {
8395                         err: core::ptr::null_mut(),
8396                 },
8397                 result_ok: false,
8398         }
8399 }
8400 /// Checks if the given object is currently in the success state
8401 #[no_mangle]
8402 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8403         o.result_ok
8404 }
8405 #[no_mangle]
8406 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8407 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8408 impl Drop for CResult_SignedRawInvoiceNoneZ {
8409         fn drop(&mut self) {
8410                 if self.result_ok {
8411                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8412                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8413                         }
8414                 } else {
8415                 }
8416         }
8417 }
8418 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8419         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8420                 let contents = if o.result_ok {
8421                         let result = unsafe { o.contents.result };
8422                         unsafe { o.contents.result = core::ptr::null_mut() };
8423                         CResult_SignedRawInvoiceNoneZPtr { result }
8424                 } else {
8425                         let _ = unsafe { Box::from_raw(o.contents.err) };
8426                         o.contents.err = core::ptr::null_mut();
8427                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8428                 };
8429                 Self {
8430                         contents,
8431                         result_ok: o.result_ok,
8432                 }
8433         }
8434 }
8435 impl Clone for CResult_SignedRawInvoiceNoneZ {
8436         fn clone(&self) -> Self {
8437                 if self.result_ok {
8438                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8439                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8440                         } }
8441                 } else {
8442                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8443                                 err: core::ptr::null_mut()
8444                         } }
8445                 }
8446         }
8447 }
8448 #[no_mangle]
8449 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8450 /// but with all dynamically-allocated buffers duplicated in new buffers.
8451 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8452 #[repr(C)]
8453 /// A tuple of 3 elements. See the individual fields for the types contained.
8454 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8455         /// The element at position 0
8456         pub a: crate::lightning_invoice::RawInvoice,
8457         /// The element at position 1
8458         pub b: crate::c_types::ThirtyTwoBytes,
8459         /// The element at position 2
8460         pub c: crate::lightning_invoice::InvoiceSignature,
8461 }
8462 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8463         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8464                 Self {
8465                         a: tup.0,
8466                         b: tup.1,
8467                         c: tup.2,
8468                 }
8469         }
8470 }
8471 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8472         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8473                 (self.a, self.b, self.c)
8474         }
8475 }
8476 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8477         fn clone(&self) -> Self {
8478                 Self {
8479                         a: Clone::clone(&self.a),
8480                         b: Clone::clone(&self.b),
8481                         c: Clone::clone(&self.c),
8482                 }
8483         }
8484 }
8485 #[no_mangle]
8486 /// Creates a new tuple which has the same data as `orig`
8487 /// but with all dynamically-allocated buffers duplicated in new buffers.
8488 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8489 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8490 #[no_mangle]
8491 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 {
8492         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8493 }
8494
8495 #[no_mangle]
8496 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8497 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8498 #[repr(C)]
8499 /// The contents of CResult_PayeePubKeyErrorZ
8500 pub union CResult_PayeePubKeyErrorZPtr {
8501         /// A pointer to the contents in the success state.
8502         /// Reading from this pointer when `result_ok` is not set is undefined.
8503         pub result: *mut crate::lightning_invoice::PayeePubKey,
8504         /// A pointer to the contents in the error state.
8505         /// Reading from this pointer when `result_ok` is set is undefined.
8506         pub err: *mut crate::c_types::Secp256k1Error,
8507 }
8508 #[repr(C)]
8509 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8510 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8512 pub struct CResult_PayeePubKeyErrorZ {
8513         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8514         /// `err` or `result` depending on the state of `result_ok`.
8515         pub contents: CResult_PayeePubKeyErrorZPtr,
8516         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8517         pub result_ok: bool,
8518 }
8519 #[no_mangle]
8520 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8521 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8522         CResult_PayeePubKeyErrorZ {
8523                 contents: CResult_PayeePubKeyErrorZPtr {
8524                         result: Box::into_raw(Box::new(o)),
8525                 },
8526                 result_ok: true,
8527         }
8528 }
8529 #[no_mangle]
8530 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8531 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8532         CResult_PayeePubKeyErrorZ {
8533                 contents: CResult_PayeePubKeyErrorZPtr {
8534                         err: Box::into_raw(Box::new(e)),
8535                 },
8536                 result_ok: false,
8537         }
8538 }
8539 /// Checks if the given object is currently in the success state
8540 #[no_mangle]
8541 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8542         o.result_ok
8543 }
8544 #[no_mangle]
8545 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8546 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8547 impl Drop for CResult_PayeePubKeyErrorZ {
8548         fn drop(&mut self) {
8549                 if self.result_ok {
8550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8552                         }
8553                 } else {
8554                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8555                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8556                         }
8557                 }
8558         }
8559 }
8560 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8561         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8562                 let contents = if o.result_ok {
8563                         let result = unsafe { o.contents.result };
8564                         unsafe { o.contents.result = core::ptr::null_mut() };
8565                         CResult_PayeePubKeyErrorZPtr { result }
8566                 } else {
8567                         let err = unsafe { o.contents.err };
8568                         unsafe { o.contents.err = core::ptr::null_mut(); }
8569                         CResult_PayeePubKeyErrorZPtr { err }
8570                 };
8571                 Self {
8572                         contents,
8573                         result_ok: o.result_ok,
8574                 }
8575         }
8576 }
8577 impl Clone for CResult_PayeePubKeyErrorZ {
8578         fn clone(&self) -> Self {
8579                 if self.result_ok {
8580                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8581                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8582                         } }
8583                 } else {
8584                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8585                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8586                         } }
8587                 }
8588         }
8589 }
8590 #[no_mangle]
8591 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8592 /// but with all dynamically-allocated buffers duplicated in new buffers.
8593 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8594 #[repr(C)]
8595 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8596 /// This corresponds to std::vector in C++
8597 pub struct CVec_PrivateRouteZ {
8598         /// The elements in the array.
8599         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8600         pub data: *mut crate::lightning_invoice::PrivateRoute,
8601         /// The number of elements pointed to by `data`.
8602         pub datalen: usize
8603 }
8604 impl CVec_PrivateRouteZ {
8605         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8606                 if self.datalen == 0 { return Vec::new(); }
8607                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8608                 self.data = core::ptr::null_mut();
8609                 self.datalen = 0;
8610                 ret
8611         }
8612         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8613                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8614         }
8615 }
8616 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8617         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8618                 let datalen = v.len();
8619                 let data = Box::into_raw(v.into_boxed_slice());
8620                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8621         }
8622 }
8623 #[no_mangle]
8624 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8625 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8626 impl Drop for CVec_PrivateRouteZ {
8627         fn drop(&mut self) {
8628                 if self.datalen == 0 { return; }
8629                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8630         }
8631 }
8632 impl Clone for CVec_PrivateRouteZ {
8633         fn clone(&self) -> Self {
8634                 let mut res = Vec::new();
8635                 if self.datalen == 0 { return Self::from(res); }
8636                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8637                 Self::from(res)
8638         }
8639 }
8640 #[repr(C)]
8641 /// The contents of CResult_PositiveTimestampCreationErrorZ
8642 pub union CResult_PositiveTimestampCreationErrorZPtr {
8643         /// A pointer to the contents in the success state.
8644         /// Reading from this pointer when `result_ok` is not set is undefined.
8645         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8646         /// A pointer to the contents in the error state.
8647         /// Reading from this pointer when `result_ok` is set is undefined.
8648         pub err: *mut crate::lightning_invoice::CreationError,
8649 }
8650 #[repr(C)]
8651 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8652 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8653 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8654 pub struct CResult_PositiveTimestampCreationErrorZ {
8655         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8656         /// `err` or `result` depending on the state of `result_ok`.
8657         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8658         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8659         pub result_ok: bool,
8660 }
8661 #[no_mangle]
8662 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8663 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8664         CResult_PositiveTimestampCreationErrorZ {
8665                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8666                         result: Box::into_raw(Box::new(o)),
8667                 },
8668                 result_ok: true,
8669         }
8670 }
8671 #[no_mangle]
8672 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8673 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8674         CResult_PositiveTimestampCreationErrorZ {
8675                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8676                         err: Box::into_raw(Box::new(e)),
8677                 },
8678                 result_ok: false,
8679         }
8680 }
8681 /// Checks if the given object is currently in the success state
8682 #[no_mangle]
8683 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8684         o.result_ok
8685 }
8686 #[no_mangle]
8687 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8688 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8689 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8690         fn drop(&mut self) {
8691                 if self.result_ok {
8692                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8693                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8694                         }
8695                 } else {
8696                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8697                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8698                         }
8699                 }
8700         }
8701 }
8702 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8703         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8704                 let contents = if o.result_ok {
8705                         let result = unsafe { o.contents.result };
8706                         unsafe { o.contents.result = core::ptr::null_mut() };
8707                         CResult_PositiveTimestampCreationErrorZPtr { result }
8708                 } else {
8709                         let err = unsafe { o.contents.err };
8710                         unsafe { o.contents.err = core::ptr::null_mut(); }
8711                         CResult_PositiveTimestampCreationErrorZPtr { err }
8712                 };
8713                 Self {
8714                         contents,
8715                         result_ok: o.result_ok,
8716                 }
8717         }
8718 }
8719 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8720         fn clone(&self) -> Self {
8721                 if self.result_ok {
8722                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8723                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8724                         } }
8725                 } else {
8726                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8727                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8728                         } }
8729                 }
8730         }
8731 }
8732 #[no_mangle]
8733 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8734 /// but with all dynamically-allocated buffers duplicated in new buffers.
8735 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8736 #[repr(C)]
8737 /// The contents of CResult_NoneSemanticErrorZ
8738 pub union CResult_NoneSemanticErrorZPtr {
8739         /// Note that this value is always NULL, as there are no contents in the OK variant
8740         pub result: *mut core::ffi::c_void,
8741         /// A pointer to the contents in the error state.
8742         /// Reading from this pointer when `result_ok` is set is undefined.
8743         pub err: *mut crate::lightning_invoice::SemanticError,
8744 }
8745 #[repr(C)]
8746 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8747 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8748 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8749 pub struct CResult_NoneSemanticErrorZ {
8750         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8751         /// `err` or `result` depending on the state of `result_ok`.
8752         pub contents: CResult_NoneSemanticErrorZPtr,
8753         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8754         pub result_ok: bool,
8755 }
8756 #[no_mangle]
8757 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8758 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8759         CResult_NoneSemanticErrorZ {
8760                 contents: CResult_NoneSemanticErrorZPtr {
8761                         result: core::ptr::null_mut(),
8762                 },
8763                 result_ok: true,
8764         }
8765 }
8766 #[no_mangle]
8767 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8768 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8769         CResult_NoneSemanticErrorZ {
8770                 contents: CResult_NoneSemanticErrorZPtr {
8771                         err: Box::into_raw(Box::new(e)),
8772                 },
8773                 result_ok: false,
8774         }
8775 }
8776 /// Checks if the given object is currently in the success state
8777 #[no_mangle]
8778 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8779         o.result_ok
8780 }
8781 #[no_mangle]
8782 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8783 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8784 impl Drop for CResult_NoneSemanticErrorZ {
8785         fn drop(&mut self) {
8786                 if self.result_ok {
8787                 } else {
8788                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8789                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8790                         }
8791                 }
8792         }
8793 }
8794 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8795         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8796                 let contents = if o.result_ok {
8797                         let _ = unsafe { Box::from_raw(o.contents.result) };
8798                         o.contents.result = core::ptr::null_mut();
8799                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8800                 } else {
8801                         let err = unsafe { o.contents.err };
8802                         unsafe { o.contents.err = core::ptr::null_mut(); }
8803                         CResult_NoneSemanticErrorZPtr { err }
8804                 };
8805                 Self {
8806                         contents,
8807                         result_ok: o.result_ok,
8808                 }
8809         }
8810 }
8811 impl Clone for CResult_NoneSemanticErrorZ {
8812         fn clone(&self) -> Self {
8813                 if self.result_ok {
8814                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8815                                 result: core::ptr::null_mut()
8816                         } }
8817                 } else {
8818                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8819                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8820                         } }
8821                 }
8822         }
8823 }
8824 #[no_mangle]
8825 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8826 /// but with all dynamically-allocated buffers duplicated in new buffers.
8827 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8828 #[repr(C)]
8829 /// The contents of CResult_InvoiceSemanticErrorZ
8830 pub union CResult_InvoiceSemanticErrorZPtr {
8831         /// A pointer to the contents in the success state.
8832         /// Reading from this pointer when `result_ok` is not set is undefined.
8833         pub result: *mut crate::lightning_invoice::Invoice,
8834         /// A pointer to the contents in the error state.
8835         /// Reading from this pointer when `result_ok` is set is undefined.
8836         pub err: *mut crate::lightning_invoice::SemanticError,
8837 }
8838 #[repr(C)]
8839 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8840 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8841 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8842 pub struct CResult_InvoiceSemanticErrorZ {
8843         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8844         /// `err` or `result` depending on the state of `result_ok`.
8845         pub contents: CResult_InvoiceSemanticErrorZPtr,
8846         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8847         pub result_ok: bool,
8848 }
8849 #[no_mangle]
8850 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8851 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8852         CResult_InvoiceSemanticErrorZ {
8853                 contents: CResult_InvoiceSemanticErrorZPtr {
8854                         result: Box::into_raw(Box::new(o)),
8855                 },
8856                 result_ok: true,
8857         }
8858 }
8859 #[no_mangle]
8860 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8861 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8862         CResult_InvoiceSemanticErrorZ {
8863                 contents: CResult_InvoiceSemanticErrorZPtr {
8864                         err: Box::into_raw(Box::new(e)),
8865                 },
8866                 result_ok: false,
8867         }
8868 }
8869 /// Checks if the given object is currently in the success state
8870 #[no_mangle]
8871 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8872         o.result_ok
8873 }
8874 #[no_mangle]
8875 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8876 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8877 impl Drop for CResult_InvoiceSemanticErrorZ {
8878         fn drop(&mut self) {
8879                 if self.result_ok {
8880                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8881                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8882                         }
8883                 } else {
8884                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8885                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8886                         }
8887                 }
8888         }
8889 }
8890 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8891         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8892                 let contents = if o.result_ok {
8893                         let result = unsafe { o.contents.result };
8894                         unsafe { o.contents.result = core::ptr::null_mut() };
8895                         CResult_InvoiceSemanticErrorZPtr { result }
8896                 } else {
8897                         let err = unsafe { o.contents.err };
8898                         unsafe { o.contents.err = core::ptr::null_mut(); }
8899                         CResult_InvoiceSemanticErrorZPtr { err }
8900                 };
8901                 Self {
8902                         contents,
8903                         result_ok: o.result_ok,
8904                 }
8905         }
8906 }
8907 impl Clone for CResult_InvoiceSemanticErrorZ {
8908         fn clone(&self) -> Self {
8909                 if self.result_ok {
8910                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8911                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8912                         } }
8913                 } else {
8914                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8915                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8916                         } }
8917                 }
8918         }
8919 }
8920 #[no_mangle]
8921 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8922 /// but with all dynamically-allocated buffers duplicated in new buffers.
8923 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8924 #[repr(C)]
8925 /// The contents of CResult_DescriptionCreationErrorZ
8926 pub union CResult_DescriptionCreationErrorZPtr {
8927         /// A pointer to the contents in the success state.
8928         /// Reading from this pointer when `result_ok` is not set is undefined.
8929         pub result: *mut crate::lightning_invoice::Description,
8930         /// A pointer to the contents in the error state.
8931         /// Reading from this pointer when `result_ok` is set is undefined.
8932         pub err: *mut crate::lightning_invoice::CreationError,
8933 }
8934 #[repr(C)]
8935 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8936 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8937 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8938 pub struct CResult_DescriptionCreationErrorZ {
8939         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8940         /// `err` or `result` depending on the state of `result_ok`.
8941         pub contents: CResult_DescriptionCreationErrorZPtr,
8942         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8943         pub result_ok: bool,
8944 }
8945 #[no_mangle]
8946 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8947 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8948         CResult_DescriptionCreationErrorZ {
8949                 contents: CResult_DescriptionCreationErrorZPtr {
8950                         result: Box::into_raw(Box::new(o)),
8951                 },
8952                 result_ok: true,
8953         }
8954 }
8955 #[no_mangle]
8956 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8957 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8958         CResult_DescriptionCreationErrorZ {
8959                 contents: CResult_DescriptionCreationErrorZPtr {
8960                         err: Box::into_raw(Box::new(e)),
8961                 },
8962                 result_ok: false,
8963         }
8964 }
8965 /// Checks if the given object is currently in the success state
8966 #[no_mangle]
8967 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8968         o.result_ok
8969 }
8970 #[no_mangle]
8971 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8972 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8973 impl Drop for CResult_DescriptionCreationErrorZ {
8974         fn drop(&mut self) {
8975                 if self.result_ok {
8976                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8977                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8978                         }
8979                 } else {
8980                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8981                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8982                         }
8983                 }
8984         }
8985 }
8986 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8987         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8988                 let contents = if o.result_ok {
8989                         let result = unsafe { o.contents.result };
8990                         unsafe { o.contents.result = core::ptr::null_mut() };
8991                         CResult_DescriptionCreationErrorZPtr { result }
8992                 } else {
8993                         let err = unsafe { o.contents.err };
8994                         unsafe { o.contents.err = core::ptr::null_mut(); }
8995                         CResult_DescriptionCreationErrorZPtr { err }
8996                 };
8997                 Self {
8998                         contents,
8999                         result_ok: o.result_ok,
9000                 }
9001         }
9002 }
9003 impl Clone for CResult_DescriptionCreationErrorZ {
9004         fn clone(&self) -> Self {
9005                 if self.result_ok {
9006                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
9007                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
9008                         } }
9009                 } else {
9010                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
9011                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9012                         } }
9013                 }
9014         }
9015 }
9016 #[no_mangle]
9017 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
9018 /// but with all dynamically-allocated buffers duplicated in new buffers.
9019 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
9020 #[repr(C)]
9021 /// The contents of CResult_PrivateRouteCreationErrorZ
9022 pub union CResult_PrivateRouteCreationErrorZPtr {
9023         /// A pointer to the contents in the success state.
9024         /// Reading from this pointer when `result_ok` is not set is undefined.
9025         pub result: *mut crate::lightning_invoice::PrivateRoute,
9026         /// A pointer to the contents in the error state.
9027         /// Reading from this pointer when `result_ok` is set is undefined.
9028         pub err: *mut crate::lightning_invoice::CreationError,
9029 }
9030 #[repr(C)]
9031 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
9032 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
9033 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9034 pub struct CResult_PrivateRouteCreationErrorZ {
9035         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
9036         /// `err` or `result` depending on the state of `result_ok`.
9037         pub contents: CResult_PrivateRouteCreationErrorZPtr,
9038         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
9039         pub result_ok: bool,
9040 }
9041 #[no_mangle]
9042 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
9043 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
9044         CResult_PrivateRouteCreationErrorZ {
9045                 contents: CResult_PrivateRouteCreationErrorZPtr {
9046                         result: Box::into_raw(Box::new(o)),
9047                 },
9048                 result_ok: true,
9049         }
9050 }
9051 #[no_mangle]
9052 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
9053 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
9054         CResult_PrivateRouteCreationErrorZ {
9055                 contents: CResult_PrivateRouteCreationErrorZPtr {
9056                         err: Box::into_raw(Box::new(e)),
9057                 },
9058                 result_ok: false,
9059         }
9060 }
9061 /// Checks if the given object is currently in the success state
9062 #[no_mangle]
9063 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
9064         o.result_ok
9065 }
9066 #[no_mangle]
9067 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
9068 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
9069 impl Drop for CResult_PrivateRouteCreationErrorZ {
9070         fn drop(&mut self) {
9071                 if self.result_ok {
9072                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9073                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9074                         }
9075                 } else {
9076                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9077                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9078                         }
9079                 }
9080         }
9081 }
9082 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
9083         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
9084                 let contents = if o.result_ok {
9085                         let result = unsafe { o.contents.result };
9086                         unsafe { o.contents.result = core::ptr::null_mut() };
9087                         CResult_PrivateRouteCreationErrorZPtr { result }
9088                 } else {
9089                         let err = unsafe { o.contents.err };
9090                         unsafe { o.contents.err = core::ptr::null_mut(); }
9091                         CResult_PrivateRouteCreationErrorZPtr { err }
9092                 };
9093                 Self {
9094                         contents,
9095                         result_ok: o.result_ok,
9096                 }
9097         }
9098 }
9099 impl Clone for CResult_PrivateRouteCreationErrorZ {
9100         fn clone(&self) -> Self {
9101                 if self.result_ok {
9102                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9103                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9104                         } }
9105                 } else {
9106                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9107                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9108                         } }
9109                 }
9110         }
9111 }
9112 #[no_mangle]
9113 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9114 /// but with all dynamically-allocated buffers duplicated in new buffers.
9115 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9116 #[repr(C)]
9117 /// The contents of CResult_StringErrorZ
9118 pub union CResult_StringErrorZPtr {
9119         /// A pointer to the contents in the success state.
9120         /// Reading from this pointer when `result_ok` is not set is undefined.
9121         pub result: *mut crate::c_types::Str,
9122         /// A pointer to the contents in the error state.
9123         /// Reading from this pointer when `result_ok` is set is undefined.
9124         pub err: *mut crate::c_types::Secp256k1Error,
9125 }
9126 #[repr(C)]
9127 /// A CResult_StringErrorZ represents the result of a fallible operation,
9128 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9129 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9130 pub struct CResult_StringErrorZ {
9131         /// The contents of this CResult_StringErrorZ, accessible via either
9132         /// `err` or `result` depending on the state of `result_ok`.
9133         pub contents: CResult_StringErrorZPtr,
9134         /// Whether this CResult_StringErrorZ represents a success state.
9135         pub result_ok: bool,
9136 }
9137 #[no_mangle]
9138 /// Creates a new CResult_StringErrorZ in the success state.
9139 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9140         CResult_StringErrorZ {
9141                 contents: CResult_StringErrorZPtr {
9142                         result: Box::into_raw(Box::new(o)),
9143                 },
9144                 result_ok: true,
9145         }
9146 }
9147 #[no_mangle]
9148 /// Creates a new CResult_StringErrorZ in the error state.
9149 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9150         CResult_StringErrorZ {
9151                 contents: CResult_StringErrorZPtr {
9152                         err: Box::into_raw(Box::new(e)),
9153                 },
9154                 result_ok: false,
9155         }
9156 }
9157 /// Checks if the given object is currently in the success state
9158 #[no_mangle]
9159 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9160         o.result_ok
9161 }
9162 #[no_mangle]
9163 /// Frees any resources used by the CResult_StringErrorZ.
9164 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9165 impl Drop for CResult_StringErrorZ {
9166         fn drop(&mut self) {
9167                 if self.result_ok {
9168                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9169                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9170                         }
9171                 } else {
9172                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9173                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9174                         }
9175                 }
9176         }
9177 }
9178 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9179         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9180                 let contents = if o.result_ok {
9181                         let result = unsafe { o.contents.result };
9182                         unsafe { o.contents.result = core::ptr::null_mut() };
9183                         CResult_StringErrorZPtr { result }
9184                 } else {
9185                         let err = unsafe { o.contents.err };
9186                         unsafe { o.contents.err = core::ptr::null_mut(); }
9187                         CResult_StringErrorZPtr { err }
9188                 };
9189                 Self {
9190                         contents,
9191                         result_ok: o.result_ok,
9192                 }
9193         }
9194 }
9195 #[repr(C)]
9196 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9197 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9198         /// A pointer to the contents in the success state.
9199         /// Reading from this pointer when `result_ok` is not set is undefined.
9200         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9201         /// A pointer to the contents in the error state.
9202         /// Reading from this pointer when `result_ok` is set is undefined.
9203         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9204 }
9205 #[repr(C)]
9206 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9207 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9208 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9209 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9210         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9211         /// `err` or `result` depending on the state of `result_ok`.
9212         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9213         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9214         pub result_ok: bool,
9215 }
9216 #[no_mangle]
9217 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9218 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9219         CResult_ChannelMonitorUpdateDecodeErrorZ {
9220                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9221                         result: Box::into_raw(Box::new(o)),
9222                 },
9223                 result_ok: true,
9224         }
9225 }
9226 #[no_mangle]
9227 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9228 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9229         CResult_ChannelMonitorUpdateDecodeErrorZ {
9230                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9231                         err: Box::into_raw(Box::new(e)),
9232                 },
9233                 result_ok: false,
9234         }
9235 }
9236 /// Checks if the given object is currently in the success state
9237 #[no_mangle]
9238 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9239         o.result_ok
9240 }
9241 #[no_mangle]
9242 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9243 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9244 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9245         fn drop(&mut self) {
9246                 if self.result_ok {
9247                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9248                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9249                         }
9250                 } else {
9251                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9252                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9253                         }
9254                 }
9255         }
9256 }
9257 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9258         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9259                 let contents = if o.result_ok {
9260                         let result = unsafe { o.contents.result };
9261                         unsafe { o.contents.result = core::ptr::null_mut() };
9262                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9263                 } else {
9264                         let err = unsafe { o.contents.err };
9265                         unsafe { o.contents.err = core::ptr::null_mut(); }
9266                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9267                 };
9268                 Self {
9269                         contents,
9270                         result_ok: o.result_ok,
9271                 }
9272         }
9273 }
9274 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9275         fn clone(&self) -> Self {
9276                 if self.result_ok {
9277                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9278                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9279                         } }
9280                 } else {
9281                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9282                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9283                         } }
9284                 }
9285         }
9286 }
9287 #[no_mangle]
9288 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9289 /// but with all dynamically-allocated buffers duplicated in new buffers.
9290 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9291 #[repr(C)]
9292 #[derive(Clone)]
9293 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9294 pub enum COption_MonitorEventZ {
9295         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9296         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9297         /// When we're in this state, this COption_MonitorEventZ contains nothing
9298         None
9299 }
9300 impl COption_MonitorEventZ {
9301         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9302                 if let Self::None = self { false } else { true }
9303         }
9304         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9305                 !self.is_some()
9306         }
9307         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9308                 if let Self::Some(v) = self { v } else { unreachable!() }
9309         }
9310 }
9311 #[no_mangle]
9312 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9313 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9314         COption_MonitorEventZ::Some(o)
9315 }
9316 #[no_mangle]
9317 /// Constructs a new COption_MonitorEventZ containing nothing
9318 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9319         COption_MonitorEventZ::None
9320 }
9321 #[no_mangle]
9322 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9323 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9324 #[no_mangle]
9325 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9326 /// but with all dynamically-allocated buffers duplicated in new buffers.
9327 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9328 #[repr(C)]
9329 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9330 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9331         /// A pointer to the contents in the success state.
9332         /// Reading from this pointer when `result_ok` is not set is undefined.
9333         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9334         /// A pointer to the contents in the error state.
9335         /// Reading from this pointer when `result_ok` is set is undefined.
9336         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9337 }
9338 #[repr(C)]
9339 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9340 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9341 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9342 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9343         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9344         /// `err` or `result` depending on the state of `result_ok`.
9345         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9346         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9347         pub result_ok: bool,
9348 }
9349 #[no_mangle]
9350 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9351 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9352         CResult_COption_MonitorEventZDecodeErrorZ {
9353                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9354                         result: Box::into_raw(Box::new(o)),
9355                 },
9356                 result_ok: true,
9357         }
9358 }
9359 #[no_mangle]
9360 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9361 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9362         CResult_COption_MonitorEventZDecodeErrorZ {
9363                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9364                         err: Box::into_raw(Box::new(e)),
9365                 },
9366                 result_ok: false,
9367         }
9368 }
9369 /// Checks if the given object is currently in the success state
9370 #[no_mangle]
9371 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9372         o.result_ok
9373 }
9374 #[no_mangle]
9375 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9376 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9377 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9378         fn drop(&mut self) {
9379                 if self.result_ok {
9380                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9381                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9382                         }
9383                 } else {
9384                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9385                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9386                         }
9387                 }
9388         }
9389 }
9390 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9391         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9392                 let contents = if o.result_ok {
9393                         let result = unsafe { o.contents.result };
9394                         unsafe { o.contents.result = core::ptr::null_mut() };
9395                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9396                 } else {
9397                         let err = unsafe { o.contents.err };
9398                         unsafe { o.contents.err = core::ptr::null_mut(); }
9399                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9400                 };
9401                 Self {
9402                         contents,
9403                         result_ok: o.result_ok,
9404                 }
9405         }
9406 }
9407 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9408         fn clone(&self) -> Self {
9409                 if self.result_ok {
9410                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9411                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9412                         } }
9413                 } else {
9414                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9415                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9416                         } }
9417                 }
9418         }
9419 }
9420 #[no_mangle]
9421 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9422 /// but with all dynamically-allocated buffers duplicated in new buffers.
9423 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9424 #[repr(C)]
9425 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9426 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9427         /// A pointer to the contents in the success state.
9428         /// Reading from this pointer when `result_ok` is not set is undefined.
9429         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9430         /// A pointer to the contents in the error state.
9431         /// Reading from this pointer when `result_ok` is set is undefined.
9432         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9433 }
9434 #[repr(C)]
9435 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9436 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9437 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9438 pub struct CResult_HTLCUpdateDecodeErrorZ {
9439         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9440         /// `err` or `result` depending on the state of `result_ok`.
9441         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9442         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9443         pub result_ok: bool,
9444 }
9445 #[no_mangle]
9446 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9447 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9448         CResult_HTLCUpdateDecodeErrorZ {
9449                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9450                         result: Box::into_raw(Box::new(o)),
9451                 },
9452                 result_ok: true,
9453         }
9454 }
9455 #[no_mangle]
9456 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9457 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9458         CResult_HTLCUpdateDecodeErrorZ {
9459                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9460                         err: Box::into_raw(Box::new(e)),
9461                 },
9462                 result_ok: false,
9463         }
9464 }
9465 /// Checks if the given object is currently in the success state
9466 #[no_mangle]
9467 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9468         o.result_ok
9469 }
9470 #[no_mangle]
9471 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9472 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9473 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9474         fn drop(&mut self) {
9475                 if self.result_ok {
9476                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9477                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9478                         }
9479                 } else {
9480                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9481                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9482                         }
9483                 }
9484         }
9485 }
9486 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9487         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9488                 let contents = if o.result_ok {
9489                         let result = unsafe { o.contents.result };
9490                         unsafe { o.contents.result = core::ptr::null_mut() };
9491                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9492                 } else {
9493                         let err = unsafe { o.contents.err };
9494                         unsafe { o.contents.err = core::ptr::null_mut(); }
9495                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9496                 };
9497                 Self {
9498                         contents,
9499                         result_ok: o.result_ok,
9500                 }
9501         }
9502 }
9503 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9504         fn clone(&self) -> Self {
9505                 if self.result_ok {
9506                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9507                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9508                         } }
9509                 } else {
9510                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9511                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9512                         } }
9513                 }
9514         }
9515 }
9516 #[no_mangle]
9517 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9518 /// but with all dynamically-allocated buffers duplicated in new buffers.
9519 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9520 #[repr(C)]
9521 /// A tuple of 2 elements. See the individual fields for the types contained.
9522 pub struct C2Tuple_OutPointScriptZ {
9523         /// The element at position 0
9524         pub a: crate::lightning::chain::transaction::OutPoint,
9525         /// The element at position 1
9526         pub b: crate::c_types::derived::CVec_u8Z,
9527 }
9528 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9529         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9530                 Self {
9531                         a: tup.0,
9532                         b: tup.1,
9533                 }
9534         }
9535 }
9536 impl C2Tuple_OutPointScriptZ {
9537         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9538                 (self.a, self.b)
9539         }
9540 }
9541 impl Clone for C2Tuple_OutPointScriptZ {
9542         fn clone(&self) -> Self {
9543                 Self {
9544                         a: Clone::clone(&self.a),
9545                         b: Clone::clone(&self.b),
9546                 }
9547         }
9548 }
9549 #[no_mangle]
9550 /// Creates a new tuple which has the same data as `orig`
9551 /// but with all dynamically-allocated buffers duplicated in new buffers.
9552 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9553 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9554 #[no_mangle]
9555 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9556         C2Tuple_OutPointScriptZ { a, b, }
9557 }
9558
9559 #[no_mangle]
9560 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9561 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9562 #[repr(C)]
9563 /// A tuple of 2 elements. See the individual fields for the types contained.
9564 pub struct C2Tuple_u32ScriptZ {
9565         /// The element at position 0
9566         pub a: u32,
9567         /// The element at position 1
9568         pub b: crate::c_types::derived::CVec_u8Z,
9569 }
9570 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9571         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9572                 Self {
9573                         a: tup.0,
9574                         b: tup.1,
9575                 }
9576         }
9577 }
9578 impl C2Tuple_u32ScriptZ {
9579         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9580                 (self.a, self.b)
9581         }
9582 }
9583 impl Clone for C2Tuple_u32ScriptZ {
9584         fn clone(&self) -> Self {
9585                 Self {
9586                         a: Clone::clone(&self.a),
9587                         b: Clone::clone(&self.b),
9588                 }
9589         }
9590 }
9591 #[no_mangle]
9592 /// Creates a new tuple which has the same data as `orig`
9593 /// but with all dynamically-allocated buffers duplicated in new buffers.
9594 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9595 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9596 #[no_mangle]
9597 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9598         C2Tuple_u32ScriptZ { a, b, }
9599 }
9600
9601 #[no_mangle]
9602 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9603 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9604 #[repr(C)]
9605 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9606 /// This corresponds to std::vector in C++
9607 pub struct CVec_C2Tuple_u32ScriptZZ {
9608         /// The elements in the array.
9609         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9610         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9611         /// The number of elements pointed to by `data`.
9612         pub datalen: usize
9613 }
9614 impl CVec_C2Tuple_u32ScriptZZ {
9615         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9616                 if self.datalen == 0 { return Vec::new(); }
9617                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9618                 self.data = core::ptr::null_mut();
9619                 self.datalen = 0;
9620                 ret
9621         }
9622         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9623                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9624         }
9625 }
9626 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9627         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9628                 let datalen = v.len();
9629                 let data = Box::into_raw(v.into_boxed_slice());
9630                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9631         }
9632 }
9633 #[no_mangle]
9634 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9635 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9636 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9637         fn drop(&mut self) {
9638                 if self.datalen == 0 { return; }
9639                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9640         }
9641 }
9642 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9643         fn clone(&self) -> Self {
9644                 let mut res = Vec::new();
9645                 if self.datalen == 0 { return Self::from(res); }
9646                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9647                 Self::from(res)
9648         }
9649 }
9650 #[repr(C)]
9651 /// A tuple of 2 elements. See the individual fields for the types contained.
9652 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9653         /// The element at position 0
9654         pub a: crate::c_types::ThirtyTwoBytes,
9655         /// The element at position 1
9656         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9657 }
9658 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9659         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9660                 Self {
9661                         a: tup.0,
9662                         b: tup.1,
9663                 }
9664         }
9665 }
9666 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9667         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9668                 (self.a, self.b)
9669         }
9670 }
9671 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9672         fn clone(&self) -> Self {
9673                 Self {
9674                         a: Clone::clone(&self.a),
9675                         b: Clone::clone(&self.b),
9676                 }
9677         }
9678 }
9679 #[no_mangle]
9680 /// Creates a new tuple which has the same data as `orig`
9681 /// but with all dynamically-allocated buffers duplicated in new buffers.
9682 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9683 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9684 #[no_mangle]
9685 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 {
9686         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9687 }
9688
9689 #[no_mangle]
9690 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9691 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9692 #[repr(C)]
9693 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9694 /// This corresponds to std::vector in C++
9695 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9696         /// The elements in the array.
9697         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9698         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9699         /// The number of elements pointed to by `data`.
9700         pub datalen: usize
9701 }
9702 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9703         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9704                 if self.datalen == 0 { return Vec::new(); }
9705                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9706                 self.data = core::ptr::null_mut();
9707                 self.datalen = 0;
9708                 ret
9709         }
9710         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9711                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9712         }
9713 }
9714 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9715         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9716                 let datalen = v.len();
9717                 let data = Box::into_raw(v.into_boxed_slice());
9718                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9719         }
9720 }
9721 #[no_mangle]
9722 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9723 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9724 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9725         fn drop(&mut self) {
9726                 if self.datalen == 0 { return; }
9727                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9728         }
9729 }
9730 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9731         fn clone(&self) -> Self {
9732                 let mut res = Vec::new();
9733                 if self.datalen == 0 { return Self::from(res); }
9734                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9735                 Self::from(res)
9736         }
9737 }
9738 #[repr(C)]
9739 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9740 /// This corresponds to std::vector in C++
9741 pub struct CVec_EventZ {
9742         /// The elements in the array.
9743         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9744         pub data: *mut crate::lightning::util::events::Event,
9745         /// The number of elements pointed to by `data`.
9746         pub datalen: usize
9747 }
9748 impl CVec_EventZ {
9749         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9750                 if self.datalen == 0 { return Vec::new(); }
9751                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9752                 self.data = core::ptr::null_mut();
9753                 self.datalen = 0;
9754                 ret
9755         }
9756         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9757                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9758         }
9759 }
9760 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9761         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9762                 let datalen = v.len();
9763                 let data = Box::into_raw(v.into_boxed_slice());
9764                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9765         }
9766 }
9767 #[no_mangle]
9768 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9769 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9770 impl Drop for CVec_EventZ {
9771         fn drop(&mut self) {
9772                 if self.datalen == 0 { return; }
9773                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9774         }
9775 }
9776 impl Clone for CVec_EventZ {
9777         fn clone(&self) -> Self {
9778                 let mut res = Vec::new();
9779                 if self.datalen == 0 { return Self::from(res); }
9780                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9781                 Self::from(res)
9782         }
9783 }
9784 #[repr(C)]
9785 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9786 /// This corresponds to std::vector in C++
9787 pub struct CVec_TransactionZ {
9788         /// The elements in the array.
9789         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9790         pub data: *mut crate::c_types::Transaction,
9791         /// The number of elements pointed to by `data`.
9792         pub datalen: usize
9793 }
9794 impl CVec_TransactionZ {
9795         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9796                 if self.datalen == 0 { return Vec::new(); }
9797                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9798                 self.data = core::ptr::null_mut();
9799                 self.datalen = 0;
9800                 ret
9801         }
9802         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9803                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9804         }
9805 }
9806 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9807         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9808                 let datalen = v.len();
9809                 let data = Box::into_raw(v.into_boxed_slice());
9810                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9811         }
9812 }
9813 #[no_mangle]
9814 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9815 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9816 impl Drop for CVec_TransactionZ {
9817         fn drop(&mut self) {
9818                 if self.datalen == 0 { return; }
9819                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9820         }
9821 }
9822 impl Clone for CVec_TransactionZ {
9823         fn clone(&self) -> Self {
9824                 let mut res = Vec::new();
9825                 if self.datalen == 0 { return Self::from(res); }
9826                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9827                 Self::from(res)
9828         }
9829 }
9830 #[repr(C)]
9831 /// A tuple of 2 elements. See the individual fields for the types contained.
9832 pub struct C2Tuple_u32TxOutZ {
9833         /// The element at position 0
9834         pub a: u32,
9835         /// The element at position 1
9836         pub b: crate::c_types::TxOut,
9837 }
9838 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9839         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9840                 Self {
9841                         a: tup.0,
9842                         b: tup.1,
9843                 }
9844         }
9845 }
9846 impl C2Tuple_u32TxOutZ {
9847         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9848                 (self.a, self.b)
9849         }
9850 }
9851 impl Clone for C2Tuple_u32TxOutZ {
9852         fn clone(&self) -> Self {
9853                 Self {
9854                         a: Clone::clone(&self.a),
9855                         b: Clone::clone(&self.b),
9856                 }
9857         }
9858 }
9859 #[no_mangle]
9860 /// Creates a new tuple which has the same data as `orig`
9861 /// but with all dynamically-allocated buffers duplicated in new buffers.
9862 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9863 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9864 #[no_mangle]
9865 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9866         C2Tuple_u32TxOutZ { a, b, }
9867 }
9868
9869 #[no_mangle]
9870 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9871 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9872 #[repr(C)]
9873 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9874 /// This corresponds to std::vector in C++
9875 pub struct CVec_C2Tuple_u32TxOutZZ {
9876         /// The elements in the array.
9877         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9878         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9879         /// The number of elements pointed to by `data`.
9880         pub datalen: usize
9881 }
9882 impl CVec_C2Tuple_u32TxOutZZ {
9883         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9884                 if self.datalen == 0 { return Vec::new(); }
9885                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9886                 self.data = core::ptr::null_mut();
9887                 self.datalen = 0;
9888                 ret
9889         }
9890         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9891                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9892         }
9893 }
9894 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9895         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9896                 let datalen = v.len();
9897                 let data = Box::into_raw(v.into_boxed_slice());
9898                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9899         }
9900 }
9901 #[no_mangle]
9902 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9903 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9904 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9905         fn drop(&mut self) {
9906                 if self.datalen == 0 { return; }
9907                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9908         }
9909 }
9910 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9911         fn clone(&self) -> Self {
9912                 let mut res = Vec::new();
9913                 if self.datalen == 0 { return Self::from(res); }
9914                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9915                 Self::from(res)
9916         }
9917 }
9918 #[repr(C)]
9919 /// A tuple of 2 elements. See the individual fields for the types contained.
9920 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9921         /// The element at position 0
9922         pub a: crate::c_types::ThirtyTwoBytes,
9923         /// The element at position 1
9924         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9925 }
9926 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9927         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9928                 Self {
9929                         a: tup.0,
9930                         b: tup.1,
9931                 }
9932         }
9933 }
9934 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9935         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9936                 (self.a, self.b)
9937         }
9938 }
9939 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9940         fn clone(&self) -> Self {
9941                 Self {
9942                         a: Clone::clone(&self.a),
9943                         b: Clone::clone(&self.b),
9944                 }
9945         }
9946 }
9947 #[no_mangle]
9948 /// Creates a new tuple which has the same data as `orig`
9949 /// but with all dynamically-allocated buffers duplicated in new buffers.
9950 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9951 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9952 #[no_mangle]
9953 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 {
9954         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9955 }
9956
9957 #[no_mangle]
9958 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9959 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9960 #[repr(C)]
9961 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9962 /// This corresponds to std::vector in C++
9963 pub struct CVec_TransactionOutputsZ {
9964         /// The elements in the array.
9965         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9966         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9967         /// The number of elements pointed to by `data`.
9968         pub datalen: usize
9969 }
9970 impl CVec_TransactionOutputsZ {
9971         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9972                 if self.datalen == 0 { return Vec::new(); }
9973                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9974                 self.data = core::ptr::null_mut();
9975                 self.datalen = 0;
9976                 ret
9977         }
9978         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9979                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9980         }
9981 }
9982 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9983         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9984                 let datalen = v.len();
9985                 let data = Box::into_raw(v.into_boxed_slice());
9986                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9987         }
9988 }
9989 #[no_mangle]
9990 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9991 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9992 impl Drop for CVec_TransactionOutputsZ {
9993         fn drop(&mut self) {
9994                 if self.datalen == 0 { return; }
9995                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9996         }
9997 }
9998 impl Clone for CVec_TransactionOutputsZ {
9999         fn clone(&self) -> Self {
10000                 let mut res = Vec::new();
10001                 if self.datalen == 0 { return Self::from(res); }
10002                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10003                 Self::from(res)
10004         }
10005 }
10006 #[repr(C)]
10007 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
10008 /// This corresponds to std::vector in C++
10009 pub struct CVec_BalanceZ {
10010         /// The elements in the array.
10011         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10012         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
10013         /// The number of elements pointed to by `data`.
10014         pub datalen: usize
10015 }
10016 impl CVec_BalanceZ {
10017         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
10018                 if self.datalen == 0 { return Vec::new(); }
10019                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10020                 self.data = core::ptr::null_mut();
10021                 self.datalen = 0;
10022                 ret
10023         }
10024         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
10025                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10026         }
10027 }
10028 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
10029         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
10030                 let datalen = v.len();
10031                 let data = Box::into_raw(v.into_boxed_slice());
10032                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10033         }
10034 }
10035 #[no_mangle]
10036 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10037 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
10038 impl Drop for CVec_BalanceZ {
10039         fn drop(&mut self) {
10040                 if self.datalen == 0 { return; }
10041                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10042         }
10043 }
10044 impl Clone for CVec_BalanceZ {
10045         fn clone(&self) -> Self {
10046                 let mut res = Vec::new();
10047                 if self.datalen == 0 { return Self::from(res); }
10048                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10049                 Self::from(res)
10050         }
10051 }
10052 #[repr(C)]
10053 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
10054 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10055         /// A pointer to the contents in the success state.
10056         /// Reading from this pointer when `result_ok` is not set is undefined.
10057         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
10058         /// A pointer to the contents in the error state.
10059         /// Reading from this pointer when `result_ok` is set is undefined.
10060         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10061 }
10062 #[repr(C)]
10063 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
10064 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10065 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10066 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10067         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
10068         /// `err` or `result` depending on the state of `result_ok`.
10069         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
10070         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
10071         pub result_ok: bool,
10072 }
10073 #[no_mangle]
10074 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10075 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10076         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10077                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10078                         result: Box::into_raw(Box::new(o)),
10079                 },
10080                 result_ok: true,
10081         }
10082 }
10083 #[no_mangle]
10084 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10085 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10086         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10087                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10088                         err: Box::into_raw(Box::new(e)),
10089                 },
10090                 result_ok: false,
10091         }
10092 }
10093 /// Checks if the given object is currently in the success state
10094 #[no_mangle]
10095 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10096         o.result_ok
10097 }
10098 #[no_mangle]
10099 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10100 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10101 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10102         fn drop(&mut self) {
10103                 if self.result_ok {
10104                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10105                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10106                         }
10107                 } else {
10108                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10109                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10110                         }
10111                 }
10112         }
10113 }
10114 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10115         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10116                 let contents = if o.result_ok {
10117                         let result = unsafe { o.contents.result };
10118                         unsafe { o.contents.result = core::ptr::null_mut() };
10119                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10120                 } else {
10121                         let err = unsafe { o.contents.err };
10122                         unsafe { o.contents.err = core::ptr::null_mut(); }
10123                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10124                 };
10125                 Self {
10126                         contents,
10127                         result_ok: o.result_ok,
10128                 }
10129         }
10130 }
10131 #[repr(C)]
10132 /// The contents of CResult_NoneLightningErrorZ
10133 pub union CResult_NoneLightningErrorZPtr {
10134         /// Note that this value is always NULL, as there are no contents in the OK variant
10135         pub result: *mut core::ffi::c_void,
10136         /// A pointer to the contents in the error state.
10137         /// Reading from this pointer when `result_ok` is set is undefined.
10138         pub err: *mut crate::lightning::ln::msgs::LightningError,
10139 }
10140 #[repr(C)]
10141 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10142 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10144 pub struct CResult_NoneLightningErrorZ {
10145         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10146         /// `err` or `result` depending on the state of `result_ok`.
10147         pub contents: CResult_NoneLightningErrorZPtr,
10148         /// Whether this CResult_NoneLightningErrorZ represents a success state.
10149         pub result_ok: bool,
10150 }
10151 #[no_mangle]
10152 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10153 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10154         CResult_NoneLightningErrorZ {
10155                 contents: CResult_NoneLightningErrorZPtr {
10156                         result: core::ptr::null_mut(),
10157                 },
10158                 result_ok: true,
10159         }
10160 }
10161 #[no_mangle]
10162 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10163 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10164         CResult_NoneLightningErrorZ {
10165                 contents: CResult_NoneLightningErrorZPtr {
10166                         err: Box::into_raw(Box::new(e)),
10167                 },
10168                 result_ok: false,
10169         }
10170 }
10171 /// Checks if the given object is currently in the success state
10172 #[no_mangle]
10173 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10174         o.result_ok
10175 }
10176 #[no_mangle]
10177 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10178 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10179 impl Drop for CResult_NoneLightningErrorZ {
10180         fn drop(&mut self) {
10181                 if self.result_ok {
10182                 } else {
10183                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10184                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10185                         }
10186                 }
10187         }
10188 }
10189 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10190         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10191                 let contents = if o.result_ok {
10192                         let _ = unsafe { Box::from_raw(o.contents.result) };
10193                         o.contents.result = core::ptr::null_mut();
10194                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10195                 } else {
10196                         let err = unsafe { o.contents.err };
10197                         unsafe { o.contents.err = core::ptr::null_mut(); }
10198                         CResult_NoneLightningErrorZPtr { err }
10199                 };
10200                 Self {
10201                         contents,
10202                         result_ok: o.result_ok,
10203                 }
10204         }
10205 }
10206 impl Clone for CResult_NoneLightningErrorZ {
10207         fn clone(&self) -> Self {
10208                 if self.result_ok {
10209                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10210                                 result: core::ptr::null_mut()
10211                         } }
10212                 } else {
10213                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10214                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10215                         } }
10216                 }
10217         }
10218 }
10219 #[no_mangle]
10220 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10221 /// but with all dynamically-allocated buffers duplicated in new buffers.
10222 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10223 #[repr(C)]
10224 /// A tuple of 2 elements. See the individual fields for the types contained.
10225 pub struct C2Tuple_PublicKeyTypeZ {
10226         /// The element at position 0
10227         pub a: crate::c_types::PublicKey,
10228         /// The element at position 1
10229         pub b: crate::lightning::ln::wire::Type,
10230 }
10231 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10232         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10233                 Self {
10234                         a: tup.0,
10235                         b: tup.1,
10236                 }
10237         }
10238 }
10239 impl C2Tuple_PublicKeyTypeZ {
10240         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10241                 (self.a, self.b)
10242         }
10243 }
10244 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10245 #[no_mangle]
10246 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10247         C2Tuple_PublicKeyTypeZ { a, b, }
10248 }
10249
10250 #[no_mangle]
10251 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10252 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10253 #[repr(C)]
10254 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10255 /// This corresponds to std::vector in C++
10256 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10257         /// The elements in the array.
10258         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10259         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10260         /// The number of elements pointed to by `data`.
10261         pub datalen: usize
10262 }
10263 impl CVec_C2Tuple_PublicKeyTypeZZ {
10264         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10265                 if self.datalen == 0 { return Vec::new(); }
10266                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10267                 self.data = core::ptr::null_mut();
10268                 self.datalen = 0;
10269                 ret
10270         }
10271         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10272                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10273         }
10274 }
10275 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10276         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10277                 let datalen = v.len();
10278                 let data = Box::into_raw(v.into_boxed_slice());
10279                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10280         }
10281 }
10282 #[no_mangle]
10283 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10284 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10285 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10286         fn drop(&mut self) {
10287                 if self.datalen == 0 { return; }
10288                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10289         }
10290 }
10291 #[repr(C)]
10292 /// The contents of CResult_boolLightningErrorZ
10293 pub union CResult_boolLightningErrorZPtr {
10294         /// A pointer to the contents in the success state.
10295         /// Reading from this pointer when `result_ok` is not set is undefined.
10296         pub result: *mut bool,
10297         /// A pointer to the contents in the error state.
10298         /// Reading from this pointer when `result_ok` is set is undefined.
10299         pub err: *mut crate::lightning::ln::msgs::LightningError,
10300 }
10301 #[repr(C)]
10302 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10303 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10304 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10305 pub struct CResult_boolLightningErrorZ {
10306         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10307         /// `err` or `result` depending on the state of `result_ok`.
10308         pub contents: CResult_boolLightningErrorZPtr,
10309         /// Whether this CResult_boolLightningErrorZ represents a success state.
10310         pub result_ok: bool,
10311 }
10312 #[no_mangle]
10313 /// Creates a new CResult_boolLightningErrorZ in the success state.
10314 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10315         CResult_boolLightningErrorZ {
10316                 contents: CResult_boolLightningErrorZPtr {
10317                         result: Box::into_raw(Box::new(o)),
10318                 },
10319                 result_ok: true,
10320         }
10321 }
10322 #[no_mangle]
10323 /// Creates a new CResult_boolLightningErrorZ in the error state.
10324 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10325         CResult_boolLightningErrorZ {
10326                 contents: CResult_boolLightningErrorZPtr {
10327                         err: Box::into_raw(Box::new(e)),
10328                 },
10329                 result_ok: false,
10330         }
10331 }
10332 /// Checks if the given object is currently in the success state
10333 #[no_mangle]
10334 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10335         o.result_ok
10336 }
10337 #[no_mangle]
10338 /// Frees any resources used by the CResult_boolLightningErrorZ.
10339 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10340 impl Drop for CResult_boolLightningErrorZ {
10341         fn drop(&mut self) {
10342                 if self.result_ok {
10343                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10344                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10345                         }
10346                 } else {
10347                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10348                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10349                         }
10350                 }
10351         }
10352 }
10353 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10354         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10355                 let contents = if o.result_ok {
10356                         let result = unsafe { o.contents.result };
10357                         unsafe { o.contents.result = core::ptr::null_mut() };
10358                         CResult_boolLightningErrorZPtr { result }
10359                 } else {
10360                         let err = unsafe { o.contents.err };
10361                         unsafe { o.contents.err = core::ptr::null_mut(); }
10362                         CResult_boolLightningErrorZPtr { err }
10363                 };
10364                 Self {
10365                         contents,
10366                         result_ok: o.result_ok,
10367                 }
10368         }
10369 }
10370 impl Clone for CResult_boolLightningErrorZ {
10371         fn clone(&self) -> Self {
10372                 if self.result_ok {
10373                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10374                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10375                         } }
10376                 } else {
10377                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10378                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10379                         } }
10380                 }
10381         }
10382 }
10383 #[no_mangle]
10384 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10385 /// but with all dynamically-allocated buffers duplicated in new buffers.
10386 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10387 #[repr(C)]
10388 /// A tuple of 3 elements. See the individual fields for the types contained.
10389 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10390         /// The element at position 0
10391         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10392         /// The element at position 1
10393         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10394         /// The element at position 2
10395         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10396 }
10397 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10398         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10399                 Self {
10400                         a: tup.0,
10401                         b: tup.1,
10402                         c: tup.2,
10403                 }
10404         }
10405 }
10406 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10407         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10408                 (self.a, self.b, self.c)
10409         }
10410 }
10411 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10412         fn clone(&self) -> Self {
10413                 Self {
10414                         a: Clone::clone(&self.a),
10415                         b: Clone::clone(&self.b),
10416                         c: Clone::clone(&self.c),
10417                 }
10418         }
10419 }
10420 #[no_mangle]
10421 /// Creates a new tuple which has the same data as `orig`
10422 /// but with all dynamically-allocated buffers duplicated in new buffers.
10423 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10424 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10425 #[no_mangle]
10426 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 {
10427         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10428 }
10429
10430 #[no_mangle]
10431 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10432 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10433 #[repr(C)]
10434 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10435 /// This corresponds to std::vector in C++
10436 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10437         /// The elements in the array.
10438         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10439         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10440         /// The number of elements pointed to by `data`.
10441         pub datalen: usize
10442 }
10443 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10444         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10445                 if self.datalen == 0 { return Vec::new(); }
10446                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10447                 self.data = core::ptr::null_mut();
10448                 self.datalen = 0;
10449                 ret
10450         }
10451         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10452                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10453         }
10454 }
10455 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10456         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10457                 let datalen = v.len();
10458                 let data = Box::into_raw(v.into_boxed_slice());
10459                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10460         }
10461 }
10462 #[no_mangle]
10463 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10464 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10465 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10466         fn drop(&mut self) {
10467                 if self.datalen == 0 { return; }
10468                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10469         }
10470 }
10471 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10472         fn clone(&self) -> Self {
10473                 let mut res = Vec::new();
10474                 if self.datalen == 0 { return Self::from(res); }
10475                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10476                 Self::from(res)
10477         }
10478 }
10479 #[repr(C)]
10480 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10481 /// This corresponds to std::vector in C++
10482 pub struct CVec_NodeAnnouncementZ {
10483         /// The elements in the array.
10484         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10485         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10486         /// The number of elements pointed to by `data`.
10487         pub datalen: usize
10488 }
10489 impl CVec_NodeAnnouncementZ {
10490         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10491                 if self.datalen == 0 { return Vec::new(); }
10492                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10493                 self.data = core::ptr::null_mut();
10494                 self.datalen = 0;
10495                 ret
10496         }
10497         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10498                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10499         }
10500 }
10501 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10502         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10503                 let datalen = v.len();
10504                 let data = Box::into_raw(v.into_boxed_slice());
10505                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10506         }
10507 }
10508 #[no_mangle]
10509 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10510 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10511 impl Drop for CVec_NodeAnnouncementZ {
10512         fn drop(&mut self) {
10513                 if self.datalen == 0 { return; }
10514                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10515         }
10516 }
10517 impl Clone for CVec_NodeAnnouncementZ {
10518         fn clone(&self) -> Self {
10519                 let mut res = Vec::new();
10520                 if self.datalen == 0 { return Self::from(res); }
10521                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10522                 Self::from(res)
10523         }
10524 }
10525 #[repr(C)]
10526 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10527 /// This corresponds to std::vector in C++
10528 pub struct CVec_PublicKeyZ {
10529         /// The elements in the array.
10530         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10531         pub data: *mut crate::c_types::PublicKey,
10532         /// The number of elements pointed to by `data`.
10533         pub datalen: usize
10534 }
10535 impl CVec_PublicKeyZ {
10536         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10537                 if self.datalen == 0 { return Vec::new(); }
10538                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10539                 self.data = core::ptr::null_mut();
10540                 self.datalen = 0;
10541                 ret
10542         }
10543         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10544                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10545         }
10546 }
10547 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10548         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10549                 let datalen = v.len();
10550                 let data = Box::into_raw(v.into_boxed_slice());
10551                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10552         }
10553 }
10554 #[no_mangle]
10555 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10556 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10557 impl Drop for CVec_PublicKeyZ {
10558         fn drop(&mut self) {
10559                 if self.datalen == 0 { return; }
10560                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10561         }
10562 }
10563 impl Clone for CVec_PublicKeyZ {
10564         fn clone(&self) -> Self {
10565                 let mut res = Vec::new();
10566                 if self.datalen == 0 { return Self::from(res); }
10567                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10568                 Self::from(res)
10569         }
10570 }
10571 #[repr(C)]
10572 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10573 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10574         /// A pointer to the contents in the success state.
10575         /// Reading from this pointer when `result_ok` is not set is undefined.
10576         pub result: *mut crate::c_types::derived::CVec_u8Z,
10577         /// A pointer to the contents in the error state.
10578         /// Reading from this pointer when `result_ok` is set is undefined.
10579         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10580 }
10581 #[repr(C)]
10582 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10583 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10584 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10585 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10586         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10587         /// `err` or `result` depending on the state of `result_ok`.
10588         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10589         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10590         pub result_ok: bool,
10591 }
10592 #[no_mangle]
10593 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10594 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10595         CResult_CVec_u8ZPeerHandleErrorZ {
10596                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10597                         result: Box::into_raw(Box::new(o)),
10598                 },
10599                 result_ok: true,
10600         }
10601 }
10602 #[no_mangle]
10603 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10604 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10605         CResult_CVec_u8ZPeerHandleErrorZ {
10606                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10607                         err: Box::into_raw(Box::new(e)),
10608                 },
10609                 result_ok: false,
10610         }
10611 }
10612 /// Checks if the given object is currently in the success state
10613 #[no_mangle]
10614 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10615         o.result_ok
10616 }
10617 #[no_mangle]
10618 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10619 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10620 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10621         fn drop(&mut self) {
10622                 if self.result_ok {
10623                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10624                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10625                         }
10626                 } else {
10627                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10628                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10629                         }
10630                 }
10631         }
10632 }
10633 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10634         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10635                 let contents = if o.result_ok {
10636                         let result = unsafe { o.contents.result };
10637                         unsafe { o.contents.result = core::ptr::null_mut() };
10638                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10639                 } else {
10640                         let err = unsafe { o.contents.err };
10641                         unsafe { o.contents.err = core::ptr::null_mut(); }
10642                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10643                 };
10644                 Self {
10645                         contents,
10646                         result_ok: o.result_ok,
10647                 }
10648         }
10649 }
10650 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10651         fn clone(&self) -> Self {
10652                 if self.result_ok {
10653                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10654                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10655                         } }
10656                 } else {
10657                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10658                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10659                         } }
10660                 }
10661         }
10662 }
10663 #[no_mangle]
10664 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10665 /// but with all dynamically-allocated buffers duplicated in new buffers.
10666 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10667 #[repr(C)]
10668 /// The contents of CResult_NonePeerHandleErrorZ
10669 pub union CResult_NonePeerHandleErrorZPtr {
10670         /// Note that this value is always NULL, as there are no contents in the OK variant
10671         pub result: *mut core::ffi::c_void,
10672         /// A pointer to the contents in the error state.
10673         /// Reading from this pointer when `result_ok` is set is undefined.
10674         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10675 }
10676 #[repr(C)]
10677 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10678 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10680 pub struct CResult_NonePeerHandleErrorZ {
10681         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10682         /// `err` or `result` depending on the state of `result_ok`.
10683         pub contents: CResult_NonePeerHandleErrorZPtr,
10684         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10685         pub result_ok: bool,
10686 }
10687 #[no_mangle]
10688 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10689 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10690         CResult_NonePeerHandleErrorZ {
10691                 contents: CResult_NonePeerHandleErrorZPtr {
10692                         result: core::ptr::null_mut(),
10693                 },
10694                 result_ok: true,
10695         }
10696 }
10697 #[no_mangle]
10698 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10699 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10700         CResult_NonePeerHandleErrorZ {
10701                 contents: CResult_NonePeerHandleErrorZPtr {
10702                         err: Box::into_raw(Box::new(e)),
10703                 },
10704                 result_ok: false,
10705         }
10706 }
10707 /// Checks if the given object is currently in the success state
10708 #[no_mangle]
10709 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10710         o.result_ok
10711 }
10712 #[no_mangle]
10713 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10714 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10715 impl Drop for CResult_NonePeerHandleErrorZ {
10716         fn drop(&mut self) {
10717                 if self.result_ok {
10718                 } else {
10719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10721                         }
10722                 }
10723         }
10724 }
10725 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10726         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10727                 let contents = if o.result_ok {
10728                         let _ = unsafe { Box::from_raw(o.contents.result) };
10729                         o.contents.result = core::ptr::null_mut();
10730                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10731                 } else {
10732                         let err = unsafe { o.contents.err };
10733                         unsafe { o.contents.err = core::ptr::null_mut(); }
10734                         CResult_NonePeerHandleErrorZPtr { err }
10735                 };
10736                 Self {
10737                         contents,
10738                         result_ok: o.result_ok,
10739                 }
10740         }
10741 }
10742 impl Clone for CResult_NonePeerHandleErrorZ {
10743         fn clone(&self) -> Self {
10744                 if self.result_ok {
10745                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10746                                 result: core::ptr::null_mut()
10747                         } }
10748                 } else {
10749                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10750                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10751                         } }
10752                 }
10753         }
10754 }
10755 #[no_mangle]
10756 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10757 /// but with all dynamically-allocated buffers duplicated in new buffers.
10758 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10759 #[repr(C)]
10760 /// The contents of CResult_boolPeerHandleErrorZ
10761 pub union CResult_boolPeerHandleErrorZPtr {
10762         /// A pointer to the contents in the success state.
10763         /// Reading from this pointer when `result_ok` is not set is undefined.
10764         pub result: *mut bool,
10765         /// A pointer to the contents in the error state.
10766         /// Reading from this pointer when `result_ok` is set is undefined.
10767         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10768 }
10769 #[repr(C)]
10770 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10771 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10772 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10773 pub struct CResult_boolPeerHandleErrorZ {
10774         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10775         /// `err` or `result` depending on the state of `result_ok`.
10776         pub contents: CResult_boolPeerHandleErrorZPtr,
10777         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10778         pub result_ok: bool,
10779 }
10780 #[no_mangle]
10781 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10782 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10783         CResult_boolPeerHandleErrorZ {
10784                 contents: CResult_boolPeerHandleErrorZPtr {
10785                         result: Box::into_raw(Box::new(o)),
10786                 },
10787                 result_ok: true,
10788         }
10789 }
10790 #[no_mangle]
10791 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10792 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10793         CResult_boolPeerHandleErrorZ {
10794                 contents: CResult_boolPeerHandleErrorZPtr {
10795                         err: Box::into_raw(Box::new(e)),
10796                 },
10797                 result_ok: false,
10798         }
10799 }
10800 /// Checks if the given object is currently in the success state
10801 #[no_mangle]
10802 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10803         o.result_ok
10804 }
10805 #[no_mangle]
10806 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10807 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10808 impl Drop for CResult_boolPeerHandleErrorZ {
10809         fn drop(&mut self) {
10810                 if self.result_ok {
10811                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10812                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10813                         }
10814                 } else {
10815                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10816                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10817                         }
10818                 }
10819         }
10820 }
10821 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10822         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10823                 let contents = if o.result_ok {
10824                         let result = unsafe { o.contents.result };
10825                         unsafe { o.contents.result = core::ptr::null_mut() };
10826                         CResult_boolPeerHandleErrorZPtr { result }
10827                 } else {
10828                         let err = unsafe { o.contents.err };
10829                         unsafe { o.contents.err = core::ptr::null_mut(); }
10830                         CResult_boolPeerHandleErrorZPtr { err }
10831                 };
10832                 Self {
10833                         contents,
10834                         result_ok: o.result_ok,
10835                 }
10836         }
10837 }
10838 impl Clone for CResult_boolPeerHandleErrorZ {
10839         fn clone(&self) -> Self {
10840                 if self.result_ok {
10841                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10842                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10843                         } }
10844                 } else {
10845                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10846                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10847                         } }
10848                 }
10849         }
10850 }
10851 #[no_mangle]
10852 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10853 /// but with all dynamically-allocated buffers duplicated in new buffers.
10854 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10855 #[repr(C)]
10856 /// The contents of CResult_NodeIdDecodeErrorZ
10857 pub union CResult_NodeIdDecodeErrorZPtr {
10858         /// A pointer to the contents in the success state.
10859         /// Reading from this pointer when `result_ok` is not set is undefined.
10860         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10861         /// A pointer to the contents in the error state.
10862         /// Reading from this pointer when `result_ok` is set is undefined.
10863         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10864 }
10865 #[repr(C)]
10866 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10867 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10868 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10869 pub struct CResult_NodeIdDecodeErrorZ {
10870         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10871         /// `err` or `result` depending on the state of `result_ok`.
10872         pub contents: CResult_NodeIdDecodeErrorZPtr,
10873         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10874         pub result_ok: bool,
10875 }
10876 #[no_mangle]
10877 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10878 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10879         CResult_NodeIdDecodeErrorZ {
10880                 contents: CResult_NodeIdDecodeErrorZPtr {
10881                         result: Box::into_raw(Box::new(o)),
10882                 },
10883                 result_ok: true,
10884         }
10885 }
10886 #[no_mangle]
10887 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10888 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10889         CResult_NodeIdDecodeErrorZ {
10890                 contents: CResult_NodeIdDecodeErrorZPtr {
10891                         err: Box::into_raw(Box::new(e)),
10892                 },
10893                 result_ok: false,
10894         }
10895 }
10896 /// Checks if the given object is currently in the success state
10897 #[no_mangle]
10898 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10899         o.result_ok
10900 }
10901 #[no_mangle]
10902 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10903 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10904 impl Drop for CResult_NodeIdDecodeErrorZ {
10905         fn drop(&mut self) {
10906                 if self.result_ok {
10907                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10908                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10909                         }
10910                 } else {
10911                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10912                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10913                         }
10914                 }
10915         }
10916 }
10917 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10918         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10919                 let contents = if o.result_ok {
10920                         let result = unsafe { o.contents.result };
10921                         unsafe { o.contents.result = core::ptr::null_mut() };
10922                         CResult_NodeIdDecodeErrorZPtr { result }
10923                 } else {
10924                         let err = unsafe { o.contents.err };
10925                         unsafe { o.contents.err = core::ptr::null_mut(); }
10926                         CResult_NodeIdDecodeErrorZPtr { err }
10927                 };
10928                 Self {
10929                         contents,
10930                         result_ok: o.result_ok,
10931                 }
10932         }
10933 }
10934 impl Clone for CResult_NodeIdDecodeErrorZ {
10935         fn clone(&self) -> Self {
10936                 if self.result_ok {
10937                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10938                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10939                         } }
10940                 } else {
10941                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10942                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10943                         } }
10944                 }
10945         }
10946 }
10947 #[no_mangle]
10948 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10949 /// but with all dynamically-allocated buffers duplicated in new buffers.
10950 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10951 #[repr(C)]
10952 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10953 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10954         /// A pointer to the contents in the success state.
10955         /// Reading from this pointer when `result_ok` is not set is undefined.
10956         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10957         /// A pointer to the contents in the error state.
10958         /// Reading from this pointer when `result_ok` is set is undefined.
10959         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10960 }
10961 #[repr(C)]
10962 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10963 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10964 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10965 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10966         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10967         /// `err` or `result` depending on the state of `result_ok`.
10968         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10969         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10970         pub result_ok: bool,
10971 }
10972 #[no_mangle]
10973 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10974 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10975         CResult_COption_NetworkUpdateZDecodeErrorZ {
10976                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10977                         result: Box::into_raw(Box::new(o)),
10978                 },
10979                 result_ok: true,
10980         }
10981 }
10982 #[no_mangle]
10983 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10984 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10985         CResult_COption_NetworkUpdateZDecodeErrorZ {
10986                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10987                         err: Box::into_raw(Box::new(e)),
10988                 },
10989                 result_ok: false,
10990         }
10991 }
10992 /// Checks if the given object is currently in the success state
10993 #[no_mangle]
10994 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10995         o.result_ok
10996 }
10997 #[no_mangle]
10998 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10999 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
11000 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
11001         fn drop(&mut self) {
11002                 if self.result_ok {
11003                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11004                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11005                         }
11006                 } else {
11007                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11008                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11009                         }
11010                 }
11011         }
11012 }
11013 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
11014         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
11015                 let contents = if o.result_ok {
11016                         let result = unsafe { o.contents.result };
11017                         unsafe { o.contents.result = core::ptr::null_mut() };
11018                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
11019                 } else {
11020                         let err = unsafe { o.contents.err };
11021                         unsafe { o.contents.err = core::ptr::null_mut(); }
11022                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
11023                 };
11024                 Self {
11025                         contents,
11026                         result_ok: o.result_ok,
11027                 }
11028         }
11029 }
11030 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
11031         fn clone(&self) -> Self {
11032                 if self.result_ok {
11033                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11034                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
11035                         } }
11036                 } else {
11037                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
11038                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11039                         } }
11040                 }
11041         }
11042 }
11043 #[no_mangle]
11044 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
11045 /// but with all dynamically-allocated buffers duplicated in new buffers.
11046 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
11047 #[repr(C)]
11048 /// An enum which can either contain a crate::lightning::chain::Access or not
11049 pub enum COption_AccessZ {
11050         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11051         Some(crate::lightning::chain::Access),
11052         /// When we're in this state, this COption_AccessZ contains nothing
11053         None
11054 }
11055 impl COption_AccessZ {
11056         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11057                 if let Self::None = self { false } else { true }
11058         }
11059         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11060                 !self.is_some()
11061         }
11062         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11063                 if let Self::Some(v) = self { v } else { unreachable!() }
11064         }
11065 }
11066 #[no_mangle]
11067 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11068 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11069         COption_AccessZ::Some(o)
11070 }
11071 #[no_mangle]
11072 /// Constructs a new COption_AccessZ containing nothing
11073 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11074         COption_AccessZ::None
11075 }
11076 #[no_mangle]
11077 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11078 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11079 #[repr(C)]
11080 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11081 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11082         /// A pointer to the contents in the success state.
11083         /// Reading from this pointer when `result_ok` is not set is undefined.
11084         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11085         /// A pointer to the contents in the error state.
11086         /// Reading from this pointer when `result_ok` is set is undefined.
11087         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11088 }
11089 #[repr(C)]
11090 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11091 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11092 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11093 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11094         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11095         /// `err` or `result` depending on the state of `result_ok`.
11096         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11097         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11098         pub result_ok: bool,
11099 }
11100 #[no_mangle]
11101 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11102 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11103         CResult_ChannelUpdateInfoDecodeErrorZ {
11104                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11105                         result: Box::into_raw(Box::new(o)),
11106                 },
11107                 result_ok: true,
11108         }
11109 }
11110 #[no_mangle]
11111 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11112 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11113         CResult_ChannelUpdateInfoDecodeErrorZ {
11114                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11115                         err: Box::into_raw(Box::new(e)),
11116                 },
11117                 result_ok: false,
11118         }
11119 }
11120 /// Checks if the given object is currently in the success state
11121 #[no_mangle]
11122 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11123         o.result_ok
11124 }
11125 #[no_mangle]
11126 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11127 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11128 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11129         fn drop(&mut self) {
11130                 if self.result_ok {
11131                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11132                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11133                         }
11134                 } else {
11135                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11136                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11137                         }
11138                 }
11139         }
11140 }
11141 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11142         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11143                 let contents = if o.result_ok {
11144                         let result = unsafe { o.contents.result };
11145                         unsafe { o.contents.result = core::ptr::null_mut() };
11146                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11147                 } else {
11148                         let err = unsafe { o.contents.err };
11149                         unsafe { o.contents.err = core::ptr::null_mut(); }
11150                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11151                 };
11152                 Self {
11153                         contents,
11154                         result_ok: o.result_ok,
11155                 }
11156         }
11157 }
11158 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11159         fn clone(&self) -> Self {
11160                 if self.result_ok {
11161                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11162                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11163                         } }
11164                 } else {
11165                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11166                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11167                         } }
11168                 }
11169         }
11170 }
11171 #[no_mangle]
11172 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11173 /// but with all dynamically-allocated buffers duplicated in new buffers.
11174 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11175 #[repr(C)]
11176 /// The contents of CResult_ChannelInfoDecodeErrorZ
11177 pub union CResult_ChannelInfoDecodeErrorZPtr {
11178         /// A pointer to the contents in the success state.
11179         /// Reading from this pointer when `result_ok` is not set is undefined.
11180         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11181         /// A pointer to the contents in the error state.
11182         /// Reading from this pointer when `result_ok` is set is undefined.
11183         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11184 }
11185 #[repr(C)]
11186 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11187 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11188 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11189 pub struct CResult_ChannelInfoDecodeErrorZ {
11190         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11191         /// `err` or `result` depending on the state of `result_ok`.
11192         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11193         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11194         pub result_ok: bool,
11195 }
11196 #[no_mangle]
11197 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11198 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11199         CResult_ChannelInfoDecodeErrorZ {
11200                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11201                         result: Box::into_raw(Box::new(o)),
11202                 },
11203                 result_ok: true,
11204         }
11205 }
11206 #[no_mangle]
11207 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11208 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11209         CResult_ChannelInfoDecodeErrorZ {
11210                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11211                         err: Box::into_raw(Box::new(e)),
11212                 },
11213                 result_ok: false,
11214         }
11215 }
11216 /// Checks if the given object is currently in the success state
11217 #[no_mangle]
11218 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11219         o.result_ok
11220 }
11221 #[no_mangle]
11222 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11223 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11224 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11225         fn drop(&mut self) {
11226                 if self.result_ok {
11227                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11228                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11229                         }
11230                 } else {
11231                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11232                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11233                         }
11234                 }
11235         }
11236 }
11237 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11238         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11239                 let contents = if o.result_ok {
11240                         let result = unsafe { o.contents.result };
11241                         unsafe { o.contents.result = core::ptr::null_mut() };
11242                         CResult_ChannelInfoDecodeErrorZPtr { result }
11243                 } else {
11244                         let err = unsafe { o.contents.err };
11245                         unsafe { o.contents.err = core::ptr::null_mut(); }
11246                         CResult_ChannelInfoDecodeErrorZPtr { err }
11247                 };
11248                 Self {
11249                         contents,
11250                         result_ok: o.result_ok,
11251                 }
11252         }
11253 }
11254 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11255         fn clone(&self) -> Self {
11256                 if self.result_ok {
11257                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11258                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11259                         } }
11260                 } else {
11261                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11262                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11263                         } }
11264                 }
11265         }
11266 }
11267 #[no_mangle]
11268 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11269 /// but with all dynamically-allocated buffers duplicated in new buffers.
11270 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11271 #[repr(C)]
11272 /// The contents of CResult_RoutingFeesDecodeErrorZ
11273 pub union CResult_RoutingFeesDecodeErrorZPtr {
11274         /// A pointer to the contents in the success state.
11275         /// Reading from this pointer when `result_ok` is not set is undefined.
11276         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11277         /// A pointer to the contents in the error state.
11278         /// Reading from this pointer when `result_ok` is set is undefined.
11279         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11280 }
11281 #[repr(C)]
11282 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11283 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11284 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11285 pub struct CResult_RoutingFeesDecodeErrorZ {
11286         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11287         /// `err` or `result` depending on the state of `result_ok`.
11288         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11289         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11290         pub result_ok: bool,
11291 }
11292 #[no_mangle]
11293 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11294 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11295         CResult_RoutingFeesDecodeErrorZ {
11296                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11297                         result: Box::into_raw(Box::new(o)),
11298                 },
11299                 result_ok: true,
11300         }
11301 }
11302 #[no_mangle]
11303 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11304 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11305         CResult_RoutingFeesDecodeErrorZ {
11306                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11307                         err: Box::into_raw(Box::new(e)),
11308                 },
11309                 result_ok: false,
11310         }
11311 }
11312 /// Checks if the given object is currently in the success state
11313 #[no_mangle]
11314 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11315         o.result_ok
11316 }
11317 #[no_mangle]
11318 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11319 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11320 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11321         fn drop(&mut self) {
11322                 if self.result_ok {
11323                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11324                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11325                         }
11326                 } else {
11327                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11328                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11329                         }
11330                 }
11331         }
11332 }
11333 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11334         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11335                 let contents = if o.result_ok {
11336                         let result = unsafe { o.contents.result };
11337                         unsafe { o.contents.result = core::ptr::null_mut() };
11338                         CResult_RoutingFeesDecodeErrorZPtr { result }
11339                 } else {
11340                         let err = unsafe { o.contents.err };
11341                         unsafe { o.contents.err = core::ptr::null_mut(); }
11342                         CResult_RoutingFeesDecodeErrorZPtr { err }
11343                 };
11344                 Self {
11345                         contents,
11346                         result_ok: o.result_ok,
11347                 }
11348         }
11349 }
11350 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11351         fn clone(&self) -> Self {
11352                 if self.result_ok {
11353                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11354                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11355                         } }
11356                 } else {
11357                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11358                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11359                         } }
11360                 }
11361         }
11362 }
11363 #[no_mangle]
11364 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11365 /// but with all dynamically-allocated buffers duplicated in new buffers.
11366 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11367 #[repr(C)]
11368 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11369 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11370         /// A pointer to the contents in the success state.
11371         /// Reading from this pointer when `result_ok` is not set is undefined.
11372         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11373         /// A pointer to the contents in the error state.
11374         /// Reading from this pointer when `result_ok` is set is undefined.
11375         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11376 }
11377 #[repr(C)]
11378 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11379 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11380 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11381 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11382         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11383         /// `err` or `result` depending on the state of `result_ok`.
11384         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11385         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11386         pub result_ok: bool,
11387 }
11388 #[no_mangle]
11389 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11390 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11391         CResult_NodeAnnouncementInfoDecodeErrorZ {
11392                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11393                         result: Box::into_raw(Box::new(o)),
11394                 },
11395                 result_ok: true,
11396         }
11397 }
11398 #[no_mangle]
11399 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11400 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11401         CResult_NodeAnnouncementInfoDecodeErrorZ {
11402                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11403                         err: Box::into_raw(Box::new(e)),
11404                 },
11405                 result_ok: false,
11406         }
11407 }
11408 /// Checks if the given object is currently in the success state
11409 #[no_mangle]
11410 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11411         o.result_ok
11412 }
11413 #[no_mangle]
11414 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11415 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11416 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11417         fn drop(&mut self) {
11418                 if self.result_ok {
11419                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11420                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11421                         }
11422                 } else {
11423                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11424                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11425                         }
11426                 }
11427         }
11428 }
11429 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11430         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11431                 let contents = if o.result_ok {
11432                         let result = unsafe { o.contents.result };
11433                         unsafe { o.contents.result = core::ptr::null_mut() };
11434                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11435                 } else {
11436                         let err = unsafe { o.contents.err };
11437                         unsafe { o.contents.err = core::ptr::null_mut(); }
11438                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11439                 };
11440                 Self {
11441                         contents,
11442                         result_ok: o.result_ok,
11443                 }
11444         }
11445 }
11446 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11447         fn clone(&self) -> Self {
11448                 if self.result_ok {
11449                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11450                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11451                         } }
11452                 } else {
11453                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11454                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11455                         } }
11456                 }
11457         }
11458 }
11459 #[no_mangle]
11460 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11461 /// but with all dynamically-allocated buffers duplicated in new buffers.
11462 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11463 #[repr(C)]
11464 /// A dynamically-allocated array of u64s of arbitrary size.
11465 /// This corresponds to std::vector in C++
11466 pub struct CVec_u64Z {
11467         /// The elements in the array.
11468         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11469         pub data: *mut u64,
11470         /// The number of elements pointed to by `data`.
11471         pub datalen: usize
11472 }
11473 impl CVec_u64Z {
11474         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11475                 if self.datalen == 0 { return Vec::new(); }
11476                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11477                 self.data = core::ptr::null_mut();
11478                 self.datalen = 0;
11479                 ret
11480         }
11481         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11482                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11483         }
11484 }
11485 impl From<Vec<u64>> for CVec_u64Z {
11486         fn from(v: Vec<u64>) -> Self {
11487                 let datalen = v.len();
11488                 let data = Box::into_raw(v.into_boxed_slice());
11489                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11490         }
11491 }
11492 #[no_mangle]
11493 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11494 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11495 impl Drop for CVec_u64Z {
11496         fn drop(&mut self) {
11497                 if self.datalen == 0 { return; }
11498                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11499         }
11500 }
11501 impl Clone for CVec_u64Z {
11502         fn clone(&self) -> Self {
11503                 let mut res = Vec::new();
11504                 if self.datalen == 0 { return Self::from(res); }
11505                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11506                 Self::from(res)
11507         }
11508 }
11509 #[repr(C)]
11510 /// The contents of CResult_NodeInfoDecodeErrorZ
11511 pub union CResult_NodeInfoDecodeErrorZPtr {
11512         /// A pointer to the contents in the success state.
11513         /// Reading from this pointer when `result_ok` is not set is undefined.
11514         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11515         /// A pointer to the contents in the error state.
11516         /// Reading from this pointer when `result_ok` is set is undefined.
11517         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11518 }
11519 #[repr(C)]
11520 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11521 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11522 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11523 pub struct CResult_NodeInfoDecodeErrorZ {
11524         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11525         /// `err` or `result` depending on the state of `result_ok`.
11526         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11527         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11528         pub result_ok: bool,
11529 }
11530 #[no_mangle]
11531 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11532 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11533         CResult_NodeInfoDecodeErrorZ {
11534                 contents: CResult_NodeInfoDecodeErrorZPtr {
11535                         result: Box::into_raw(Box::new(o)),
11536                 },
11537                 result_ok: true,
11538         }
11539 }
11540 #[no_mangle]
11541 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11542 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11543         CResult_NodeInfoDecodeErrorZ {
11544                 contents: CResult_NodeInfoDecodeErrorZPtr {
11545                         err: Box::into_raw(Box::new(e)),
11546                 },
11547                 result_ok: false,
11548         }
11549 }
11550 /// Checks if the given object is currently in the success state
11551 #[no_mangle]
11552 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11553         o.result_ok
11554 }
11555 #[no_mangle]
11556 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11557 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11558 impl Drop for CResult_NodeInfoDecodeErrorZ {
11559         fn drop(&mut self) {
11560                 if self.result_ok {
11561                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11562                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11563                         }
11564                 } else {
11565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11567                         }
11568                 }
11569         }
11570 }
11571 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11572         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11573                 let contents = if o.result_ok {
11574                         let result = unsafe { o.contents.result };
11575                         unsafe { o.contents.result = core::ptr::null_mut() };
11576                         CResult_NodeInfoDecodeErrorZPtr { result }
11577                 } else {
11578                         let err = unsafe { o.contents.err };
11579                         unsafe { o.contents.err = core::ptr::null_mut(); }
11580                         CResult_NodeInfoDecodeErrorZPtr { err }
11581                 };
11582                 Self {
11583                         contents,
11584                         result_ok: o.result_ok,
11585                 }
11586         }
11587 }
11588 impl Clone for CResult_NodeInfoDecodeErrorZ {
11589         fn clone(&self) -> Self {
11590                 if self.result_ok {
11591                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11592                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11593                         } }
11594                 } else {
11595                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11596                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11597                         } }
11598                 }
11599         }
11600 }
11601 #[no_mangle]
11602 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11603 /// but with all dynamically-allocated buffers duplicated in new buffers.
11604 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11605 #[repr(C)]
11606 /// The contents of CResult_NetworkGraphDecodeErrorZ
11607 pub union CResult_NetworkGraphDecodeErrorZPtr {
11608         /// A pointer to the contents in the success state.
11609         /// Reading from this pointer when `result_ok` is not set is undefined.
11610         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11611         /// A pointer to the contents in the error state.
11612         /// Reading from this pointer when `result_ok` is set is undefined.
11613         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11614 }
11615 #[repr(C)]
11616 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11617 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11619 pub struct CResult_NetworkGraphDecodeErrorZ {
11620         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11621         /// `err` or `result` depending on the state of `result_ok`.
11622         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11623         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11624         pub result_ok: bool,
11625 }
11626 #[no_mangle]
11627 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11628 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11629         CResult_NetworkGraphDecodeErrorZ {
11630                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11631                         result: Box::into_raw(Box::new(o)),
11632                 },
11633                 result_ok: true,
11634         }
11635 }
11636 #[no_mangle]
11637 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11638 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11639         CResult_NetworkGraphDecodeErrorZ {
11640                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11641                         err: Box::into_raw(Box::new(e)),
11642                 },
11643                 result_ok: false,
11644         }
11645 }
11646 /// Checks if the given object is currently in the success state
11647 #[no_mangle]
11648 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11649         o.result_ok
11650 }
11651 #[no_mangle]
11652 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11653 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11654 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11655         fn drop(&mut self) {
11656                 if self.result_ok {
11657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11659                         }
11660                 } else {
11661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11663                         }
11664                 }
11665         }
11666 }
11667 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11668         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11669                 let contents = if o.result_ok {
11670                         let result = unsafe { o.contents.result };
11671                         unsafe { o.contents.result = core::ptr::null_mut() };
11672                         CResult_NetworkGraphDecodeErrorZPtr { result }
11673                 } else {
11674                         let err = unsafe { o.contents.err };
11675                         unsafe { o.contents.err = core::ptr::null_mut(); }
11676                         CResult_NetworkGraphDecodeErrorZPtr { err }
11677                 };
11678                 Self {
11679                         contents,
11680                         result_ok: o.result_ok,
11681                 }
11682         }
11683 }
11684 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11685         fn clone(&self) -> Self {
11686                 if self.result_ok {
11687                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11688                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11689                         } }
11690                 } else {
11691                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11692                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11693                         } }
11694                 }
11695         }
11696 }
11697 #[no_mangle]
11698 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11699 /// but with all dynamically-allocated buffers duplicated in new buffers.
11700 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11701 #[repr(C)]
11702 #[derive(Clone)]
11703 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11704 pub enum COption_CVec_NetAddressZZ {
11705         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11706         Some(crate::c_types::derived::CVec_NetAddressZ),
11707         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11708         None
11709 }
11710 impl COption_CVec_NetAddressZZ {
11711         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11712                 if let Self::None = self { false } else { true }
11713         }
11714         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11715                 !self.is_some()
11716         }
11717         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11718                 if let Self::Some(v) = self { v } else { unreachable!() }
11719         }
11720 }
11721 #[no_mangle]
11722 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11723 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11724         COption_CVec_NetAddressZZ::Some(o)
11725 }
11726 #[no_mangle]
11727 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11728 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11729         COption_CVec_NetAddressZZ::None
11730 }
11731 #[no_mangle]
11732 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11733 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11734 #[no_mangle]
11735 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11736 /// but with all dynamically-allocated buffers duplicated in new buffers.
11737 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11738 #[repr(C)]
11739 /// The contents of CResult_NetAddressDecodeErrorZ
11740 pub union CResult_NetAddressDecodeErrorZPtr {
11741         /// A pointer to the contents in the success state.
11742         /// Reading from this pointer when `result_ok` is not set is undefined.
11743         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11744         /// A pointer to the contents in the error state.
11745         /// Reading from this pointer when `result_ok` is set is undefined.
11746         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11747 }
11748 #[repr(C)]
11749 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11750 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11751 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11752 pub struct CResult_NetAddressDecodeErrorZ {
11753         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11754         /// `err` or `result` depending on the state of `result_ok`.
11755         pub contents: CResult_NetAddressDecodeErrorZPtr,
11756         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11757         pub result_ok: bool,
11758 }
11759 #[no_mangle]
11760 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11761 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11762         CResult_NetAddressDecodeErrorZ {
11763                 contents: CResult_NetAddressDecodeErrorZPtr {
11764                         result: Box::into_raw(Box::new(o)),
11765                 },
11766                 result_ok: true,
11767         }
11768 }
11769 #[no_mangle]
11770 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11771 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11772         CResult_NetAddressDecodeErrorZ {
11773                 contents: CResult_NetAddressDecodeErrorZPtr {
11774                         err: Box::into_raw(Box::new(e)),
11775                 },
11776                 result_ok: false,
11777         }
11778 }
11779 /// Checks if the given object is currently in the success state
11780 #[no_mangle]
11781 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11782         o.result_ok
11783 }
11784 #[no_mangle]
11785 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11786 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11787 impl Drop for CResult_NetAddressDecodeErrorZ {
11788         fn drop(&mut self) {
11789                 if self.result_ok {
11790                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11791                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11792                         }
11793                 } else {
11794                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11795                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11796                         }
11797                 }
11798         }
11799 }
11800 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11801         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11802                 let contents = if o.result_ok {
11803                         let result = unsafe { o.contents.result };
11804                         unsafe { o.contents.result = core::ptr::null_mut() };
11805                         CResult_NetAddressDecodeErrorZPtr { result }
11806                 } else {
11807                         let err = unsafe { o.contents.err };
11808                         unsafe { o.contents.err = core::ptr::null_mut(); }
11809                         CResult_NetAddressDecodeErrorZPtr { err }
11810                 };
11811                 Self {
11812                         contents,
11813                         result_ok: o.result_ok,
11814                 }
11815         }
11816 }
11817 impl Clone for CResult_NetAddressDecodeErrorZ {
11818         fn clone(&self) -> Self {
11819                 if self.result_ok {
11820                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11821                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11822                         } }
11823                 } else {
11824                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11825                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11826                         } }
11827                 }
11828         }
11829 }
11830 #[no_mangle]
11831 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11832 /// but with all dynamically-allocated buffers duplicated in new buffers.
11833 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11834 #[repr(C)]
11835 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11836 /// This corresponds to std::vector in C++
11837 pub struct CVec_UpdateAddHTLCZ {
11838         /// The elements in the array.
11839         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11840         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11841         /// The number of elements pointed to by `data`.
11842         pub datalen: usize
11843 }
11844 impl CVec_UpdateAddHTLCZ {
11845         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11846                 if self.datalen == 0 { return Vec::new(); }
11847                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11848                 self.data = core::ptr::null_mut();
11849                 self.datalen = 0;
11850                 ret
11851         }
11852         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11853                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11854         }
11855 }
11856 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11857         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11858                 let datalen = v.len();
11859                 let data = Box::into_raw(v.into_boxed_slice());
11860                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11861         }
11862 }
11863 #[no_mangle]
11864 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11865 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11866 impl Drop for CVec_UpdateAddHTLCZ {
11867         fn drop(&mut self) {
11868                 if self.datalen == 0 { return; }
11869                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11870         }
11871 }
11872 impl Clone for CVec_UpdateAddHTLCZ {
11873         fn clone(&self) -> Self {
11874                 let mut res = Vec::new();
11875                 if self.datalen == 0 { return Self::from(res); }
11876                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11877                 Self::from(res)
11878         }
11879 }
11880 #[repr(C)]
11881 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11882 /// This corresponds to std::vector in C++
11883 pub struct CVec_UpdateFulfillHTLCZ {
11884         /// The elements in the array.
11885         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11886         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11887         /// The number of elements pointed to by `data`.
11888         pub datalen: usize
11889 }
11890 impl CVec_UpdateFulfillHTLCZ {
11891         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11892                 if self.datalen == 0 { return Vec::new(); }
11893                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11894                 self.data = core::ptr::null_mut();
11895                 self.datalen = 0;
11896                 ret
11897         }
11898         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11899                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11900         }
11901 }
11902 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11903         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11904                 let datalen = v.len();
11905                 let data = Box::into_raw(v.into_boxed_slice());
11906                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11907         }
11908 }
11909 #[no_mangle]
11910 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11911 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11912 impl Drop for CVec_UpdateFulfillHTLCZ {
11913         fn drop(&mut self) {
11914                 if self.datalen == 0 { return; }
11915                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11916         }
11917 }
11918 impl Clone for CVec_UpdateFulfillHTLCZ {
11919         fn clone(&self) -> Self {
11920                 let mut res = Vec::new();
11921                 if self.datalen == 0 { return Self::from(res); }
11922                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11923                 Self::from(res)
11924         }
11925 }
11926 #[repr(C)]
11927 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11928 /// This corresponds to std::vector in C++
11929 pub struct CVec_UpdateFailHTLCZ {
11930         /// The elements in the array.
11931         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11932         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11933         /// The number of elements pointed to by `data`.
11934         pub datalen: usize
11935 }
11936 impl CVec_UpdateFailHTLCZ {
11937         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11938                 if self.datalen == 0 { return Vec::new(); }
11939                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11940                 self.data = core::ptr::null_mut();
11941                 self.datalen = 0;
11942                 ret
11943         }
11944         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11945                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11946         }
11947 }
11948 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11949         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11950                 let datalen = v.len();
11951                 let data = Box::into_raw(v.into_boxed_slice());
11952                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11953         }
11954 }
11955 #[no_mangle]
11956 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11957 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11958 impl Drop for CVec_UpdateFailHTLCZ {
11959         fn drop(&mut self) {
11960                 if self.datalen == 0 { return; }
11961                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11962         }
11963 }
11964 impl Clone for CVec_UpdateFailHTLCZ {
11965         fn clone(&self) -> Self {
11966                 let mut res = Vec::new();
11967                 if self.datalen == 0 { return Self::from(res); }
11968                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11969                 Self::from(res)
11970         }
11971 }
11972 #[repr(C)]
11973 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11974 /// This corresponds to std::vector in C++
11975 pub struct CVec_UpdateFailMalformedHTLCZ {
11976         /// The elements in the array.
11977         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11978         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11979         /// The number of elements pointed to by `data`.
11980         pub datalen: usize
11981 }
11982 impl CVec_UpdateFailMalformedHTLCZ {
11983         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11984                 if self.datalen == 0 { return Vec::new(); }
11985                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11986                 self.data = core::ptr::null_mut();
11987                 self.datalen = 0;
11988                 ret
11989         }
11990         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11991                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11992         }
11993 }
11994 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11995         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11996                 let datalen = v.len();
11997                 let data = Box::into_raw(v.into_boxed_slice());
11998                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11999         }
12000 }
12001 #[no_mangle]
12002 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
12003 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
12004 impl Drop for CVec_UpdateFailMalformedHTLCZ {
12005         fn drop(&mut self) {
12006                 if self.datalen == 0 { return; }
12007                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
12008         }
12009 }
12010 impl Clone for CVec_UpdateFailMalformedHTLCZ {
12011         fn clone(&self) -> Self {
12012                 let mut res = Vec::new();
12013                 if self.datalen == 0 { return Self::from(res); }
12014                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
12015                 Self::from(res)
12016         }
12017 }
12018 #[repr(C)]
12019 /// The contents of CResult_AcceptChannelDecodeErrorZ
12020 pub union CResult_AcceptChannelDecodeErrorZPtr {
12021         /// A pointer to the contents in the success state.
12022         /// Reading from this pointer when `result_ok` is not set is undefined.
12023         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
12024         /// A pointer to the contents in the error state.
12025         /// Reading from this pointer when `result_ok` is set is undefined.
12026         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12027 }
12028 #[repr(C)]
12029 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
12030 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12031 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12032 pub struct CResult_AcceptChannelDecodeErrorZ {
12033         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
12034         /// `err` or `result` depending on the state of `result_ok`.
12035         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
12036         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
12037         pub result_ok: bool,
12038 }
12039 #[no_mangle]
12040 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
12041 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
12042         CResult_AcceptChannelDecodeErrorZ {
12043                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12044                         result: Box::into_raw(Box::new(o)),
12045                 },
12046                 result_ok: true,
12047         }
12048 }
12049 #[no_mangle]
12050 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12051 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12052         CResult_AcceptChannelDecodeErrorZ {
12053                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12054                         err: Box::into_raw(Box::new(e)),
12055                 },
12056                 result_ok: false,
12057         }
12058 }
12059 /// Checks if the given object is currently in the success state
12060 #[no_mangle]
12061 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12062         o.result_ok
12063 }
12064 #[no_mangle]
12065 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12066 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12067 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12068         fn drop(&mut self) {
12069                 if self.result_ok {
12070                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12071                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12072                         }
12073                 } else {
12074                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12075                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12076                         }
12077                 }
12078         }
12079 }
12080 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12081         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12082                 let contents = if o.result_ok {
12083                         let result = unsafe { o.contents.result };
12084                         unsafe { o.contents.result = core::ptr::null_mut() };
12085                         CResult_AcceptChannelDecodeErrorZPtr { result }
12086                 } else {
12087                         let err = unsafe { o.contents.err };
12088                         unsafe { o.contents.err = core::ptr::null_mut(); }
12089                         CResult_AcceptChannelDecodeErrorZPtr { err }
12090                 };
12091                 Self {
12092                         contents,
12093                         result_ok: o.result_ok,
12094                 }
12095         }
12096 }
12097 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12098         fn clone(&self) -> Self {
12099                 if self.result_ok {
12100                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12101                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12102                         } }
12103                 } else {
12104                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12105                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12106                         } }
12107                 }
12108         }
12109 }
12110 #[no_mangle]
12111 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12112 /// but with all dynamically-allocated buffers duplicated in new buffers.
12113 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12114 #[repr(C)]
12115 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12116 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12117         /// A pointer to the contents in the success state.
12118         /// Reading from this pointer when `result_ok` is not set is undefined.
12119         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12120         /// A pointer to the contents in the error state.
12121         /// Reading from this pointer when `result_ok` is set is undefined.
12122         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12123 }
12124 #[repr(C)]
12125 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12126 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12127 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12128 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12129         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12130         /// `err` or `result` depending on the state of `result_ok`.
12131         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12132         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12133         pub result_ok: bool,
12134 }
12135 #[no_mangle]
12136 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12137 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12138         CResult_AnnouncementSignaturesDecodeErrorZ {
12139                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12140                         result: Box::into_raw(Box::new(o)),
12141                 },
12142                 result_ok: true,
12143         }
12144 }
12145 #[no_mangle]
12146 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12147 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12148         CResult_AnnouncementSignaturesDecodeErrorZ {
12149                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12150                         err: Box::into_raw(Box::new(e)),
12151                 },
12152                 result_ok: false,
12153         }
12154 }
12155 /// Checks if the given object is currently in the success state
12156 #[no_mangle]
12157 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12158         o.result_ok
12159 }
12160 #[no_mangle]
12161 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12162 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12163 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12164         fn drop(&mut self) {
12165                 if self.result_ok {
12166                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12167                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12168                         }
12169                 } else {
12170                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12171                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12172                         }
12173                 }
12174         }
12175 }
12176 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12177         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12178                 let contents = if o.result_ok {
12179                         let result = unsafe { o.contents.result };
12180                         unsafe { o.contents.result = core::ptr::null_mut() };
12181                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12182                 } else {
12183                         let err = unsafe { o.contents.err };
12184                         unsafe { o.contents.err = core::ptr::null_mut(); }
12185                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12186                 };
12187                 Self {
12188                         contents,
12189                         result_ok: o.result_ok,
12190                 }
12191         }
12192 }
12193 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12194         fn clone(&self) -> Self {
12195                 if self.result_ok {
12196                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12197                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12198                         } }
12199                 } else {
12200                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12201                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12202                         } }
12203                 }
12204         }
12205 }
12206 #[no_mangle]
12207 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12208 /// but with all dynamically-allocated buffers duplicated in new buffers.
12209 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12210 #[repr(C)]
12211 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12212 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12213         /// A pointer to the contents in the success state.
12214         /// Reading from this pointer when `result_ok` is not set is undefined.
12215         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12216         /// A pointer to the contents in the error state.
12217         /// Reading from this pointer when `result_ok` is set is undefined.
12218         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12219 }
12220 #[repr(C)]
12221 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12222 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12223 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12224 pub struct CResult_ChannelReestablishDecodeErrorZ {
12225         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12226         /// `err` or `result` depending on the state of `result_ok`.
12227         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12228         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12229         pub result_ok: bool,
12230 }
12231 #[no_mangle]
12232 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12233 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12234         CResult_ChannelReestablishDecodeErrorZ {
12235                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12236                         result: Box::into_raw(Box::new(o)),
12237                 },
12238                 result_ok: true,
12239         }
12240 }
12241 #[no_mangle]
12242 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12243 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12244         CResult_ChannelReestablishDecodeErrorZ {
12245                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12246                         err: Box::into_raw(Box::new(e)),
12247                 },
12248                 result_ok: false,
12249         }
12250 }
12251 /// Checks if the given object is currently in the success state
12252 #[no_mangle]
12253 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12254         o.result_ok
12255 }
12256 #[no_mangle]
12257 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12258 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12259 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12260         fn drop(&mut self) {
12261                 if self.result_ok {
12262                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12263                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12264                         }
12265                 } else {
12266                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12267                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12268                         }
12269                 }
12270         }
12271 }
12272 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12273         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12274                 let contents = if o.result_ok {
12275                         let result = unsafe { o.contents.result };
12276                         unsafe { o.contents.result = core::ptr::null_mut() };
12277                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12278                 } else {
12279                         let err = unsafe { o.contents.err };
12280                         unsafe { o.contents.err = core::ptr::null_mut(); }
12281                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12282                 };
12283                 Self {
12284                         contents,
12285                         result_ok: o.result_ok,
12286                 }
12287         }
12288 }
12289 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12290         fn clone(&self) -> Self {
12291                 if self.result_ok {
12292                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12293                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12294                         } }
12295                 } else {
12296                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12297                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12298                         } }
12299                 }
12300         }
12301 }
12302 #[no_mangle]
12303 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12304 /// but with all dynamically-allocated buffers duplicated in new buffers.
12305 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12306 #[repr(C)]
12307 /// The contents of CResult_ClosingSignedDecodeErrorZ
12308 pub union CResult_ClosingSignedDecodeErrorZPtr {
12309         /// A pointer to the contents in the success state.
12310         /// Reading from this pointer when `result_ok` is not set is undefined.
12311         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12312         /// A pointer to the contents in the error state.
12313         /// Reading from this pointer when `result_ok` is set is undefined.
12314         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12315 }
12316 #[repr(C)]
12317 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12318 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12319 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12320 pub struct CResult_ClosingSignedDecodeErrorZ {
12321         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12322         /// `err` or `result` depending on the state of `result_ok`.
12323         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12324         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12325         pub result_ok: bool,
12326 }
12327 #[no_mangle]
12328 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12329 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12330         CResult_ClosingSignedDecodeErrorZ {
12331                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12332                         result: Box::into_raw(Box::new(o)),
12333                 },
12334                 result_ok: true,
12335         }
12336 }
12337 #[no_mangle]
12338 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12339 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12340         CResult_ClosingSignedDecodeErrorZ {
12341                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12342                         err: Box::into_raw(Box::new(e)),
12343                 },
12344                 result_ok: false,
12345         }
12346 }
12347 /// Checks if the given object is currently in the success state
12348 #[no_mangle]
12349 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12350         o.result_ok
12351 }
12352 #[no_mangle]
12353 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12354 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12355 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12356         fn drop(&mut self) {
12357                 if self.result_ok {
12358                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12359                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12360                         }
12361                 } else {
12362                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12363                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12364                         }
12365                 }
12366         }
12367 }
12368 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12369         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12370                 let contents = if o.result_ok {
12371                         let result = unsafe { o.contents.result };
12372                         unsafe { o.contents.result = core::ptr::null_mut() };
12373                         CResult_ClosingSignedDecodeErrorZPtr { result }
12374                 } else {
12375                         let err = unsafe { o.contents.err };
12376                         unsafe { o.contents.err = core::ptr::null_mut(); }
12377                         CResult_ClosingSignedDecodeErrorZPtr { err }
12378                 };
12379                 Self {
12380                         contents,
12381                         result_ok: o.result_ok,
12382                 }
12383         }
12384 }
12385 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12386         fn clone(&self) -> Self {
12387                 if self.result_ok {
12388                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12389                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12390                         } }
12391                 } else {
12392                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12393                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12394                         } }
12395                 }
12396         }
12397 }
12398 #[no_mangle]
12399 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12400 /// but with all dynamically-allocated buffers duplicated in new buffers.
12401 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12402 #[repr(C)]
12403 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12404 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12405         /// A pointer to the contents in the success state.
12406         /// Reading from this pointer when `result_ok` is not set is undefined.
12407         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12408         /// A pointer to the contents in the error state.
12409         /// Reading from this pointer when `result_ok` is set is undefined.
12410         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12411 }
12412 #[repr(C)]
12413 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12414 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12415 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12416 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12417         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12418         /// `err` or `result` depending on the state of `result_ok`.
12419         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12420         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12421         pub result_ok: bool,
12422 }
12423 #[no_mangle]
12424 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12425 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12426         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12427                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12428                         result: Box::into_raw(Box::new(o)),
12429                 },
12430                 result_ok: true,
12431         }
12432 }
12433 #[no_mangle]
12434 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12435 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12436         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12437                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12438                         err: Box::into_raw(Box::new(e)),
12439                 },
12440                 result_ok: false,
12441         }
12442 }
12443 /// Checks if the given object is currently in the success state
12444 #[no_mangle]
12445 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12446         o.result_ok
12447 }
12448 #[no_mangle]
12449 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12450 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12451 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12452         fn drop(&mut self) {
12453                 if self.result_ok {
12454                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12455                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12456                         }
12457                 } else {
12458                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12459                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12460                         }
12461                 }
12462         }
12463 }
12464 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12465         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12466                 let contents = if o.result_ok {
12467                         let result = unsafe { o.contents.result };
12468                         unsafe { o.contents.result = core::ptr::null_mut() };
12469                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12470                 } else {
12471                         let err = unsafe { o.contents.err };
12472                         unsafe { o.contents.err = core::ptr::null_mut(); }
12473                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12474                 };
12475                 Self {
12476                         contents,
12477                         result_ok: o.result_ok,
12478                 }
12479         }
12480 }
12481 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12482         fn clone(&self) -> Self {
12483                 if self.result_ok {
12484                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12485                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12486                         } }
12487                 } else {
12488                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12489                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12490                         } }
12491                 }
12492         }
12493 }
12494 #[no_mangle]
12495 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12496 /// but with all dynamically-allocated buffers duplicated in new buffers.
12497 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12498 #[repr(C)]
12499 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12500 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12501         /// A pointer to the contents in the success state.
12502         /// Reading from this pointer when `result_ok` is not set is undefined.
12503         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12504         /// A pointer to the contents in the error state.
12505         /// Reading from this pointer when `result_ok` is set is undefined.
12506         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12507 }
12508 #[repr(C)]
12509 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12510 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12511 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12512 pub struct CResult_CommitmentSignedDecodeErrorZ {
12513         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12514         /// `err` or `result` depending on the state of `result_ok`.
12515         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12516         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12517         pub result_ok: bool,
12518 }
12519 #[no_mangle]
12520 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12521 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12522         CResult_CommitmentSignedDecodeErrorZ {
12523                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12524                         result: Box::into_raw(Box::new(o)),
12525                 },
12526                 result_ok: true,
12527         }
12528 }
12529 #[no_mangle]
12530 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12531 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12532         CResult_CommitmentSignedDecodeErrorZ {
12533                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12534                         err: Box::into_raw(Box::new(e)),
12535                 },
12536                 result_ok: false,
12537         }
12538 }
12539 /// Checks if the given object is currently in the success state
12540 #[no_mangle]
12541 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12542         o.result_ok
12543 }
12544 #[no_mangle]
12545 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12546 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12547 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12548         fn drop(&mut self) {
12549                 if self.result_ok {
12550                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12551                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12552                         }
12553                 } else {
12554                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12555                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12556                         }
12557                 }
12558         }
12559 }
12560 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12561         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12562                 let contents = if o.result_ok {
12563                         let result = unsafe { o.contents.result };
12564                         unsafe { o.contents.result = core::ptr::null_mut() };
12565                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12566                 } else {
12567                         let err = unsafe { o.contents.err };
12568                         unsafe { o.contents.err = core::ptr::null_mut(); }
12569                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12570                 };
12571                 Self {
12572                         contents,
12573                         result_ok: o.result_ok,
12574                 }
12575         }
12576 }
12577 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12578         fn clone(&self) -> Self {
12579                 if self.result_ok {
12580                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12581                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12582                         } }
12583                 } else {
12584                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12585                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12586                         } }
12587                 }
12588         }
12589 }
12590 #[no_mangle]
12591 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12592 /// but with all dynamically-allocated buffers duplicated in new buffers.
12593 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12594 #[repr(C)]
12595 /// The contents of CResult_FundingCreatedDecodeErrorZ
12596 pub union CResult_FundingCreatedDecodeErrorZPtr {
12597         /// A pointer to the contents in the success state.
12598         /// Reading from this pointer when `result_ok` is not set is undefined.
12599         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12600         /// A pointer to the contents in the error state.
12601         /// Reading from this pointer when `result_ok` is set is undefined.
12602         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12603 }
12604 #[repr(C)]
12605 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12606 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12607 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12608 pub struct CResult_FundingCreatedDecodeErrorZ {
12609         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12610         /// `err` or `result` depending on the state of `result_ok`.
12611         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12612         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12613         pub result_ok: bool,
12614 }
12615 #[no_mangle]
12616 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12617 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12618         CResult_FundingCreatedDecodeErrorZ {
12619                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12620                         result: Box::into_raw(Box::new(o)),
12621                 },
12622                 result_ok: true,
12623         }
12624 }
12625 #[no_mangle]
12626 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12627 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12628         CResult_FundingCreatedDecodeErrorZ {
12629                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12630                         err: Box::into_raw(Box::new(e)),
12631                 },
12632                 result_ok: false,
12633         }
12634 }
12635 /// Checks if the given object is currently in the success state
12636 #[no_mangle]
12637 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12638         o.result_ok
12639 }
12640 #[no_mangle]
12641 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12642 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12643 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12644         fn drop(&mut self) {
12645                 if self.result_ok {
12646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12648                         }
12649                 } else {
12650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12652                         }
12653                 }
12654         }
12655 }
12656 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12657         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12658                 let contents = if o.result_ok {
12659                         let result = unsafe { o.contents.result };
12660                         unsafe { o.contents.result = core::ptr::null_mut() };
12661                         CResult_FundingCreatedDecodeErrorZPtr { result }
12662                 } else {
12663                         let err = unsafe { o.contents.err };
12664                         unsafe { o.contents.err = core::ptr::null_mut(); }
12665                         CResult_FundingCreatedDecodeErrorZPtr { err }
12666                 };
12667                 Self {
12668                         contents,
12669                         result_ok: o.result_ok,
12670                 }
12671         }
12672 }
12673 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12674         fn clone(&self) -> Self {
12675                 if self.result_ok {
12676                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12677                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12678                         } }
12679                 } else {
12680                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12681                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12682                         } }
12683                 }
12684         }
12685 }
12686 #[no_mangle]
12687 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12688 /// but with all dynamically-allocated buffers duplicated in new buffers.
12689 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12690 #[repr(C)]
12691 /// The contents of CResult_FundingSignedDecodeErrorZ
12692 pub union CResult_FundingSignedDecodeErrorZPtr {
12693         /// A pointer to the contents in the success state.
12694         /// Reading from this pointer when `result_ok` is not set is undefined.
12695         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12696         /// A pointer to the contents in the error state.
12697         /// Reading from this pointer when `result_ok` is set is undefined.
12698         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12699 }
12700 #[repr(C)]
12701 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12702 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12703 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12704 pub struct CResult_FundingSignedDecodeErrorZ {
12705         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12706         /// `err` or `result` depending on the state of `result_ok`.
12707         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12708         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12709         pub result_ok: bool,
12710 }
12711 #[no_mangle]
12712 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12713 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12714         CResult_FundingSignedDecodeErrorZ {
12715                 contents: CResult_FundingSignedDecodeErrorZPtr {
12716                         result: Box::into_raw(Box::new(o)),
12717                 },
12718                 result_ok: true,
12719         }
12720 }
12721 #[no_mangle]
12722 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12723 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12724         CResult_FundingSignedDecodeErrorZ {
12725                 contents: CResult_FundingSignedDecodeErrorZPtr {
12726                         err: Box::into_raw(Box::new(e)),
12727                 },
12728                 result_ok: false,
12729         }
12730 }
12731 /// Checks if the given object is currently in the success state
12732 #[no_mangle]
12733 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12734         o.result_ok
12735 }
12736 #[no_mangle]
12737 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12738 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12739 impl Drop for CResult_FundingSignedDecodeErrorZ {
12740         fn drop(&mut self) {
12741                 if self.result_ok {
12742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12744                         }
12745                 } else {
12746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12748                         }
12749                 }
12750         }
12751 }
12752 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12753         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12754                 let contents = if o.result_ok {
12755                         let result = unsafe { o.contents.result };
12756                         unsafe { o.contents.result = core::ptr::null_mut() };
12757                         CResult_FundingSignedDecodeErrorZPtr { result }
12758                 } else {
12759                         let err = unsafe { o.contents.err };
12760                         unsafe { o.contents.err = core::ptr::null_mut(); }
12761                         CResult_FundingSignedDecodeErrorZPtr { err }
12762                 };
12763                 Self {
12764                         contents,
12765                         result_ok: o.result_ok,
12766                 }
12767         }
12768 }
12769 impl Clone for CResult_FundingSignedDecodeErrorZ {
12770         fn clone(&self) -> Self {
12771                 if self.result_ok {
12772                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12773                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12774                         } }
12775                 } else {
12776                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12777                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12778                         } }
12779                 }
12780         }
12781 }
12782 #[no_mangle]
12783 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12784 /// but with all dynamically-allocated buffers duplicated in new buffers.
12785 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12786 #[repr(C)]
12787 /// The contents of CResult_FundingLockedDecodeErrorZ
12788 pub union CResult_FundingLockedDecodeErrorZPtr {
12789         /// A pointer to the contents in the success state.
12790         /// Reading from this pointer when `result_ok` is not set is undefined.
12791         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12792         /// A pointer to the contents in the error state.
12793         /// Reading from this pointer when `result_ok` is set is undefined.
12794         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12795 }
12796 #[repr(C)]
12797 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12798 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12799 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12800 pub struct CResult_FundingLockedDecodeErrorZ {
12801         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12802         /// `err` or `result` depending on the state of `result_ok`.
12803         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12804         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12805         pub result_ok: bool,
12806 }
12807 #[no_mangle]
12808 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12809 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12810         CResult_FundingLockedDecodeErrorZ {
12811                 contents: CResult_FundingLockedDecodeErrorZPtr {
12812                         result: Box::into_raw(Box::new(o)),
12813                 },
12814                 result_ok: true,
12815         }
12816 }
12817 #[no_mangle]
12818 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12819 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12820         CResult_FundingLockedDecodeErrorZ {
12821                 contents: CResult_FundingLockedDecodeErrorZPtr {
12822                         err: Box::into_raw(Box::new(e)),
12823                 },
12824                 result_ok: false,
12825         }
12826 }
12827 /// Checks if the given object is currently in the success state
12828 #[no_mangle]
12829 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12830         o.result_ok
12831 }
12832 #[no_mangle]
12833 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12834 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12835 impl Drop for CResult_FundingLockedDecodeErrorZ {
12836         fn drop(&mut self) {
12837                 if self.result_ok {
12838                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12839                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12840                         }
12841                 } else {
12842                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12843                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12844                         }
12845                 }
12846         }
12847 }
12848 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12849         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12850                 let contents = if o.result_ok {
12851                         let result = unsafe { o.contents.result };
12852                         unsafe { o.contents.result = core::ptr::null_mut() };
12853                         CResult_FundingLockedDecodeErrorZPtr { result }
12854                 } else {
12855                         let err = unsafe { o.contents.err };
12856                         unsafe { o.contents.err = core::ptr::null_mut(); }
12857                         CResult_FundingLockedDecodeErrorZPtr { err }
12858                 };
12859                 Self {
12860                         contents,
12861                         result_ok: o.result_ok,
12862                 }
12863         }
12864 }
12865 impl Clone for CResult_FundingLockedDecodeErrorZ {
12866         fn clone(&self) -> Self {
12867                 if self.result_ok {
12868                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12869                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12870                         } }
12871                 } else {
12872                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12873                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12874                         } }
12875                 }
12876         }
12877 }
12878 #[no_mangle]
12879 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12880 /// but with all dynamically-allocated buffers duplicated in new buffers.
12881 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12882 #[repr(C)]
12883 /// The contents of CResult_InitDecodeErrorZ
12884 pub union CResult_InitDecodeErrorZPtr {
12885         /// A pointer to the contents in the success state.
12886         /// Reading from this pointer when `result_ok` is not set is undefined.
12887         pub result: *mut crate::lightning::ln::msgs::Init,
12888         /// A pointer to the contents in the error state.
12889         /// Reading from this pointer when `result_ok` is set is undefined.
12890         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12891 }
12892 #[repr(C)]
12893 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12894 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12895 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12896 pub struct CResult_InitDecodeErrorZ {
12897         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12898         /// `err` or `result` depending on the state of `result_ok`.
12899         pub contents: CResult_InitDecodeErrorZPtr,
12900         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12901         pub result_ok: bool,
12902 }
12903 #[no_mangle]
12904 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12905 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12906         CResult_InitDecodeErrorZ {
12907                 contents: CResult_InitDecodeErrorZPtr {
12908                         result: Box::into_raw(Box::new(o)),
12909                 },
12910                 result_ok: true,
12911         }
12912 }
12913 #[no_mangle]
12914 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12915 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12916         CResult_InitDecodeErrorZ {
12917                 contents: CResult_InitDecodeErrorZPtr {
12918                         err: Box::into_raw(Box::new(e)),
12919                 },
12920                 result_ok: false,
12921         }
12922 }
12923 /// Checks if the given object is currently in the success state
12924 #[no_mangle]
12925 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12926         o.result_ok
12927 }
12928 #[no_mangle]
12929 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12930 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12931 impl Drop for CResult_InitDecodeErrorZ {
12932         fn drop(&mut self) {
12933                 if self.result_ok {
12934                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12935                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12936                         }
12937                 } else {
12938                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12939                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12940                         }
12941                 }
12942         }
12943 }
12944 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12945         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12946                 let contents = if o.result_ok {
12947                         let result = unsafe { o.contents.result };
12948                         unsafe { o.contents.result = core::ptr::null_mut() };
12949                         CResult_InitDecodeErrorZPtr { result }
12950                 } else {
12951                         let err = unsafe { o.contents.err };
12952                         unsafe { o.contents.err = core::ptr::null_mut(); }
12953                         CResult_InitDecodeErrorZPtr { err }
12954                 };
12955                 Self {
12956                         contents,
12957                         result_ok: o.result_ok,
12958                 }
12959         }
12960 }
12961 impl Clone for CResult_InitDecodeErrorZ {
12962         fn clone(&self) -> Self {
12963                 if self.result_ok {
12964                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12965                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12966                         } }
12967                 } else {
12968                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12969                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12970                         } }
12971                 }
12972         }
12973 }
12974 #[no_mangle]
12975 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12976 /// but with all dynamically-allocated buffers duplicated in new buffers.
12977 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12978 #[repr(C)]
12979 /// The contents of CResult_OpenChannelDecodeErrorZ
12980 pub union CResult_OpenChannelDecodeErrorZPtr {
12981         /// A pointer to the contents in the success state.
12982         /// Reading from this pointer when `result_ok` is not set is undefined.
12983         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12984         /// A pointer to the contents in the error state.
12985         /// Reading from this pointer when `result_ok` is set is undefined.
12986         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12987 }
12988 #[repr(C)]
12989 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12990 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12991 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12992 pub struct CResult_OpenChannelDecodeErrorZ {
12993         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12994         /// `err` or `result` depending on the state of `result_ok`.
12995         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12996         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12997         pub result_ok: bool,
12998 }
12999 #[no_mangle]
13000 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
13001 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
13002         CResult_OpenChannelDecodeErrorZ {
13003                 contents: CResult_OpenChannelDecodeErrorZPtr {
13004                         result: Box::into_raw(Box::new(o)),
13005                 },
13006                 result_ok: true,
13007         }
13008 }
13009 #[no_mangle]
13010 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
13011 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
13012         CResult_OpenChannelDecodeErrorZ {
13013                 contents: CResult_OpenChannelDecodeErrorZPtr {
13014                         err: Box::into_raw(Box::new(e)),
13015                 },
13016                 result_ok: false,
13017         }
13018 }
13019 /// Checks if the given object is currently in the success state
13020 #[no_mangle]
13021 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
13022         o.result_ok
13023 }
13024 #[no_mangle]
13025 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
13026 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
13027 impl Drop for CResult_OpenChannelDecodeErrorZ {
13028         fn drop(&mut self) {
13029                 if self.result_ok {
13030                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13031                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13032                         }
13033                 } else {
13034                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13035                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13036                         }
13037                 }
13038         }
13039 }
13040 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
13041         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
13042                 let contents = if o.result_ok {
13043                         let result = unsafe { o.contents.result };
13044                         unsafe { o.contents.result = core::ptr::null_mut() };
13045                         CResult_OpenChannelDecodeErrorZPtr { result }
13046                 } else {
13047                         let err = unsafe { o.contents.err };
13048                         unsafe { o.contents.err = core::ptr::null_mut(); }
13049                         CResult_OpenChannelDecodeErrorZPtr { err }
13050                 };
13051                 Self {
13052                         contents,
13053                         result_ok: o.result_ok,
13054                 }
13055         }
13056 }
13057 impl Clone for CResult_OpenChannelDecodeErrorZ {
13058         fn clone(&self) -> Self {
13059                 if self.result_ok {
13060                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13061                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13062                         } }
13063                 } else {
13064                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13065                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13066                         } }
13067                 }
13068         }
13069 }
13070 #[no_mangle]
13071 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13072 /// but with all dynamically-allocated buffers duplicated in new buffers.
13073 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13074 #[repr(C)]
13075 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13076 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13077         /// A pointer to the contents in the success state.
13078         /// Reading from this pointer when `result_ok` is not set is undefined.
13079         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13080         /// A pointer to the contents in the error state.
13081         /// Reading from this pointer when `result_ok` is set is undefined.
13082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13083 }
13084 #[repr(C)]
13085 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13086 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13088 pub struct CResult_RevokeAndACKDecodeErrorZ {
13089         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13090         /// `err` or `result` depending on the state of `result_ok`.
13091         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13092         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13093         pub result_ok: bool,
13094 }
13095 #[no_mangle]
13096 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13097 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13098         CResult_RevokeAndACKDecodeErrorZ {
13099                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13100                         result: Box::into_raw(Box::new(o)),
13101                 },
13102                 result_ok: true,
13103         }
13104 }
13105 #[no_mangle]
13106 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13107 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13108         CResult_RevokeAndACKDecodeErrorZ {
13109                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13110                         err: Box::into_raw(Box::new(e)),
13111                 },
13112                 result_ok: false,
13113         }
13114 }
13115 /// Checks if the given object is currently in the success state
13116 #[no_mangle]
13117 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13118         o.result_ok
13119 }
13120 #[no_mangle]
13121 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13122 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13123 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13124         fn drop(&mut self) {
13125                 if self.result_ok {
13126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13128                         }
13129                 } else {
13130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13132                         }
13133                 }
13134         }
13135 }
13136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13138                 let contents = if o.result_ok {
13139                         let result = unsafe { o.contents.result };
13140                         unsafe { o.contents.result = core::ptr::null_mut() };
13141                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13142                 } else {
13143                         let err = unsafe { o.contents.err };
13144                         unsafe { o.contents.err = core::ptr::null_mut(); }
13145                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13146                 };
13147                 Self {
13148                         contents,
13149                         result_ok: o.result_ok,
13150                 }
13151         }
13152 }
13153 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13154         fn clone(&self) -> Self {
13155                 if self.result_ok {
13156                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13158                         } }
13159                 } else {
13160                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13162                         } }
13163                 }
13164         }
13165 }
13166 #[no_mangle]
13167 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13168 /// but with all dynamically-allocated buffers duplicated in new buffers.
13169 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13170 #[repr(C)]
13171 /// The contents of CResult_ShutdownDecodeErrorZ
13172 pub union CResult_ShutdownDecodeErrorZPtr {
13173         /// A pointer to the contents in the success state.
13174         /// Reading from this pointer when `result_ok` is not set is undefined.
13175         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13176         /// A pointer to the contents in the error state.
13177         /// Reading from this pointer when `result_ok` is set is undefined.
13178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13179 }
13180 #[repr(C)]
13181 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13182 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13184 pub struct CResult_ShutdownDecodeErrorZ {
13185         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13186         /// `err` or `result` depending on the state of `result_ok`.
13187         pub contents: CResult_ShutdownDecodeErrorZPtr,
13188         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13189         pub result_ok: bool,
13190 }
13191 #[no_mangle]
13192 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13193 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13194         CResult_ShutdownDecodeErrorZ {
13195                 contents: CResult_ShutdownDecodeErrorZPtr {
13196                         result: Box::into_raw(Box::new(o)),
13197                 },
13198                 result_ok: true,
13199         }
13200 }
13201 #[no_mangle]
13202 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13203 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13204         CResult_ShutdownDecodeErrorZ {
13205                 contents: CResult_ShutdownDecodeErrorZPtr {
13206                         err: Box::into_raw(Box::new(e)),
13207                 },
13208                 result_ok: false,
13209         }
13210 }
13211 /// Checks if the given object is currently in the success state
13212 #[no_mangle]
13213 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13214         o.result_ok
13215 }
13216 #[no_mangle]
13217 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13218 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13219 impl Drop for CResult_ShutdownDecodeErrorZ {
13220         fn drop(&mut self) {
13221                 if self.result_ok {
13222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13224                         }
13225                 } else {
13226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13228                         }
13229                 }
13230         }
13231 }
13232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13234                 let contents = if o.result_ok {
13235                         let result = unsafe { o.contents.result };
13236                         unsafe { o.contents.result = core::ptr::null_mut() };
13237                         CResult_ShutdownDecodeErrorZPtr { result }
13238                 } else {
13239                         let err = unsafe { o.contents.err };
13240                         unsafe { o.contents.err = core::ptr::null_mut(); }
13241                         CResult_ShutdownDecodeErrorZPtr { err }
13242                 };
13243                 Self {
13244                         contents,
13245                         result_ok: o.result_ok,
13246                 }
13247         }
13248 }
13249 impl Clone for CResult_ShutdownDecodeErrorZ {
13250         fn clone(&self) -> Self {
13251                 if self.result_ok {
13252                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13254                         } }
13255                 } else {
13256                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13258                         } }
13259                 }
13260         }
13261 }
13262 #[no_mangle]
13263 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13264 /// but with all dynamically-allocated buffers duplicated in new buffers.
13265 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13266 #[repr(C)]
13267 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13268 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13269         /// A pointer to the contents in the success state.
13270         /// Reading from this pointer when `result_ok` is not set is undefined.
13271         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13272         /// A pointer to the contents in the error state.
13273         /// Reading from this pointer when `result_ok` is set is undefined.
13274         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13275 }
13276 #[repr(C)]
13277 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13278 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13279 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13280 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13281         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13282         /// `err` or `result` depending on the state of `result_ok`.
13283         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13284         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13285         pub result_ok: bool,
13286 }
13287 #[no_mangle]
13288 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13289 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13290         CResult_UpdateFailHTLCDecodeErrorZ {
13291                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13292                         result: Box::into_raw(Box::new(o)),
13293                 },
13294                 result_ok: true,
13295         }
13296 }
13297 #[no_mangle]
13298 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13299 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13300         CResult_UpdateFailHTLCDecodeErrorZ {
13301                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13302                         err: Box::into_raw(Box::new(e)),
13303                 },
13304                 result_ok: false,
13305         }
13306 }
13307 /// Checks if the given object is currently in the success state
13308 #[no_mangle]
13309 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13310         o.result_ok
13311 }
13312 #[no_mangle]
13313 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13314 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13315 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13316         fn drop(&mut self) {
13317                 if self.result_ok {
13318                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13319                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13320                         }
13321                 } else {
13322                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13323                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13324                         }
13325                 }
13326         }
13327 }
13328 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13329         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13330                 let contents = if o.result_ok {
13331                         let result = unsafe { o.contents.result };
13332                         unsafe { o.contents.result = core::ptr::null_mut() };
13333                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13334                 } else {
13335                         let err = unsafe { o.contents.err };
13336                         unsafe { o.contents.err = core::ptr::null_mut(); }
13337                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13338                 };
13339                 Self {
13340                         contents,
13341                         result_ok: o.result_ok,
13342                 }
13343         }
13344 }
13345 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13346         fn clone(&self) -> Self {
13347                 if self.result_ok {
13348                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13349                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13350                         } }
13351                 } else {
13352                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13353                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13354                         } }
13355                 }
13356         }
13357 }
13358 #[no_mangle]
13359 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13360 /// but with all dynamically-allocated buffers duplicated in new buffers.
13361 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13362 #[repr(C)]
13363 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13364 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13365         /// A pointer to the contents in the success state.
13366         /// Reading from this pointer when `result_ok` is not set is undefined.
13367         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13368         /// A pointer to the contents in the error state.
13369         /// Reading from this pointer when `result_ok` is set is undefined.
13370         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13371 }
13372 #[repr(C)]
13373 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13374 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13375 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13376 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13377         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13378         /// `err` or `result` depending on the state of `result_ok`.
13379         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13380         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13381         pub result_ok: bool,
13382 }
13383 #[no_mangle]
13384 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13385 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13386         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13387                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13388                         result: Box::into_raw(Box::new(o)),
13389                 },
13390                 result_ok: true,
13391         }
13392 }
13393 #[no_mangle]
13394 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13395 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13396         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13397                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13398                         err: Box::into_raw(Box::new(e)),
13399                 },
13400                 result_ok: false,
13401         }
13402 }
13403 /// Checks if the given object is currently in the success state
13404 #[no_mangle]
13405 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13406         o.result_ok
13407 }
13408 #[no_mangle]
13409 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13410 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13411 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13412         fn drop(&mut self) {
13413                 if self.result_ok {
13414                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13415                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13416                         }
13417                 } else {
13418                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13419                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13420                         }
13421                 }
13422         }
13423 }
13424 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13425         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13426                 let contents = if o.result_ok {
13427                         let result = unsafe { o.contents.result };
13428                         unsafe { o.contents.result = core::ptr::null_mut() };
13429                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13430                 } else {
13431                         let err = unsafe { o.contents.err };
13432                         unsafe { o.contents.err = core::ptr::null_mut(); }
13433                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13434                 };
13435                 Self {
13436                         contents,
13437                         result_ok: o.result_ok,
13438                 }
13439         }
13440 }
13441 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13442         fn clone(&self) -> Self {
13443                 if self.result_ok {
13444                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13445                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13446                         } }
13447                 } else {
13448                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13449                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13450                         } }
13451                 }
13452         }
13453 }
13454 #[no_mangle]
13455 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13456 /// but with all dynamically-allocated buffers duplicated in new buffers.
13457 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13458 #[repr(C)]
13459 /// The contents of CResult_UpdateFeeDecodeErrorZ
13460 pub union CResult_UpdateFeeDecodeErrorZPtr {
13461         /// A pointer to the contents in the success state.
13462         /// Reading from this pointer when `result_ok` is not set is undefined.
13463         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13464         /// A pointer to the contents in the error state.
13465         /// Reading from this pointer when `result_ok` is set is undefined.
13466         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13467 }
13468 #[repr(C)]
13469 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13470 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13471 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13472 pub struct CResult_UpdateFeeDecodeErrorZ {
13473         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13474         /// `err` or `result` depending on the state of `result_ok`.
13475         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13476         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13477         pub result_ok: bool,
13478 }
13479 #[no_mangle]
13480 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13481 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13482         CResult_UpdateFeeDecodeErrorZ {
13483                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13484                         result: Box::into_raw(Box::new(o)),
13485                 },
13486                 result_ok: true,
13487         }
13488 }
13489 #[no_mangle]
13490 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13491 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13492         CResult_UpdateFeeDecodeErrorZ {
13493                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13494                         err: Box::into_raw(Box::new(e)),
13495                 },
13496                 result_ok: false,
13497         }
13498 }
13499 /// Checks if the given object is currently in the success state
13500 #[no_mangle]
13501 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13502         o.result_ok
13503 }
13504 #[no_mangle]
13505 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13506 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13507 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13508         fn drop(&mut self) {
13509                 if self.result_ok {
13510                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13511                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13512                         }
13513                 } else {
13514                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13515                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13516                         }
13517                 }
13518         }
13519 }
13520 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13521         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13522                 let contents = if o.result_ok {
13523                         let result = unsafe { o.contents.result };
13524                         unsafe { o.contents.result = core::ptr::null_mut() };
13525                         CResult_UpdateFeeDecodeErrorZPtr { result }
13526                 } else {
13527                         let err = unsafe { o.contents.err };
13528                         unsafe { o.contents.err = core::ptr::null_mut(); }
13529                         CResult_UpdateFeeDecodeErrorZPtr { err }
13530                 };
13531                 Self {
13532                         contents,
13533                         result_ok: o.result_ok,
13534                 }
13535         }
13536 }
13537 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13538         fn clone(&self) -> Self {
13539                 if self.result_ok {
13540                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13541                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13542                         } }
13543                 } else {
13544                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13545                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13546                         } }
13547                 }
13548         }
13549 }
13550 #[no_mangle]
13551 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13552 /// but with all dynamically-allocated buffers duplicated in new buffers.
13553 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13554 #[repr(C)]
13555 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13556 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13557         /// A pointer to the contents in the success state.
13558         /// Reading from this pointer when `result_ok` is not set is undefined.
13559         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13560         /// A pointer to the contents in the error state.
13561         /// Reading from this pointer when `result_ok` is set is undefined.
13562         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13563 }
13564 #[repr(C)]
13565 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13566 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13568 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13569         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13570         /// `err` or `result` depending on the state of `result_ok`.
13571         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13572         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13573         pub result_ok: bool,
13574 }
13575 #[no_mangle]
13576 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13577 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13578         CResult_UpdateFulfillHTLCDecodeErrorZ {
13579                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13580                         result: Box::into_raw(Box::new(o)),
13581                 },
13582                 result_ok: true,
13583         }
13584 }
13585 #[no_mangle]
13586 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13587 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13588         CResult_UpdateFulfillHTLCDecodeErrorZ {
13589                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13590                         err: Box::into_raw(Box::new(e)),
13591                 },
13592                 result_ok: false,
13593         }
13594 }
13595 /// Checks if the given object is currently in the success state
13596 #[no_mangle]
13597 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13598         o.result_ok
13599 }
13600 #[no_mangle]
13601 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13602 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13603 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13604         fn drop(&mut self) {
13605                 if self.result_ok {
13606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13608                         }
13609                 } else {
13610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13612                         }
13613                 }
13614         }
13615 }
13616 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13618                 let contents = if o.result_ok {
13619                         let result = unsafe { o.contents.result };
13620                         unsafe { o.contents.result = core::ptr::null_mut() };
13621                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13622                 } else {
13623                         let err = unsafe { o.contents.err };
13624                         unsafe { o.contents.err = core::ptr::null_mut(); }
13625                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13626                 };
13627                 Self {
13628                         contents,
13629                         result_ok: o.result_ok,
13630                 }
13631         }
13632 }
13633 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13634         fn clone(&self) -> Self {
13635                 if self.result_ok {
13636                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13637                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13638                         } }
13639                 } else {
13640                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13641                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13642                         } }
13643                 }
13644         }
13645 }
13646 #[no_mangle]
13647 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13648 /// but with all dynamically-allocated buffers duplicated in new buffers.
13649 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13650 #[repr(C)]
13651 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13652 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13653         /// A pointer to the contents in the success state.
13654         /// Reading from this pointer when `result_ok` is not set is undefined.
13655         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13656         /// A pointer to the contents in the error state.
13657         /// Reading from this pointer when `result_ok` is set is undefined.
13658         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13659 }
13660 #[repr(C)]
13661 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13662 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13663 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13664 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13665         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13666         /// `err` or `result` depending on the state of `result_ok`.
13667         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13668         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13669         pub result_ok: bool,
13670 }
13671 #[no_mangle]
13672 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13673 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13674         CResult_UpdateAddHTLCDecodeErrorZ {
13675                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13676                         result: Box::into_raw(Box::new(o)),
13677                 },
13678                 result_ok: true,
13679         }
13680 }
13681 #[no_mangle]
13682 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13683 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13684         CResult_UpdateAddHTLCDecodeErrorZ {
13685                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13686                         err: Box::into_raw(Box::new(e)),
13687                 },
13688                 result_ok: false,
13689         }
13690 }
13691 /// Checks if the given object is currently in the success state
13692 #[no_mangle]
13693 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13694         o.result_ok
13695 }
13696 #[no_mangle]
13697 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13698 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13699 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13700         fn drop(&mut self) {
13701                 if self.result_ok {
13702                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13703                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13704                         }
13705                 } else {
13706                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13707                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13708                         }
13709                 }
13710         }
13711 }
13712 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13713         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13714                 let contents = if o.result_ok {
13715                         let result = unsafe { o.contents.result };
13716                         unsafe { o.contents.result = core::ptr::null_mut() };
13717                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13718                 } else {
13719                         let err = unsafe { o.contents.err };
13720                         unsafe { o.contents.err = core::ptr::null_mut(); }
13721                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13722                 };
13723                 Self {
13724                         contents,
13725                         result_ok: o.result_ok,
13726                 }
13727         }
13728 }
13729 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13730         fn clone(&self) -> Self {
13731                 if self.result_ok {
13732                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13733                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13734                         } }
13735                 } else {
13736                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13737                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13738                         } }
13739                 }
13740         }
13741 }
13742 #[no_mangle]
13743 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13744 /// but with all dynamically-allocated buffers duplicated in new buffers.
13745 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13746 #[repr(C)]
13747 /// The contents of CResult_PingDecodeErrorZ
13748 pub union CResult_PingDecodeErrorZPtr {
13749         /// A pointer to the contents in the success state.
13750         /// Reading from this pointer when `result_ok` is not set is undefined.
13751         pub result: *mut crate::lightning::ln::msgs::Ping,
13752         /// A pointer to the contents in the error state.
13753         /// Reading from this pointer when `result_ok` is set is undefined.
13754         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13755 }
13756 #[repr(C)]
13757 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13758 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13759 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13760 pub struct CResult_PingDecodeErrorZ {
13761         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13762         /// `err` or `result` depending on the state of `result_ok`.
13763         pub contents: CResult_PingDecodeErrorZPtr,
13764         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13765         pub result_ok: bool,
13766 }
13767 #[no_mangle]
13768 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13769 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13770         CResult_PingDecodeErrorZ {
13771                 contents: CResult_PingDecodeErrorZPtr {
13772                         result: Box::into_raw(Box::new(o)),
13773                 },
13774                 result_ok: true,
13775         }
13776 }
13777 #[no_mangle]
13778 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13779 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13780         CResult_PingDecodeErrorZ {
13781                 contents: CResult_PingDecodeErrorZPtr {
13782                         err: Box::into_raw(Box::new(e)),
13783                 },
13784                 result_ok: false,
13785         }
13786 }
13787 /// Checks if the given object is currently in the success state
13788 #[no_mangle]
13789 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13790         o.result_ok
13791 }
13792 #[no_mangle]
13793 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13794 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13795 impl Drop for CResult_PingDecodeErrorZ {
13796         fn drop(&mut self) {
13797                 if self.result_ok {
13798                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13799                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13800                         }
13801                 } else {
13802                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13803                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13804                         }
13805                 }
13806         }
13807 }
13808 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13809         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13810                 let contents = if o.result_ok {
13811                         let result = unsafe { o.contents.result };
13812                         unsafe { o.contents.result = core::ptr::null_mut() };
13813                         CResult_PingDecodeErrorZPtr { result }
13814                 } else {
13815                         let err = unsafe { o.contents.err };
13816                         unsafe { o.contents.err = core::ptr::null_mut(); }
13817                         CResult_PingDecodeErrorZPtr { err }
13818                 };
13819                 Self {
13820                         contents,
13821                         result_ok: o.result_ok,
13822                 }
13823         }
13824 }
13825 impl Clone for CResult_PingDecodeErrorZ {
13826         fn clone(&self) -> Self {
13827                 if self.result_ok {
13828                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13829                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13830                         } }
13831                 } else {
13832                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13833                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13834                         } }
13835                 }
13836         }
13837 }
13838 #[no_mangle]
13839 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13840 /// but with all dynamically-allocated buffers duplicated in new buffers.
13841 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13842 #[repr(C)]
13843 /// The contents of CResult_PongDecodeErrorZ
13844 pub union CResult_PongDecodeErrorZPtr {
13845         /// A pointer to the contents in the success state.
13846         /// Reading from this pointer when `result_ok` is not set is undefined.
13847         pub result: *mut crate::lightning::ln::msgs::Pong,
13848         /// A pointer to the contents in the error state.
13849         /// Reading from this pointer when `result_ok` is set is undefined.
13850         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13851 }
13852 #[repr(C)]
13853 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13854 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13855 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13856 pub struct CResult_PongDecodeErrorZ {
13857         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13858         /// `err` or `result` depending on the state of `result_ok`.
13859         pub contents: CResult_PongDecodeErrorZPtr,
13860         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13861         pub result_ok: bool,
13862 }
13863 #[no_mangle]
13864 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13865 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13866         CResult_PongDecodeErrorZ {
13867                 contents: CResult_PongDecodeErrorZPtr {
13868                         result: Box::into_raw(Box::new(o)),
13869                 },
13870                 result_ok: true,
13871         }
13872 }
13873 #[no_mangle]
13874 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13875 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13876         CResult_PongDecodeErrorZ {
13877                 contents: CResult_PongDecodeErrorZPtr {
13878                         err: Box::into_raw(Box::new(e)),
13879                 },
13880                 result_ok: false,
13881         }
13882 }
13883 /// Checks if the given object is currently in the success state
13884 #[no_mangle]
13885 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13886         o.result_ok
13887 }
13888 #[no_mangle]
13889 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13890 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13891 impl Drop for CResult_PongDecodeErrorZ {
13892         fn drop(&mut self) {
13893                 if self.result_ok {
13894                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13895                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13896                         }
13897                 } else {
13898                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13899                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13900                         }
13901                 }
13902         }
13903 }
13904 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13905         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13906                 let contents = if o.result_ok {
13907                         let result = unsafe { o.contents.result };
13908                         unsafe { o.contents.result = core::ptr::null_mut() };
13909                         CResult_PongDecodeErrorZPtr { result }
13910                 } else {
13911                         let err = unsafe { o.contents.err };
13912                         unsafe { o.contents.err = core::ptr::null_mut(); }
13913                         CResult_PongDecodeErrorZPtr { err }
13914                 };
13915                 Self {
13916                         contents,
13917                         result_ok: o.result_ok,
13918                 }
13919         }
13920 }
13921 impl Clone for CResult_PongDecodeErrorZ {
13922         fn clone(&self) -> Self {
13923                 if self.result_ok {
13924                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13925                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13926                         } }
13927                 } else {
13928                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13929                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13930                         } }
13931                 }
13932         }
13933 }
13934 #[no_mangle]
13935 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13936 /// but with all dynamically-allocated buffers duplicated in new buffers.
13937 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13938 #[repr(C)]
13939 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13940 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13941         /// A pointer to the contents in the success state.
13942         /// Reading from this pointer when `result_ok` is not set is undefined.
13943         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13944         /// A pointer to the contents in the error state.
13945         /// Reading from this pointer when `result_ok` is set is undefined.
13946         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13947 }
13948 #[repr(C)]
13949 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13950 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13951 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13952 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13953         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13954         /// `err` or `result` depending on the state of `result_ok`.
13955         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13956         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13957         pub result_ok: bool,
13958 }
13959 #[no_mangle]
13960 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13961 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13962         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13963                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13964                         result: Box::into_raw(Box::new(o)),
13965                 },
13966                 result_ok: true,
13967         }
13968 }
13969 #[no_mangle]
13970 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13971 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13972         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13973                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13974                         err: Box::into_raw(Box::new(e)),
13975                 },
13976                 result_ok: false,
13977         }
13978 }
13979 /// Checks if the given object is currently in the success state
13980 #[no_mangle]
13981 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13982         o.result_ok
13983 }
13984 #[no_mangle]
13985 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13986 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13987 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13988         fn drop(&mut self) {
13989                 if self.result_ok {
13990                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13991                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13992                         }
13993                 } else {
13994                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13995                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13996                         }
13997                 }
13998         }
13999 }
14000 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14001         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14002                 let contents = if o.result_ok {
14003                         let result = unsafe { o.contents.result };
14004                         unsafe { o.contents.result = core::ptr::null_mut() };
14005                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
14006                 } else {
14007                         let err = unsafe { o.contents.err };
14008                         unsafe { o.contents.err = core::ptr::null_mut(); }
14009                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
14010                 };
14011                 Self {
14012                         contents,
14013                         result_ok: o.result_ok,
14014                 }
14015         }
14016 }
14017 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
14018         fn clone(&self) -> Self {
14019                 if self.result_ok {
14020                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14021                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14022                         } }
14023                 } else {
14024                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
14025                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14026                         } }
14027                 }
14028         }
14029 }
14030 #[no_mangle]
14031 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14032 /// but with all dynamically-allocated buffers duplicated in new buffers.
14033 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14034 #[repr(C)]
14035 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
14036 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
14037         /// A pointer to the contents in the success state.
14038         /// Reading from this pointer when `result_ok` is not set is undefined.
14039         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
14040         /// A pointer to the contents in the error state.
14041         /// Reading from this pointer when `result_ok` is set is undefined.
14042         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14043 }
14044 #[repr(C)]
14045 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
14046 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14047 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14048 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14049         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14050         /// `err` or `result` depending on the state of `result_ok`.
14051         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14052         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14053         pub result_ok: bool,
14054 }
14055 #[no_mangle]
14056 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14057 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14058         CResult_ChannelAnnouncementDecodeErrorZ {
14059                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14060                         result: Box::into_raw(Box::new(o)),
14061                 },
14062                 result_ok: true,
14063         }
14064 }
14065 #[no_mangle]
14066 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14067 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14068         CResult_ChannelAnnouncementDecodeErrorZ {
14069                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14070                         err: Box::into_raw(Box::new(e)),
14071                 },
14072                 result_ok: false,
14073         }
14074 }
14075 /// Checks if the given object is currently in the success state
14076 #[no_mangle]
14077 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14078         o.result_ok
14079 }
14080 #[no_mangle]
14081 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14082 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14083 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14084         fn drop(&mut self) {
14085                 if self.result_ok {
14086                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14087                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14088                         }
14089                 } else {
14090                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14091                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14092                         }
14093                 }
14094         }
14095 }
14096 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14097         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14098                 let contents = if o.result_ok {
14099                         let result = unsafe { o.contents.result };
14100                         unsafe { o.contents.result = core::ptr::null_mut() };
14101                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14102                 } else {
14103                         let err = unsafe { o.contents.err };
14104                         unsafe { o.contents.err = core::ptr::null_mut(); }
14105                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14106                 };
14107                 Self {
14108                         contents,
14109                         result_ok: o.result_ok,
14110                 }
14111         }
14112 }
14113 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14114         fn clone(&self) -> Self {
14115                 if self.result_ok {
14116                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14117                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14118                         } }
14119                 } else {
14120                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14121                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14122                         } }
14123                 }
14124         }
14125 }
14126 #[no_mangle]
14127 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14128 /// but with all dynamically-allocated buffers duplicated in new buffers.
14129 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14130 #[repr(C)]
14131 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14132 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14133         /// A pointer to the contents in the success state.
14134         /// Reading from this pointer when `result_ok` is not set is undefined.
14135         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14136         /// A pointer to the contents in the error state.
14137         /// Reading from this pointer when `result_ok` is set is undefined.
14138         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14139 }
14140 #[repr(C)]
14141 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14142 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14143 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14144 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14145         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14146         /// `err` or `result` depending on the state of `result_ok`.
14147         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14148         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14149         pub result_ok: bool,
14150 }
14151 #[no_mangle]
14152 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14153 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14154         CResult_UnsignedChannelUpdateDecodeErrorZ {
14155                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14156                         result: Box::into_raw(Box::new(o)),
14157                 },
14158                 result_ok: true,
14159         }
14160 }
14161 #[no_mangle]
14162 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14163 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14164         CResult_UnsignedChannelUpdateDecodeErrorZ {
14165                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14166                         err: Box::into_raw(Box::new(e)),
14167                 },
14168                 result_ok: false,
14169         }
14170 }
14171 /// Checks if the given object is currently in the success state
14172 #[no_mangle]
14173 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14174         o.result_ok
14175 }
14176 #[no_mangle]
14177 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14178 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14179 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14180         fn drop(&mut self) {
14181                 if self.result_ok {
14182                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14183                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14184                         }
14185                 } else {
14186                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14187                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14188                         }
14189                 }
14190         }
14191 }
14192 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14193         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14194                 let contents = if o.result_ok {
14195                         let result = unsafe { o.contents.result };
14196                         unsafe { o.contents.result = core::ptr::null_mut() };
14197                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14198                 } else {
14199                         let err = unsafe { o.contents.err };
14200                         unsafe { o.contents.err = core::ptr::null_mut(); }
14201                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14202                 };
14203                 Self {
14204                         contents,
14205                         result_ok: o.result_ok,
14206                 }
14207         }
14208 }
14209 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14210         fn clone(&self) -> Self {
14211                 if self.result_ok {
14212                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14213                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14214                         } }
14215                 } else {
14216                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14217                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14218                         } }
14219                 }
14220         }
14221 }
14222 #[no_mangle]
14223 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14224 /// but with all dynamically-allocated buffers duplicated in new buffers.
14225 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14226 #[repr(C)]
14227 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14228 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14229         /// A pointer to the contents in the success state.
14230         /// Reading from this pointer when `result_ok` is not set is undefined.
14231         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14232         /// A pointer to the contents in the error state.
14233         /// Reading from this pointer when `result_ok` is set is undefined.
14234         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14235 }
14236 #[repr(C)]
14237 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14238 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14239 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14240 pub struct CResult_ChannelUpdateDecodeErrorZ {
14241         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14242         /// `err` or `result` depending on the state of `result_ok`.
14243         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14244         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14245         pub result_ok: bool,
14246 }
14247 #[no_mangle]
14248 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14249 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14250         CResult_ChannelUpdateDecodeErrorZ {
14251                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14252                         result: Box::into_raw(Box::new(o)),
14253                 },
14254                 result_ok: true,
14255         }
14256 }
14257 #[no_mangle]
14258 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14259 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14260         CResult_ChannelUpdateDecodeErrorZ {
14261                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14262                         err: Box::into_raw(Box::new(e)),
14263                 },
14264                 result_ok: false,
14265         }
14266 }
14267 /// Checks if the given object is currently in the success state
14268 #[no_mangle]
14269 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14270         o.result_ok
14271 }
14272 #[no_mangle]
14273 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14274 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14275 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14276         fn drop(&mut self) {
14277                 if self.result_ok {
14278                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14279                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14280                         }
14281                 } else {
14282                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14283                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14284                         }
14285                 }
14286         }
14287 }
14288 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14289         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14290                 let contents = if o.result_ok {
14291                         let result = unsafe { o.contents.result };
14292                         unsafe { o.contents.result = core::ptr::null_mut() };
14293                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14294                 } else {
14295                         let err = unsafe { o.contents.err };
14296                         unsafe { o.contents.err = core::ptr::null_mut(); }
14297                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14298                 };
14299                 Self {
14300                         contents,
14301                         result_ok: o.result_ok,
14302                 }
14303         }
14304 }
14305 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14306         fn clone(&self) -> Self {
14307                 if self.result_ok {
14308                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14309                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14310                         } }
14311                 } else {
14312                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14313                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14314                         } }
14315                 }
14316         }
14317 }
14318 #[no_mangle]
14319 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14320 /// but with all dynamically-allocated buffers duplicated in new buffers.
14321 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14322 #[repr(C)]
14323 /// The contents of CResult_ErrorMessageDecodeErrorZ
14324 pub union CResult_ErrorMessageDecodeErrorZPtr {
14325         /// A pointer to the contents in the success state.
14326         /// Reading from this pointer when `result_ok` is not set is undefined.
14327         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14328         /// A pointer to the contents in the error state.
14329         /// Reading from this pointer when `result_ok` is set is undefined.
14330         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14331 }
14332 #[repr(C)]
14333 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14334 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14335 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14336 pub struct CResult_ErrorMessageDecodeErrorZ {
14337         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14338         /// `err` or `result` depending on the state of `result_ok`.
14339         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14340         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14341         pub result_ok: bool,
14342 }
14343 #[no_mangle]
14344 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14345 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14346         CResult_ErrorMessageDecodeErrorZ {
14347                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14348                         result: Box::into_raw(Box::new(o)),
14349                 },
14350                 result_ok: true,
14351         }
14352 }
14353 #[no_mangle]
14354 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14355 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14356         CResult_ErrorMessageDecodeErrorZ {
14357                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14358                         err: Box::into_raw(Box::new(e)),
14359                 },
14360                 result_ok: false,
14361         }
14362 }
14363 /// Checks if the given object is currently in the success state
14364 #[no_mangle]
14365 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14366         o.result_ok
14367 }
14368 #[no_mangle]
14369 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14370 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14371 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14372         fn drop(&mut self) {
14373                 if self.result_ok {
14374                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14375                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14376                         }
14377                 } else {
14378                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14379                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14380                         }
14381                 }
14382         }
14383 }
14384 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14385         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14386                 let contents = if o.result_ok {
14387                         let result = unsafe { o.contents.result };
14388                         unsafe { o.contents.result = core::ptr::null_mut() };
14389                         CResult_ErrorMessageDecodeErrorZPtr { result }
14390                 } else {
14391                         let err = unsafe { o.contents.err };
14392                         unsafe { o.contents.err = core::ptr::null_mut(); }
14393                         CResult_ErrorMessageDecodeErrorZPtr { err }
14394                 };
14395                 Self {
14396                         contents,
14397                         result_ok: o.result_ok,
14398                 }
14399         }
14400 }
14401 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14402         fn clone(&self) -> Self {
14403                 if self.result_ok {
14404                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14405                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14406                         } }
14407                 } else {
14408                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14409                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14410                         } }
14411                 }
14412         }
14413 }
14414 #[no_mangle]
14415 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14416 /// but with all dynamically-allocated buffers duplicated in new buffers.
14417 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14418 #[repr(C)]
14419 /// The contents of CResult_WarningMessageDecodeErrorZ
14420 pub union CResult_WarningMessageDecodeErrorZPtr {
14421         /// A pointer to the contents in the success state.
14422         /// Reading from this pointer when `result_ok` is not set is undefined.
14423         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14424         /// A pointer to the contents in the error state.
14425         /// Reading from this pointer when `result_ok` is set is undefined.
14426         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14427 }
14428 #[repr(C)]
14429 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14430 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14431 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14432 pub struct CResult_WarningMessageDecodeErrorZ {
14433         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14434         /// `err` or `result` depending on the state of `result_ok`.
14435         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14436         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14437         pub result_ok: bool,
14438 }
14439 #[no_mangle]
14440 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14441 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14442         CResult_WarningMessageDecodeErrorZ {
14443                 contents: CResult_WarningMessageDecodeErrorZPtr {
14444                         result: Box::into_raw(Box::new(o)),
14445                 },
14446                 result_ok: true,
14447         }
14448 }
14449 #[no_mangle]
14450 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14451 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14452         CResult_WarningMessageDecodeErrorZ {
14453                 contents: CResult_WarningMessageDecodeErrorZPtr {
14454                         err: Box::into_raw(Box::new(e)),
14455                 },
14456                 result_ok: false,
14457         }
14458 }
14459 /// Checks if the given object is currently in the success state
14460 #[no_mangle]
14461 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14462         o.result_ok
14463 }
14464 #[no_mangle]
14465 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14466 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14467 impl Drop for CResult_WarningMessageDecodeErrorZ {
14468         fn drop(&mut self) {
14469                 if self.result_ok {
14470                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14471                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14472                         }
14473                 } else {
14474                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14475                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14476                         }
14477                 }
14478         }
14479 }
14480 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14481         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14482                 let contents = if o.result_ok {
14483                         let result = unsafe { o.contents.result };
14484                         unsafe { o.contents.result = core::ptr::null_mut() };
14485                         CResult_WarningMessageDecodeErrorZPtr { result }
14486                 } else {
14487                         let err = unsafe { o.contents.err };
14488                         unsafe { o.contents.err = core::ptr::null_mut(); }
14489                         CResult_WarningMessageDecodeErrorZPtr { err }
14490                 };
14491                 Self {
14492                         contents,
14493                         result_ok: o.result_ok,
14494                 }
14495         }
14496 }
14497 impl Clone for CResult_WarningMessageDecodeErrorZ {
14498         fn clone(&self) -> Self {
14499                 if self.result_ok {
14500                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14501                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14502                         } }
14503                 } else {
14504                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14505                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14506                         } }
14507                 }
14508         }
14509 }
14510 #[no_mangle]
14511 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14512 /// but with all dynamically-allocated buffers duplicated in new buffers.
14513 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14514 #[repr(C)]
14515 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14516 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14517         /// A pointer to the contents in the success state.
14518         /// Reading from this pointer when `result_ok` is not set is undefined.
14519         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14520         /// A pointer to the contents in the error state.
14521         /// Reading from this pointer when `result_ok` is set is undefined.
14522         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14523 }
14524 #[repr(C)]
14525 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14526 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14527 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14528 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14529         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14530         /// `err` or `result` depending on the state of `result_ok`.
14531         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14532         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14533         pub result_ok: bool,
14534 }
14535 #[no_mangle]
14536 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14537 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14538         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14539                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14540                         result: Box::into_raw(Box::new(o)),
14541                 },
14542                 result_ok: true,
14543         }
14544 }
14545 #[no_mangle]
14546 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14547 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14548         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14549                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14550                         err: Box::into_raw(Box::new(e)),
14551                 },
14552                 result_ok: false,
14553         }
14554 }
14555 /// Checks if the given object is currently in the success state
14556 #[no_mangle]
14557 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14558         o.result_ok
14559 }
14560 #[no_mangle]
14561 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14562 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14563 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14564         fn drop(&mut self) {
14565                 if self.result_ok {
14566                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14567                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14568                         }
14569                 } else {
14570                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14571                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14572                         }
14573                 }
14574         }
14575 }
14576 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14577         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14578                 let contents = if o.result_ok {
14579                         let result = unsafe { o.contents.result };
14580                         unsafe { o.contents.result = core::ptr::null_mut() };
14581                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14582                 } else {
14583                         let err = unsafe { o.contents.err };
14584                         unsafe { o.contents.err = core::ptr::null_mut(); }
14585                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14586                 };
14587                 Self {
14588                         contents,
14589                         result_ok: o.result_ok,
14590                 }
14591         }
14592 }
14593 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14594         fn clone(&self) -> Self {
14595                 if self.result_ok {
14596                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14597                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14598                         } }
14599                 } else {
14600                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14601                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14602                         } }
14603                 }
14604         }
14605 }
14606 #[no_mangle]
14607 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14608 /// but with all dynamically-allocated buffers duplicated in new buffers.
14609 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14610 #[repr(C)]
14611 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14612 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14613         /// A pointer to the contents in the success state.
14614         /// Reading from this pointer when `result_ok` is not set is undefined.
14615         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14616         /// A pointer to the contents in the error state.
14617         /// Reading from this pointer when `result_ok` is set is undefined.
14618         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14619 }
14620 #[repr(C)]
14621 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14622 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14624 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14625         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14626         /// `err` or `result` depending on the state of `result_ok`.
14627         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14628         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14629         pub result_ok: bool,
14630 }
14631 #[no_mangle]
14632 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14633 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14634         CResult_NodeAnnouncementDecodeErrorZ {
14635                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14636                         result: Box::into_raw(Box::new(o)),
14637                 },
14638                 result_ok: true,
14639         }
14640 }
14641 #[no_mangle]
14642 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14643 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14644         CResult_NodeAnnouncementDecodeErrorZ {
14645                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14646                         err: Box::into_raw(Box::new(e)),
14647                 },
14648                 result_ok: false,
14649         }
14650 }
14651 /// Checks if the given object is currently in the success state
14652 #[no_mangle]
14653 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14654         o.result_ok
14655 }
14656 #[no_mangle]
14657 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14658 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14659 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14660         fn drop(&mut self) {
14661                 if self.result_ok {
14662                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14663                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14664                         }
14665                 } else {
14666                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14667                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14668                         }
14669                 }
14670         }
14671 }
14672 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14673         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14674                 let contents = if o.result_ok {
14675                         let result = unsafe { o.contents.result };
14676                         unsafe { o.contents.result = core::ptr::null_mut() };
14677                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14678                 } else {
14679                         let err = unsafe { o.contents.err };
14680                         unsafe { o.contents.err = core::ptr::null_mut(); }
14681                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14682                 };
14683                 Self {
14684                         contents,
14685                         result_ok: o.result_ok,
14686                 }
14687         }
14688 }
14689 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14690         fn clone(&self) -> Self {
14691                 if self.result_ok {
14692                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14693                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14694                         } }
14695                 } else {
14696                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14697                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14698                         } }
14699                 }
14700         }
14701 }
14702 #[no_mangle]
14703 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14704 /// but with all dynamically-allocated buffers duplicated in new buffers.
14705 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14706 #[repr(C)]
14707 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14708 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14709         /// A pointer to the contents in the success state.
14710         /// Reading from this pointer when `result_ok` is not set is undefined.
14711         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14712         /// A pointer to the contents in the error state.
14713         /// Reading from this pointer when `result_ok` is set is undefined.
14714         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14715 }
14716 #[repr(C)]
14717 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14718 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14719 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14720 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14721         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14722         /// `err` or `result` depending on the state of `result_ok`.
14723         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14724         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14725         pub result_ok: bool,
14726 }
14727 #[no_mangle]
14728 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14729 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14730         CResult_QueryShortChannelIdsDecodeErrorZ {
14731                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14732                         result: Box::into_raw(Box::new(o)),
14733                 },
14734                 result_ok: true,
14735         }
14736 }
14737 #[no_mangle]
14738 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14739 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14740         CResult_QueryShortChannelIdsDecodeErrorZ {
14741                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14742                         err: Box::into_raw(Box::new(e)),
14743                 },
14744                 result_ok: false,
14745         }
14746 }
14747 /// Checks if the given object is currently in the success state
14748 #[no_mangle]
14749 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14750         o.result_ok
14751 }
14752 #[no_mangle]
14753 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14754 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14755 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14756         fn drop(&mut self) {
14757                 if self.result_ok {
14758                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14759                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14760                         }
14761                 } else {
14762                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14763                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14764                         }
14765                 }
14766         }
14767 }
14768 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14769         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14770                 let contents = if o.result_ok {
14771                         let result = unsafe { o.contents.result };
14772                         unsafe { o.contents.result = core::ptr::null_mut() };
14773                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14774                 } else {
14775                         let err = unsafe { o.contents.err };
14776                         unsafe { o.contents.err = core::ptr::null_mut(); }
14777                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14778                 };
14779                 Self {
14780                         contents,
14781                         result_ok: o.result_ok,
14782                 }
14783         }
14784 }
14785 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14786         fn clone(&self) -> Self {
14787                 if self.result_ok {
14788                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14789                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14790                         } }
14791                 } else {
14792                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14793                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14794                         } }
14795                 }
14796         }
14797 }
14798 #[no_mangle]
14799 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14800 /// but with all dynamically-allocated buffers duplicated in new buffers.
14801 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14802 #[repr(C)]
14803 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14804 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14805         /// A pointer to the contents in the success state.
14806         /// Reading from this pointer when `result_ok` is not set is undefined.
14807         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14808         /// A pointer to the contents in the error state.
14809         /// Reading from this pointer when `result_ok` is set is undefined.
14810         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14811 }
14812 #[repr(C)]
14813 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14814 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14815 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14816 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14817         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14818         /// `err` or `result` depending on the state of `result_ok`.
14819         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14820         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14821         pub result_ok: bool,
14822 }
14823 #[no_mangle]
14824 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14825 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14826         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14827                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14828                         result: Box::into_raw(Box::new(o)),
14829                 },
14830                 result_ok: true,
14831         }
14832 }
14833 #[no_mangle]
14834 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14835 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14836         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14837                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14838                         err: Box::into_raw(Box::new(e)),
14839                 },
14840                 result_ok: false,
14841         }
14842 }
14843 /// Checks if the given object is currently in the success state
14844 #[no_mangle]
14845 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14846         o.result_ok
14847 }
14848 #[no_mangle]
14849 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14850 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14851 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14852         fn drop(&mut self) {
14853                 if self.result_ok {
14854                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14855                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14856                         }
14857                 } else {
14858                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14859                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14860                         }
14861                 }
14862         }
14863 }
14864 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14865         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14866                 let contents = if o.result_ok {
14867                         let result = unsafe { o.contents.result };
14868                         unsafe { o.contents.result = core::ptr::null_mut() };
14869                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14870                 } else {
14871                         let err = unsafe { o.contents.err };
14872                         unsafe { o.contents.err = core::ptr::null_mut(); }
14873                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14874                 };
14875                 Self {
14876                         contents,
14877                         result_ok: o.result_ok,
14878                 }
14879         }
14880 }
14881 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14882         fn clone(&self) -> Self {
14883                 if self.result_ok {
14884                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14885                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14886                         } }
14887                 } else {
14888                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14889                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14890                         } }
14891                 }
14892         }
14893 }
14894 #[no_mangle]
14895 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14896 /// but with all dynamically-allocated buffers duplicated in new buffers.
14897 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14898 #[repr(C)]
14899 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14900 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14901         /// A pointer to the contents in the success state.
14902         /// Reading from this pointer when `result_ok` is not set is undefined.
14903         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14904         /// A pointer to the contents in the error state.
14905         /// Reading from this pointer when `result_ok` is set is undefined.
14906         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14907 }
14908 #[repr(C)]
14909 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14910 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14912 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14913         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14914         /// `err` or `result` depending on the state of `result_ok`.
14915         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14916         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14917         pub result_ok: bool,
14918 }
14919 #[no_mangle]
14920 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14921 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14922         CResult_QueryChannelRangeDecodeErrorZ {
14923                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14924                         result: Box::into_raw(Box::new(o)),
14925                 },
14926                 result_ok: true,
14927         }
14928 }
14929 #[no_mangle]
14930 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14931 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14932         CResult_QueryChannelRangeDecodeErrorZ {
14933                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14934                         err: Box::into_raw(Box::new(e)),
14935                 },
14936                 result_ok: false,
14937         }
14938 }
14939 /// Checks if the given object is currently in the success state
14940 #[no_mangle]
14941 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14942         o.result_ok
14943 }
14944 #[no_mangle]
14945 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14946 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14947 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14948         fn drop(&mut self) {
14949                 if self.result_ok {
14950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14952                         }
14953                 } else {
14954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14956                         }
14957                 }
14958         }
14959 }
14960 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14961         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14962                 let contents = if o.result_ok {
14963                         let result = unsafe { o.contents.result };
14964                         unsafe { o.contents.result = core::ptr::null_mut() };
14965                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14966                 } else {
14967                         let err = unsafe { o.contents.err };
14968                         unsafe { o.contents.err = core::ptr::null_mut(); }
14969                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14970                 };
14971                 Self {
14972                         contents,
14973                         result_ok: o.result_ok,
14974                 }
14975         }
14976 }
14977 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14978         fn clone(&self) -> Self {
14979                 if self.result_ok {
14980                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14981                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14982                         } }
14983                 } else {
14984                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14985                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14986                         } }
14987                 }
14988         }
14989 }
14990 #[no_mangle]
14991 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14992 /// but with all dynamically-allocated buffers duplicated in new buffers.
14993 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14994 #[repr(C)]
14995 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14996 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14997         /// A pointer to the contents in the success state.
14998         /// Reading from this pointer when `result_ok` is not set is undefined.
14999         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
15000         /// A pointer to the contents in the error state.
15001         /// Reading from this pointer when `result_ok` is set is undefined.
15002         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15003 }
15004 #[repr(C)]
15005 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
15006 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
15007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15008 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
15009         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
15010         /// `err` or `result` depending on the state of `result_ok`.
15011         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
15012         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
15013         pub result_ok: bool,
15014 }
15015 #[no_mangle]
15016 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
15017 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
15018         CResult_ReplyChannelRangeDecodeErrorZ {
15019                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15020                         result: Box::into_raw(Box::new(o)),
15021                 },
15022                 result_ok: true,
15023         }
15024 }
15025 #[no_mangle]
15026 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
15027 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
15028         CResult_ReplyChannelRangeDecodeErrorZ {
15029                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15030                         err: Box::into_raw(Box::new(e)),
15031                 },
15032                 result_ok: false,
15033         }
15034 }
15035 /// Checks if the given object is currently in the success state
15036 #[no_mangle]
15037 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
15038         o.result_ok
15039 }
15040 #[no_mangle]
15041 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
15042 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
15043 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
15044         fn drop(&mut self) {
15045                 if self.result_ok {
15046                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15047                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15048                         }
15049                 } else {
15050                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15051                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15052                         }
15053                 }
15054         }
15055 }
15056 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15057         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15058                 let contents = if o.result_ok {
15059                         let result = unsafe { o.contents.result };
15060                         unsafe { o.contents.result = core::ptr::null_mut() };
15061                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15062                 } else {
15063                         let err = unsafe { o.contents.err };
15064                         unsafe { o.contents.err = core::ptr::null_mut(); }
15065                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15066                 };
15067                 Self {
15068                         contents,
15069                         result_ok: o.result_ok,
15070                 }
15071         }
15072 }
15073 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15074         fn clone(&self) -> Self {
15075                 if self.result_ok {
15076                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15077                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15078                         } }
15079                 } else {
15080                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15081                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15082                         } }
15083                 }
15084         }
15085 }
15086 #[no_mangle]
15087 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15088 /// but with all dynamically-allocated buffers duplicated in new buffers.
15089 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15090 #[repr(C)]
15091 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15092 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15093         /// A pointer to the contents in the success state.
15094         /// Reading from this pointer when `result_ok` is not set is undefined.
15095         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15096         /// A pointer to the contents in the error state.
15097         /// Reading from this pointer when `result_ok` is set is undefined.
15098         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15099 }
15100 #[repr(C)]
15101 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15102 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15103 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15104 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15105         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15106         /// `err` or `result` depending on the state of `result_ok`.
15107         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15108         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15109         pub result_ok: bool,
15110 }
15111 #[no_mangle]
15112 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15113 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15114         CResult_GossipTimestampFilterDecodeErrorZ {
15115                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15116                         result: Box::into_raw(Box::new(o)),
15117                 },
15118                 result_ok: true,
15119         }
15120 }
15121 #[no_mangle]
15122 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15123 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15124         CResult_GossipTimestampFilterDecodeErrorZ {
15125                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15126                         err: Box::into_raw(Box::new(e)),
15127                 },
15128                 result_ok: false,
15129         }
15130 }
15131 /// Checks if the given object is currently in the success state
15132 #[no_mangle]
15133 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15134         o.result_ok
15135 }
15136 #[no_mangle]
15137 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15138 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15139 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15140         fn drop(&mut self) {
15141                 if self.result_ok {
15142                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15143                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15144                         }
15145                 } else {
15146                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15147                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15148                         }
15149                 }
15150         }
15151 }
15152 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15153         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15154                 let contents = if o.result_ok {
15155                         let result = unsafe { o.contents.result };
15156                         unsafe { o.contents.result = core::ptr::null_mut() };
15157                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15158                 } else {
15159                         let err = unsafe { o.contents.err };
15160                         unsafe { o.contents.err = core::ptr::null_mut(); }
15161                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15162                 };
15163                 Self {
15164                         contents,
15165                         result_ok: o.result_ok,
15166                 }
15167         }
15168 }
15169 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15170         fn clone(&self) -> Self {
15171                 if self.result_ok {
15172                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15173                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15174                         } }
15175                 } else {
15176                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15177                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15178                         } }
15179                 }
15180         }
15181 }
15182 #[no_mangle]
15183 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15184 /// but with all dynamically-allocated buffers duplicated in new buffers.
15185 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15186 #[repr(C)]
15187 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15188 /// This corresponds to std::vector in C++
15189 pub struct CVec_PhantomRouteHintsZ {
15190         /// The elements in the array.
15191         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15192         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15193         /// The number of elements pointed to by `data`.
15194         pub datalen: usize
15195 }
15196 impl CVec_PhantomRouteHintsZ {
15197         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15198                 if self.datalen == 0 { return Vec::new(); }
15199                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15200                 self.data = core::ptr::null_mut();
15201                 self.datalen = 0;
15202                 ret
15203         }
15204         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15205                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15206         }
15207 }
15208 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15209         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15210                 let datalen = v.len();
15211                 let data = Box::into_raw(v.into_boxed_slice());
15212                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15213         }
15214 }
15215 #[no_mangle]
15216 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15217 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15218 impl Drop for CVec_PhantomRouteHintsZ {
15219         fn drop(&mut self) {
15220                 if self.datalen == 0 { return; }
15221                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15222         }
15223 }
15224 #[repr(C)]
15225 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15226 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15227         /// A pointer to the contents in the success state.
15228         /// Reading from this pointer when `result_ok` is not set is undefined.
15229         pub result: *mut crate::lightning_invoice::Invoice,
15230         /// A pointer to the contents in the error state.
15231         /// Reading from this pointer when `result_ok` is set is undefined.
15232         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15233 }
15234 #[repr(C)]
15235 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15236 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15237 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15238 pub struct CResult_InvoiceSignOrCreationErrorZ {
15239         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15240         /// `err` or `result` depending on the state of `result_ok`.
15241         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15242         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15243         pub result_ok: bool,
15244 }
15245 #[no_mangle]
15246 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15247 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15248         CResult_InvoiceSignOrCreationErrorZ {
15249                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15250                         result: Box::into_raw(Box::new(o)),
15251                 },
15252                 result_ok: true,
15253         }
15254 }
15255 #[no_mangle]
15256 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15257 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15258         CResult_InvoiceSignOrCreationErrorZ {
15259                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15260                         err: Box::into_raw(Box::new(e)),
15261                 },
15262                 result_ok: false,
15263         }
15264 }
15265 /// Checks if the given object is currently in the success state
15266 #[no_mangle]
15267 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15268         o.result_ok
15269 }
15270 #[no_mangle]
15271 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15272 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15273 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15274         fn drop(&mut self) {
15275                 if self.result_ok {
15276                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15277                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15278                         }
15279                 } else {
15280                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15281                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15282                         }
15283                 }
15284         }
15285 }
15286 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15287         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15288                 let contents = if o.result_ok {
15289                         let result = unsafe { o.contents.result };
15290                         unsafe { o.contents.result = core::ptr::null_mut() };
15291                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15292                 } else {
15293                         let err = unsafe { o.contents.err };
15294                         unsafe { o.contents.err = core::ptr::null_mut(); }
15295                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15296                 };
15297                 Self {
15298                         contents,
15299                         result_ok: o.result_ok,
15300                 }
15301         }
15302 }
15303 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15304         fn clone(&self) -> Self {
15305                 if self.result_ok {
15306                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15307                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15308                         } }
15309                 } else {
15310                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15311                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15312                         } }
15313                 }
15314         }
15315 }
15316 #[no_mangle]
15317 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15318 /// but with all dynamically-allocated buffers duplicated in new buffers.
15319 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15320 #[repr(C)]
15321 /// An enum which can either contain a crate::lightning::chain::Filter or not
15322 pub enum COption_FilterZ {
15323         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15324         Some(crate::lightning::chain::Filter),
15325         /// When we're in this state, this COption_FilterZ contains nothing
15326         None
15327 }
15328 impl COption_FilterZ {
15329         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15330                 if let Self::None = self { false } else { true }
15331         }
15332         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15333                 !self.is_some()
15334         }
15335         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15336                 if let Self::Some(v) = self { v } else { unreachable!() }
15337         }
15338 }
15339 #[no_mangle]
15340 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15341 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15342         COption_FilterZ::Some(o)
15343 }
15344 #[no_mangle]
15345 /// Constructs a new COption_FilterZ containing nothing
15346 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15347         COption_FilterZ::None
15348 }
15349 #[no_mangle]
15350 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15351 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15352 #[repr(C)]
15353 /// The contents of CResult_LockedChannelMonitorNoneZ
15354 pub union CResult_LockedChannelMonitorNoneZPtr {
15355         /// A pointer to the contents in the success state.
15356         /// Reading from this pointer when `result_ok` is not set is undefined.
15357         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15358         /// Note that this value is always NULL, as there are no contents in the Err variant
15359         pub err: *mut core::ffi::c_void,
15360 }
15361 #[repr(C)]
15362 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15363 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15365 pub struct CResult_LockedChannelMonitorNoneZ {
15366         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15367         /// `err` or `result` depending on the state of `result_ok`.
15368         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15369         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15370         pub result_ok: bool,
15371 }
15372 #[no_mangle]
15373 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15374 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15375         CResult_LockedChannelMonitorNoneZ {
15376                 contents: CResult_LockedChannelMonitorNoneZPtr {
15377                         result: Box::into_raw(Box::new(o)),
15378                 },
15379                 result_ok: true,
15380         }
15381 }
15382 #[no_mangle]
15383 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15384 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15385         CResult_LockedChannelMonitorNoneZ {
15386                 contents: CResult_LockedChannelMonitorNoneZPtr {
15387                         err: core::ptr::null_mut(),
15388                 },
15389                 result_ok: false,
15390         }
15391 }
15392 /// Checks if the given object is currently in the success state
15393 #[no_mangle]
15394 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15395         o.result_ok
15396 }
15397 #[no_mangle]
15398 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15399 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15400 impl Drop for CResult_LockedChannelMonitorNoneZ {
15401         fn drop(&mut self) {
15402                 if self.result_ok {
15403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15405                         }
15406                 } else {
15407                 }
15408         }
15409 }
15410 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15411         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15412                 let contents = if o.result_ok {
15413                         let result = unsafe { o.contents.result };
15414                         unsafe { o.contents.result = core::ptr::null_mut() };
15415                         CResult_LockedChannelMonitorNoneZPtr { result }
15416                 } else {
15417                         let _ = unsafe { Box::from_raw(o.contents.err) };
15418                         o.contents.err = core::ptr::null_mut();
15419                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15420                 };
15421                 Self {
15422                         contents,
15423                         result_ok: o.result_ok,
15424                 }
15425         }
15426 }
15427 #[repr(C)]
15428 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15429 /// This corresponds to std::vector in C++
15430 pub struct CVec_OutPointZ {
15431         /// The elements in the array.
15432         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15433         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15434         /// The number of elements pointed to by `data`.
15435         pub datalen: usize
15436 }
15437 impl CVec_OutPointZ {
15438         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15439                 if self.datalen == 0 { return Vec::new(); }
15440                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15441                 self.data = core::ptr::null_mut();
15442                 self.datalen = 0;
15443                 ret
15444         }
15445         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15446                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15447         }
15448 }
15449 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15450         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15451                 let datalen = v.len();
15452                 let data = Box::into_raw(v.into_boxed_slice());
15453                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15454         }
15455 }
15456 #[no_mangle]
15457 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15458 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15459 impl Drop for CVec_OutPointZ {
15460         fn drop(&mut self) {
15461                 if self.datalen == 0 { return; }
15462                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15463         }
15464 }
15465 impl Clone for CVec_OutPointZ {
15466         fn clone(&self) -> Self {
15467                 let mut res = Vec::new();
15468                 if self.datalen == 0 { return Self::from(res); }
15469                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15470                 Self::from(res)
15471         }
15472 }