Merge pull request #68 from jkczyz/2022-03-ldk-0-0-106
[ldk-c-bindings] / lightning-c-bindings / src / c_types / derived.rs
1
2 use alloc::str::FromStr;
3 use core::ffi::c_void;
4 use core::convert::Infallible;
5 use bitcoin::hashes::Hash;
6 use crate::c_types::*;
7 #[cfg(feature="no-std")]
8 use alloc::{vec::Vec, boxed::Box};
9
10 #[repr(C)]
11 /// The contents of CResult_NoneNoneZ
12 pub union CResult_NoneNoneZPtr {
13         /// Note that this value is always NULL, as there are no contents in the OK variant
14         pub result: *mut core::ffi::c_void,
15         /// Note that this value is always NULL, as there are no contents in the Err variant
16         pub err: *mut core::ffi::c_void,
17 }
18 #[repr(C)]
19 /// A CResult_NoneNoneZ represents the result of a fallible operation,
20 /// containing a () on success and a () on failure.
21 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
22 pub struct CResult_NoneNoneZ {
23         /// The contents of this CResult_NoneNoneZ, accessible via either
24         /// `err` or `result` depending on the state of `result_ok`.
25         pub contents: CResult_NoneNoneZPtr,
26         /// Whether this CResult_NoneNoneZ represents a success state.
27         pub result_ok: bool,
28 }
29 #[no_mangle]
30 /// Creates a new CResult_NoneNoneZ in the success state.
31 pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ {
32         CResult_NoneNoneZ {
33                 contents: CResult_NoneNoneZPtr {
34                         result: core::ptr::null_mut(),
35                 },
36                 result_ok: true,
37         }
38 }
39 #[no_mangle]
40 /// Creates a new CResult_NoneNoneZ in the error state.
41 pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ {
42         CResult_NoneNoneZ {
43                 contents: CResult_NoneNoneZPtr {
44                         err: core::ptr::null_mut(),
45                 },
46                 result_ok: false,
47         }
48 }
49 /// Checks if the given object is currently in the success state
50 #[no_mangle]
51 pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool {
52         o.result_ok
53 }
54 #[no_mangle]
55 /// Frees any resources used by the CResult_NoneNoneZ.
56 pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { }
57 impl Drop for CResult_NoneNoneZ {
58         fn drop(&mut self) {
59                 if self.result_ok {
60                 } else {
61                 }
62         }
63 }
64 impl From<crate::c_types::CResultTempl<(), ()>> for CResult_NoneNoneZ {
65         fn from(mut o: crate::c_types::CResultTempl<(), ()>) -> Self {
66                 let contents = if o.result_ok {
67                         let _ = unsafe { Box::from_raw(o.contents.result) };
68                         o.contents.result = core::ptr::null_mut();
69                         CResult_NoneNoneZPtr { result: core::ptr::null_mut() }
70                 } else {
71                         let _ = unsafe { Box::from_raw(o.contents.err) };
72                         o.contents.err = core::ptr::null_mut();
73                         CResult_NoneNoneZPtr { err: core::ptr::null_mut() }
74                 };
75                 Self {
76                         contents,
77                         result_ok: o.result_ok,
78                 }
79         }
80 }
81 impl Clone for CResult_NoneNoneZ {
82         fn clone(&self) -> Self {
83                 if self.result_ok {
84                         Self { result_ok: true, contents: CResult_NoneNoneZPtr {
85                                 result: core::ptr::null_mut()
86                         } }
87                 } else {
88                         Self { result_ok: false, contents: CResult_NoneNoneZPtr {
89                                 err: core::ptr::null_mut()
90                         } }
91                 }
92         }
93 }
94 #[no_mangle]
95 /// Creates a new CResult_NoneNoneZ which has the same data as `orig`
96 /// but with all dynamically-allocated buffers duplicated in new buffers.
97 pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) }
98 #[repr(C)]
99 /// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
100 pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
101         /// A pointer to the contents in the success state.
102         /// Reading from this pointer when `result_ok` is not set is undefined.
103         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets,
104         /// A pointer to the contents in the error state.
105         /// Reading from this pointer when `result_ok` is set is undefined.
106         pub err: *mut crate::lightning::ln::msgs::DecodeError,
107 }
108 #[repr(C)]
109 /// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
110 /// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
111 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
112 pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
113         /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
114         /// `err` or `result` depending on the state of `result_ok`.
115         pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr,
116         /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
117         pub result_ok: bool,
118 }
119 #[no_mangle]
120 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
121 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
122         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
123                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
124                         result: Box::into_raw(Box::new(o)),
125                 },
126                 result_ok: true,
127         }
128 }
129 #[no_mangle]
130 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
131 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
132         CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
133                 contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
134                         err: Box::into_raw(Box::new(e)),
135                 },
136                 result_ok: false,
137         }
138 }
139 /// Checks if the given object is currently in the success state
140 #[no_mangle]
141 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool {
142         o.result_ok
143 }
144 #[no_mangle]
145 /// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
146 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { }
147 impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
148         fn drop(&mut self) {
149                 if self.result_ok {
150                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
151                                 let _ = unsafe { Box::from_raw(self.contents.result) };
152                         }
153                 } else {
154                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.err) };
156                         }
157                 }
158         }
159 }
160 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
161         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets, crate::lightning::ln::msgs::DecodeError>) -> Self {
162                 let contents = if o.result_ok {
163                         let result = unsafe { o.contents.result };
164                         unsafe { o.contents.result = core::ptr::null_mut() };
165                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { result }
166                 } else {
167                         let err = unsafe { o.contents.err };
168                         unsafe { o.contents.err = core::ptr::null_mut(); }
169                         CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err }
170                 };
171                 Self {
172                         contents,
173                         result_ok: o.result_ok,
174                 }
175         }
176 }
177 impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ {
178         fn clone(&self) -> Self {
179                 if self.result_ok {
180                         Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
181                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets>::clone(unsafe { &*self.contents.result })))
182                         } }
183                 } else {
184                         Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
185                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
186                         } }
187                 }
188         }
189 }
190 #[no_mangle]
191 /// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
192 /// but with all dynamically-allocated buffers duplicated in new buffers.
193 pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) }
194 #[repr(C)]
195 /// The contents of CResult_SecretKeyErrorZ
196 pub union CResult_SecretKeyErrorZPtr {
197         /// A pointer to the contents in the success state.
198         /// Reading from this pointer when `result_ok` is not set is undefined.
199         pub result: *mut crate::c_types::SecretKey,
200         /// A pointer to the contents in the error state.
201         /// Reading from this pointer when `result_ok` is set is undefined.
202         pub err: *mut crate::c_types::Secp256k1Error,
203 }
204 #[repr(C)]
205 /// A CResult_SecretKeyErrorZ represents the result of a fallible operation,
206 /// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
207 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
208 pub struct CResult_SecretKeyErrorZ {
209         /// The contents of this CResult_SecretKeyErrorZ, accessible via either
210         /// `err` or `result` depending on the state of `result_ok`.
211         pub contents: CResult_SecretKeyErrorZPtr,
212         /// Whether this CResult_SecretKeyErrorZ represents a success state.
213         pub result_ok: bool,
214 }
215 #[no_mangle]
216 /// Creates a new CResult_SecretKeyErrorZ in the success state.
217 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
218         CResult_SecretKeyErrorZ {
219                 contents: CResult_SecretKeyErrorZPtr {
220                         result: Box::into_raw(Box::new(o)),
221                 },
222                 result_ok: true,
223         }
224 }
225 #[no_mangle]
226 /// Creates a new CResult_SecretKeyErrorZ in the error state.
227 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
228         CResult_SecretKeyErrorZ {
229                 contents: CResult_SecretKeyErrorZPtr {
230                         err: Box::into_raw(Box::new(e)),
231                 },
232                 result_ok: false,
233         }
234 }
235 /// Checks if the given object is currently in the success state
236 #[no_mangle]
237 pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool {
238         o.result_ok
239 }
240 #[no_mangle]
241 /// Frees any resources used by the CResult_SecretKeyErrorZ.
242 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
243 impl Drop for CResult_SecretKeyErrorZ {
244         fn drop(&mut self) {
245                 if self.result_ok {
246                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
247                                 let _ = unsafe { Box::from_raw(self.contents.result) };
248                         }
249                 } else {
250                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
251                                 let _ = unsafe { Box::from_raw(self.contents.err) };
252                         }
253                 }
254         }
255 }
256 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
257         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
258                 let contents = if o.result_ok {
259                         let result = unsafe { o.contents.result };
260                         unsafe { o.contents.result = core::ptr::null_mut() };
261                         CResult_SecretKeyErrorZPtr { result }
262                 } else {
263                         let err = unsafe { o.contents.err };
264                         unsafe { o.contents.err = core::ptr::null_mut(); }
265                         CResult_SecretKeyErrorZPtr { err }
266                 };
267                 Self {
268                         contents,
269                         result_ok: o.result_ok,
270                 }
271         }
272 }
273 impl Clone for CResult_SecretKeyErrorZ {
274         fn clone(&self) -> Self {
275                 if self.result_ok {
276                         Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr {
277                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
278                         } }
279                 } else {
280                         Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr {
281                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
282                         } }
283                 }
284         }
285 }
286 #[no_mangle]
287 /// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
288 /// but with all dynamically-allocated buffers duplicated in new buffers.
289 pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) }
290 #[repr(C)]
291 /// The contents of CResult_PublicKeyErrorZ
292 pub union CResult_PublicKeyErrorZPtr {
293         /// A pointer to the contents in the success state.
294         /// Reading from this pointer when `result_ok` is not set is undefined.
295         pub result: *mut crate::c_types::PublicKey,
296         /// A pointer to the contents in the error state.
297         /// Reading from this pointer when `result_ok` is set is undefined.
298         pub err: *mut crate::c_types::Secp256k1Error,
299 }
300 #[repr(C)]
301 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
302 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
303 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
304 pub struct CResult_PublicKeyErrorZ {
305         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
306         /// `err` or `result` depending on the state of `result_ok`.
307         pub contents: CResult_PublicKeyErrorZPtr,
308         /// Whether this CResult_PublicKeyErrorZ represents a success state.
309         pub result_ok: bool,
310 }
311 #[no_mangle]
312 /// Creates a new CResult_PublicKeyErrorZ in the success state.
313 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
314         CResult_PublicKeyErrorZ {
315                 contents: CResult_PublicKeyErrorZPtr {
316                         result: Box::into_raw(Box::new(o)),
317                 },
318                 result_ok: true,
319         }
320 }
321 #[no_mangle]
322 /// Creates a new CResult_PublicKeyErrorZ in the error state.
323 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
324         CResult_PublicKeyErrorZ {
325                 contents: CResult_PublicKeyErrorZPtr {
326                         err: Box::into_raw(Box::new(e)),
327                 },
328                 result_ok: false,
329         }
330 }
331 /// Checks if the given object is currently in the success state
332 #[no_mangle]
333 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
334         o.result_ok
335 }
336 #[no_mangle]
337 /// Frees any resources used by the CResult_PublicKeyErrorZ.
338 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
339 impl Drop for CResult_PublicKeyErrorZ {
340         fn drop(&mut self) {
341                 if self.result_ok {
342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
344                         }
345                 } else {
346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
348                         }
349                 }
350         }
351 }
352 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
353         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
354                 let contents = if o.result_ok {
355                         let result = unsafe { o.contents.result };
356                         unsafe { o.contents.result = core::ptr::null_mut() };
357                         CResult_PublicKeyErrorZPtr { result }
358                 } else {
359                         let err = unsafe { o.contents.err };
360                         unsafe { o.contents.err = core::ptr::null_mut(); }
361                         CResult_PublicKeyErrorZPtr { err }
362                 };
363                 Self {
364                         contents,
365                         result_ok: o.result_ok,
366                 }
367         }
368 }
369 impl Clone for CResult_PublicKeyErrorZ {
370         fn clone(&self) -> Self {
371                 if self.result_ok {
372                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
373                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
374                         } }
375                 } else {
376                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
377                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
378                         } }
379                 }
380         }
381 }
382 #[no_mangle]
383 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
384 /// but with all dynamically-allocated buffers duplicated in new buffers.
385 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
386 #[repr(C)]
387 /// The contents of CResult_TxCreationKeysDecodeErrorZ
388 pub union CResult_TxCreationKeysDecodeErrorZPtr {
389         /// A pointer to the contents in the success state.
390         /// Reading from this pointer when `result_ok` is not set is undefined.
391         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
392         /// A pointer to the contents in the error state.
393         /// Reading from this pointer when `result_ok` is set is undefined.
394         pub err: *mut crate::lightning::ln::msgs::DecodeError,
395 }
396 #[repr(C)]
397 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
398 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
399 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
400 pub struct CResult_TxCreationKeysDecodeErrorZ {
401         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
402         /// `err` or `result` depending on the state of `result_ok`.
403         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
404         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
405         pub result_ok: bool,
406 }
407 #[no_mangle]
408 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
409 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
410         CResult_TxCreationKeysDecodeErrorZ {
411                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
412                         result: Box::into_raw(Box::new(o)),
413                 },
414                 result_ok: true,
415         }
416 }
417 #[no_mangle]
418 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
419 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
420         CResult_TxCreationKeysDecodeErrorZ {
421                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
422                         err: Box::into_raw(Box::new(e)),
423                 },
424                 result_ok: false,
425         }
426 }
427 /// Checks if the given object is currently in the success state
428 #[no_mangle]
429 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
430         o.result_ok
431 }
432 #[no_mangle]
433 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
434 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
435 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
436         fn drop(&mut self) {
437                 if self.result_ok {
438                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
439                                 let _ = unsafe { Box::from_raw(self.contents.result) };
440                         }
441                 } else {
442                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
443                                 let _ = unsafe { Box::from_raw(self.contents.err) };
444                         }
445                 }
446         }
447 }
448 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
449         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
450                 let contents = if o.result_ok {
451                         let result = unsafe { o.contents.result };
452                         unsafe { o.contents.result = core::ptr::null_mut() };
453                         CResult_TxCreationKeysDecodeErrorZPtr { result }
454                 } else {
455                         let err = unsafe { o.contents.err };
456                         unsafe { o.contents.err = core::ptr::null_mut(); }
457                         CResult_TxCreationKeysDecodeErrorZPtr { err }
458                 };
459                 Self {
460                         contents,
461                         result_ok: o.result_ok,
462                 }
463         }
464 }
465 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
466         fn clone(&self) -> Self {
467                 if self.result_ok {
468                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
469                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
470                         } }
471                 } else {
472                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
473                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
474                         } }
475                 }
476         }
477 }
478 #[no_mangle]
479 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
480 /// but with all dynamically-allocated buffers duplicated in new buffers.
481 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
482 #[repr(C)]
483 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
484 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
485         /// A pointer to the contents in the success state.
486         /// Reading from this pointer when `result_ok` is not set is undefined.
487         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
488         /// A pointer to the contents in the error state.
489         /// Reading from this pointer when `result_ok` is set is undefined.
490         pub err: *mut crate::lightning::ln::msgs::DecodeError,
491 }
492 #[repr(C)]
493 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
494 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
495 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
496 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
497         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
498         /// `err` or `result` depending on the state of `result_ok`.
499         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
500         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
501         pub result_ok: bool,
502 }
503 #[no_mangle]
504 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
505 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
506         CResult_ChannelPublicKeysDecodeErrorZ {
507                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
508                         result: Box::into_raw(Box::new(o)),
509                 },
510                 result_ok: true,
511         }
512 }
513 #[no_mangle]
514 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
515 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
516         CResult_ChannelPublicKeysDecodeErrorZ {
517                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
518                         err: Box::into_raw(Box::new(e)),
519                 },
520                 result_ok: false,
521         }
522 }
523 /// Checks if the given object is currently in the success state
524 #[no_mangle]
525 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
526         o.result_ok
527 }
528 #[no_mangle]
529 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
530 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
531 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
532         fn drop(&mut self) {
533                 if self.result_ok {
534                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
535                                 let _ = unsafe { Box::from_raw(self.contents.result) };
536                         }
537                 } else {
538                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
539                                 let _ = unsafe { Box::from_raw(self.contents.err) };
540                         }
541                 }
542         }
543 }
544 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
546                 let contents = if o.result_ok {
547                         let result = unsafe { o.contents.result };
548                         unsafe { o.contents.result = core::ptr::null_mut() };
549                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
550                 } else {
551                         let err = unsafe { o.contents.err };
552                         unsafe { o.contents.err = core::ptr::null_mut(); }
553                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
554                 };
555                 Self {
556                         contents,
557                         result_ok: o.result_ok,
558                 }
559         }
560 }
561 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
562         fn clone(&self) -> Self {
563                 if self.result_ok {
564                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
565                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
566                         } }
567                 } else {
568                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
569                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
570                         } }
571                 }
572         }
573 }
574 #[no_mangle]
575 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
576 /// but with all dynamically-allocated buffers duplicated in new buffers.
577 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
578 #[repr(C)]
579 /// The contents of CResult_TxCreationKeysErrorZ
580 pub union CResult_TxCreationKeysErrorZPtr {
581         /// A pointer to the contents in the success state.
582         /// Reading from this pointer when `result_ok` is not set is undefined.
583         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
584         /// A pointer to the contents in the error state.
585         /// Reading from this pointer when `result_ok` is set is undefined.
586         pub err: *mut crate::c_types::Secp256k1Error,
587 }
588 #[repr(C)]
589 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
590 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
591 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
592 pub struct CResult_TxCreationKeysErrorZ {
593         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
594         /// `err` or `result` depending on the state of `result_ok`.
595         pub contents: CResult_TxCreationKeysErrorZPtr,
596         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
597         pub result_ok: bool,
598 }
599 #[no_mangle]
600 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
601 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
602         CResult_TxCreationKeysErrorZ {
603                 contents: CResult_TxCreationKeysErrorZPtr {
604                         result: Box::into_raw(Box::new(o)),
605                 },
606                 result_ok: true,
607         }
608 }
609 #[no_mangle]
610 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
611 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
612         CResult_TxCreationKeysErrorZ {
613                 contents: CResult_TxCreationKeysErrorZPtr {
614                         err: Box::into_raw(Box::new(e)),
615                 },
616                 result_ok: false,
617         }
618 }
619 /// Checks if the given object is currently in the success state
620 #[no_mangle]
621 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
622         o.result_ok
623 }
624 #[no_mangle]
625 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
626 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
627 impl Drop for CResult_TxCreationKeysErrorZ {
628         fn drop(&mut self) {
629                 if self.result_ok {
630                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
631                                 let _ = unsafe { Box::from_raw(self.contents.result) };
632                         }
633                 } else {
634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
636                         }
637                 }
638         }
639 }
640 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
641         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
642                 let contents = if o.result_ok {
643                         let result = unsafe { o.contents.result };
644                         unsafe { o.contents.result = core::ptr::null_mut() };
645                         CResult_TxCreationKeysErrorZPtr { result }
646                 } else {
647                         let err = unsafe { o.contents.err };
648                         unsafe { o.contents.err = core::ptr::null_mut(); }
649                         CResult_TxCreationKeysErrorZPtr { err }
650                 };
651                 Self {
652                         contents,
653                         result_ok: o.result_ok,
654                 }
655         }
656 }
657 impl Clone for CResult_TxCreationKeysErrorZ {
658         fn clone(&self) -> Self {
659                 if self.result_ok {
660                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
661                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
662                         } }
663                 } else {
664                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
665                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
666                         } }
667                 }
668         }
669 }
670 #[no_mangle]
671 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
672 /// but with all dynamically-allocated buffers duplicated in new buffers.
673 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
674 #[repr(C)]
675 #[derive(Clone)]
676 /// An enum which can either contain a u32 or not
677 pub enum COption_u32Z {
678         /// When we're in this state, this COption_u32Z contains a u32
679         Some(u32),
680         /// When we're in this state, this COption_u32Z contains nothing
681         None
682 }
683 impl COption_u32Z {
684         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
685                 if let Self::None = self { false } else { true }
686         }
687         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
688                 !self.is_some()
689         }
690         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
691                 if let Self::Some(v) = self { v } else { unreachable!() }
692         }
693 }
694 #[no_mangle]
695 /// Constructs a new COption_u32Z containing a u32
696 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
697         COption_u32Z::Some(o)
698 }
699 #[no_mangle]
700 /// Constructs a new COption_u32Z containing nothing
701 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
702         COption_u32Z::None
703 }
704 #[no_mangle]
705 /// Frees any resources associated with the u32, if we are in the Some state
706 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
707 #[no_mangle]
708 /// Creates a new COption_u32Z which has the same data as `orig`
709 /// but with all dynamically-allocated buffers duplicated in new buffers.
710 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
711 #[repr(C)]
712 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
713 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
714         /// A pointer to the contents in the success state.
715         /// Reading from this pointer when `result_ok` is not set is undefined.
716         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
717         /// A pointer to the contents in the error state.
718         /// Reading from this pointer when `result_ok` is set is undefined.
719         pub err: *mut crate::lightning::ln::msgs::DecodeError,
720 }
721 #[repr(C)]
722 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
723 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
724 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
725 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
726         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
727         /// `err` or `result` depending on the state of `result_ok`.
728         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
729         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
730         pub result_ok: bool,
731 }
732 #[no_mangle]
733 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
734 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
735         CResult_HTLCOutputInCommitmentDecodeErrorZ {
736                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
737                         result: Box::into_raw(Box::new(o)),
738                 },
739                 result_ok: true,
740         }
741 }
742 #[no_mangle]
743 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
744 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
745         CResult_HTLCOutputInCommitmentDecodeErrorZ {
746                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
747                         err: Box::into_raw(Box::new(e)),
748                 },
749                 result_ok: false,
750         }
751 }
752 /// Checks if the given object is currently in the success state
753 #[no_mangle]
754 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
755         o.result_ok
756 }
757 #[no_mangle]
758 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
759 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
760 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
761         fn drop(&mut self) {
762                 if self.result_ok {
763                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
764                                 let _ = unsafe { Box::from_raw(self.contents.result) };
765                         }
766                 } else {
767                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
768                                 let _ = unsafe { Box::from_raw(self.contents.err) };
769                         }
770                 }
771         }
772 }
773 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
775                 let contents = if o.result_ok {
776                         let result = unsafe { o.contents.result };
777                         unsafe { o.contents.result = core::ptr::null_mut() };
778                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
779                 } else {
780                         let err = unsafe { o.contents.err };
781                         unsafe { o.contents.err = core::ptr::null_mut(); }
782                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
783                 };
784                 Self {
785                         contents,
786                         result_ok: o.result_ok,
787                 }
788         }
789 }
790 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
791         fn clone(&self) -> Self {
792                 if self.result_ok {
793                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
794                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
795                         } }
796                 } else {
797                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
798                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
799                         } }
800                 }
801         }
802 }
803 #[no_mangle]
804 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
805 /// but with all dynamically-allocated buffers duplicated in new buffers.
806 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
807 #[repr(C)]
808 /// An enum which can either contain a  or not
809 pub enum COption_NoneZ {
810         /// When we're in this state, this COption_NoneZ contains a 
811         Some,
812         /// When we're in this state, this COption_NoneZ contains nothing
813         None
814 }
815 impl COption_NoneZ {
816         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
817                 if let Self::None = self { false } else { true }
818         }
819         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
820                 !self.is_some()
821         }
822 }
823 #[no_mangle]
824 /// Constructs a new COption_NoneZ containing a 
825 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
826         COption_NoneZ::Some
827 }
828 #[no_mangle]
829 /// Constructs a new COption_NoneZ containing nothing
830 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
831         COption_NoneZ::None
832 }
833 #[no_mangle]
834 /// Frees any resources associated with the , if we are in the Some state
835 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
836 #[repr(C)]
837 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
838 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
839         /// A pointer to the contents in the success state.
840         /// Reading from this pointer when `result_ok` is not set is undefined.
841         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
842         /// A pointer to the contents in the error state.
843         /// Reading from this pointer when `result_ok` is set is undefined.
844         pub err: *mut crate::lightning::ln::msgs::DecodeError,
845 }
846 #[repr(C)]
847 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
848 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
849 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
850 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
851         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
852         /// `err` or `result` depending on the state of `result_ok`.
853         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
854         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
855         pub result_ok: bool,
856 }
857 #[no_mangle]
858 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
859 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
860         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
861                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
862                         result: Box::into_raw(Box::new(o)),
863                 },
864                 result_ok: true,
865         }
866 }
867 #[no_mangle]
868 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
869 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
870         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
871                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
872                         err: Box::into_raw(Box::new(e)),
873                 },
874                 result_ok: false,
875         }
876 }
877 /// Checks if the given object is currently in the success state
878 #[no_mangle]
879 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
880         o.result_ok
881 }
882 #[no_mangle]
883 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
884 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
885 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
886         fn drop(&mut self) {
887                 if self.result_ok {
888                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
889                                 let _ = unsafe { Box::from_raw(self.contents.result) };
890                         }
891                 } else {
892                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
893                                 let _ = unsafe { Box::from_raw(self.contents.err) };
894                         }
895                 }
896         }
897 }
898 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
900                 let contents = if o.result_ok {
901                         let result = unsafe { o.contents.result };
902                         unsafe { o.contents.result = core::ptr::null_mut() };
903                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
904                 } else {
905                         let err = unsafe { o.contents.err };
906                         unsafe { o.contents.err = core::ptr::null_mut(); }
907                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
908                 };
909                 Self {
910                         contents,
911                         result_ok: o.result_ok,
912                 }
913         }
914 }
915 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
916         fn clone(&self) -> Self {
917                 if self.result_ok {
918                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
919                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
920                         } }
921                 } else {
922                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
923                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
924                         } }
925                 }
926         }
927 }
928 #[no_mangle]
929 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
930 /// but with all dynamically-allocated buffers duplicated in new buffers.
931 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
932 #[repr(C)]
933 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
934 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
935         /// A pointer to the contents in the success state.
936         /// Reading from this pointer when `result_ok` is not set is undefined.
937         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
938         /// A pointer to the contents in the error state.
939         /// Reading from this pointer when `result_ok` is set is undefined.
940         pub err: *mut crate::lightning::ln::msgs::DecodeError,
941 }
942 #[repr(C)]
943 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
944 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
945 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
946 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
947         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
948         /// `err` or `result` depending on the state of `result_ok`.
949         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
950         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
951         pub result_ok: bool,
952 }
953 #[no_mangle]
954 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
955 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
956         CResult_ChannelTransactionParametersDecodeErrorZ {
957                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
958                         result: Box::into_raw(Box::new(o)),
959                 },
960                 result_ok: true,
961         }
962 }
963 #[no_mangle]
964 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
965 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
966         CResult_ChannelTransactionParametersDecodeErrorZ {
967                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
968                         err: Box::into_raw(Box::new(e)),
969                 },
970                 result_ok: false,
971         }
972 }
973 /// Checks if the given object is currently in the success state
974 #[no_mangle]
975 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
976         o.result_ok
977 }
978 #[no_mangle]
979 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
980 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
981 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
982         fn drop(&mut self) {
983                 if self.result_ok {
984                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
985                                 let _ = unsafe { Box::from_raw(self.contents.result) };
986                         }
987                 } else {
988                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
989                                 let _ = unsafe { Box::from_raw(self.contents.err) };
990                         }
991                 }
992         }
993 }
994 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
996                 let contents = if o.result_ok {
997                         let result = unsafe { o.contents.result };
998                         unsafe { o.contents.result = core::ptr::null_mut() };
999                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
1000                 } else {
1001                         let err = unsafe { o.contents.err };
1002                         unsafe { o.contents.err = core::ptr::null_mut(); }
1003                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
1004                 };
1005                 Self {
1006                         contents,
1007                         result_ok: o.result_ok,
1008                 }
1009         }
1010 }
1011 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
1012         fn clone(&self) -> Self {
1013                 if self.result_ok {
1014                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1015                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
1016                         } }
1017                 } else {
1018                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1019                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1020                         } }
1021                 }
1022         }
1023 }
1024 #[no_mangle]
1025 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1026 /// but with all dynamically-allocated buffers duplicated in new buffers.
1027 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1028 #[repr(C)]
1029 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1030 /// This corresponds to std::vector in C++
1031 pub struct CVec_SignatureZ {
1032         /// The elements in the array.
1033         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1034         pub data: *mut crate::c_types::Signature,
1035         /// The number of elements pointed to by `data`.
1036         pub datalen: usize
1037 }
1038 impl CVec_SignatureZ {
1039         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1040                 if self.datalen == 0 { return Vec::new(); }
1041                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1042                 self.data = core::ptr::null_mut();
1043                 self.datalen = 0;
1044                 ret
1045         }
1046         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1047                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1048         }
1049 }
1050 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1051         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1052                 let datalen = v.len();
1053                 let data = Box::into_raw(v.into_boxed_slice());
1054                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1055         }
1056 }
1057 #[no_mangle]
1058 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1059 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1060 impl Drop for CVec_SignatureZ {
1061         fn drop(&mut self) {
1062                 if self.datalen == 0 { return; }
1063                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1064         }
1065 }
1066 impl Clone for CVec_SignatureZ {
1067         fn clone(&self) -> Self {
1068                 let mut res = Vec::new();
1069                 if self.datalen == 0 { return Self::from(res); }
1070                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1071                 Self::from(res)
1072         }
1073 }
1074 #[repr(C)]
1075 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1076 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1077         /// A pointer to the contents in the success state.
1078         /// Reading from this pointer when `result_ok` is not set is undefined.
1079         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1080         /// A pointer to the contents in the error state.
1081         /// Reading from this pointer when `result_ok` is set is undefined.
1082         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1083 }
1084 #[repr(C)]
1085 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1086 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1087 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1088 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1089         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1090         /// `err` or `result` depending on the state of `result_ok`.
1091         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1092         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1093         pub result_ok: bool,
1094 }
1095 #[no_mangle]
1096 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1097 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1098         CResult_HolderCommitmentTransactionDecodeErrorZ {
1099                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1100                         result: Box::into_raw(Box::new(o)),
1101                 },
1102                 result_ok: true,
1103         }
1104 }
1105 #[no_mangle]
1106 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1107 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1108         CResult_HolderCommitmentTransactionDecodeErrorZ {
1109                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110                         err: Box::into_raw(Box::new(e)),
1111                 },
1112                 result_ok: false,
1113         }
1114 }
1115 /// Checks if the given object is currently in the success state
1116 #[no_mangle]
1117 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1118         o.result_ok
1119 }
1120 #[no_mangle]
1121 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1122 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1123 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1124         fn drop(&mut self) {
1125                 if self.result_ok {
1126                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1127                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1128                         }
1129                 } else {
1130                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1131                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1132                         }
1133                 }
1134         }
1135 }
1136 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1138                 let contents = if o.result_ok {
1139                         let result = unsafe { o.contents.result };
1140                         unsafe { o.contents.result = core::ptr::null_mut() };
1141                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1142                 } else {
1143                         let err = unsafe { o.contents.err };
1144                         unsafe { o.contents.err = core::ptr::null_mut(); }
1145                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1146                 };
1147                 Self {
1148                         contents,
1149                         result_ok: o.result_ok,
1150                 }
1151         }
1152 }
1153 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1154         fn clone(&self) -> Self {
1155                 if self.result_ok {
1156                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1157                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1158                         } }
1159                 } else {
1160                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1161                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1162                         } }
1163                 }
1164         }
1165 }
1166 #[no_mangle]
1167 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1168 /// but with all dynamically-allocated buffers duplicated in new buffers.
1169 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1170 #[repr(C)]
1171 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1172 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1173         /// A pointer to the contents in the success state.
1174         /// Reading from this pointer when `result_ok` is not set is undefined.
1175         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1176         /// A pointer to the contents in the error state.
1177         /// Reading from this pointer when `result_ok` is set is undefined.
1178         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1179 }
1180 #[repr(C)]
1181 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1185         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1186         /// `err` or `result` depending on the state of `result_ok`.
1187         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1188         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1189         pub result_ok: bool,
1190 }
1191 #[no_mangle]
1192 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1193 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1194         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1195                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1196                         result: Box::into_raw(Box::new(o)),
1197                 },
1198                 result_ok: true,
1199         }
1200 }
1201 #[no_mangle]
1202 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1203 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1204         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1205                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1206                         err: Box::into_raw(Box::new(e)),
1207                 },
1208                 result_ok: false,
1209         }
1210 }
1211 /// Checks if the given object is currently in the success state
1212 #[no_mangle]
1213 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1214         o.result_ok
1215 }
1216 #[no_mangle]
1217 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1218 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1219 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1220         fn drop(&mut self) {
1221                 if self.result_ok {
1222                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1223                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1224                         }
1225                 } else {
1226                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1227                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1228                         }
1229                 }
1230         }
1231 }
1232 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1234                 let contents = if o.result_ok {
1235                         let result = unsafe { o.contents.result };
1236                         unsafe { o.contents.result = core::ptr::null_mut() };
1237                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1238                 } else {
1239                         let err = unsafe { o.contents.err };
1240                         unsafe { o.contents.err = core::ptr::null_mut(); }
1241                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1242                 };
1243                 Self {
1244                         contents,
1245                         result_ok: o.result_ok,
1246                 }
1247         }
1248 }
1249 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1250         fn clone(&self) -> Self {
1251                 if self.result_ok {
1252                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1253                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1254                         } }
1255                 } else {
1256                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1257                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1258                         } }
1259                 }
1260         }
1261 }
1262 #[no_mangle]
1263 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1264 /// but with all dynamically-allocated buffers duplicated in new buffers.
1265 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1266 #[repr(C)]
1267 /// The contents of CResult_TrustedClosingTransactionNoneZ
1268 pub union CResult_TrustedClosingTransactionNoneZPtr {
1269         /// A pointer to the contents in the success state.
1270         /// Reading from this pointer when `result_ok` is not set is undefined.
1271         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1272         /// Note that this value is always NULL, as there are no contents in the Err variant
1273         pub err: *mut core::ffi::c_void,
1274 }
1275 #[repr(C)]
1276 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1277 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1278 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1279 pub struct CResult_TrustedClosingTransactionNoneZ {
1280         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1281         /// `err` or `result` depending on the state of `result_ok`.
1282         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1283         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1284         pub result_ok: bool,
1285 }
1286 #[no_mangle]
1287 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1288 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1289         CResult_TrustedClosingTransactionNoneZ {
1290                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1291                         result: Box::into_raw(Box::new(o)),
1292                 },
1293                 result_ok: true,
1294         }
1295 }
1296 #[no_mangle]
1297 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1298 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1299         CResult_TrustedClosingTransactionNoneZ {
1300                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1301                         err: core::ptr::null_mut(),
1302                 },
1303                 result_ok: false,
1304         }
1305 }
1306 /// Checks if the given object is currently in the success state
1307 #[no_mangle]
1308 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1309         o.result_ok
1310 }
1311 #[no_mangle]
1312 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1313 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1314 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1315         fn drop(&mut self) {
1316                 if self.result_ok {
1317                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1318                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1319                         }
1320                 } else {
1321                 }
1322         }
1323 }
1324 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1325         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1326                 let contents = if o.result_ok {
1327                         let result = unsafe { o.contents.result };
1328                         unsafe { o.contents.result = core::ptr::null_mut() };
1329                         CResult_TrustedClosingTransactionNoneZPtr { result }
1330                 } else {
1331                         let _ = unsafe { Box::from_raw(o.contents.err) };
1332                         o.contents.err = core::ptr::null_mut();
1333                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1334                 };
1335                 Self {
1336                         contents,
1337                         result_ok: o.result_ok,
1338                 }
1339         }
1340 }
1341 #[repr(C)]
1342 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1343 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1344         /// A pointer to the contents in the success state.
1345         /// Reading from this pointer when `result_ok` is not set is undefined.
1346         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1347         /// A pointer to the contents in the error state.
1348         /// Reading from this pointer when `result_ok` is set is undefined.
1349         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1350 }
1351 #[repr(C)]
1352 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1353 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1354 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1355 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1356         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1357         /// `err` or `result` depending on the state of `result_ok`.
1358         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1359         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1360         pub result_ok: bool,
1361 }
1362 #[no_mangle]
1363 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1364 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1365         CResult_CommitmentTransactionDecodeErrorZ {
1366                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1367                         result: Box::into_raw(Box::new(o)),
1368                 },
1369                 result_ok: true,
1370         }
1371 }
1372 #[no_mangle]
1373 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1374 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1375         CResult_CommitmentTransactionDecodeErrorZ {
1376                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1377                         err: Box::into_raw(Box::new(e)),
1378                 },
1379                 result_ok: false,
1380         }
1381 }
1382 /// Checks if the given object is currently in the success state
1383 #[no_mangle]
1384 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1385         o.result_ok
1386 }
1387 #[no_mangle]
1388 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1389 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1390 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1391         fn drop(&mut self) {
1392                 if self.result_ok {
1393                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1394                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1395                         }
1396                 } else {
1397                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1398                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1399                         }
1400                 }
1401         }
1402 }
1403 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1405                 let contents = if o.result_ok {
1406                         let result = unsafe { o.contents.result };
1407                         unsafe { o.contents.result = core::ptr::null_mut() };
1408                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1409                 } else {
1410                         let err = unsafe { o.contents.err };
1411                         unsafe { o.contents.err = core::ptr::null_mut(); }
1412                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1413                 };
1414                 Self {
1415                         contents,
1416                         result_ok: o.result_ok,
1417                 }
1418         }
1419 }
1420 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1421         fn clone(&self) -> Self {
1422                 if self.result_ok {
1423                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1424                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1425                         } }
1426                 } else {
1427                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1428                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1429                         } }
1430                 }
1431         }
1432 }
1433 #[no_mangle]
1434 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1435 /// but with all dynamically-allocated buffers duplicated in new buffers.
1436 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1437 #[repr(C)]
1438 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1439 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1440         /// A pointer to the contents in the success state.
1441         /// Reading from this pointer when `result_ok` is not set is undefined.
1442         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1443         /// Note that this value is always NULL, as there are no contents in the Err variant
1444         pub err: *mut core::ffi::c_void,
1445 }
1446 #[repr(C)]
1447 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1448 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1449 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1450 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1451         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1452         /// `err` or `result` depending on the state of `result_ok`.
1453         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1454         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1455         pub result_ok: bool,
1456 }
1457 #[no_mangle]
1458 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1459 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1460         CResult_TrustedCommitmentTransactionNoneZ {
1461                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1462                         result: Box::into_raw(Box::new(o)),
1463                 },
1464                 result_ok: true,
1465         }
1466 }
1467 #[no_mangle]
1468 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1469 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1470         CResult_TrustedCommitmentTransactionNoneZ {
1471                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1472                         err: core::ptr::null_mut(),
1473                 },
1474                 result_ok: false,
1475         }
1476 }
1477 /// Checks if the given object is currently in the success state
1478 #[no_mangle]
1479 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1480         o.result_ok
1481 }
1482 #[no_mangle]
1483 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1484 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1485 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1486         fn drop(&mut self) {
1487                 if self.result_ok {
1488                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1489                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1490                         }
1491                 } else {
1492                 }
1493         }
1494 }
1495 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1496         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1497                 let contents = if o.result_ok {
1498                         let result = unsafe { o.contents.result };
1499                         unsafe { o.contents.result = core::ptr::null_mut() };
1500                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1501                 } else {
1502                         let _ = unsafe { Box::from_raw(o.contents.err) };
1503                         o.contents.err = core::ptr::null_mut();
1504                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1505                 };
1506                 Self {
1507                         contents,
1508                         result_ok: o.result_ok,
1509                 }
1510         }
1511 }
1512 #[repr(C)]
1513 /// The contents of CResult_CVec_SignatureZNoneZ
1514 pub union CResult_CVec_SignatureZNoneZPtr {
1515         /// A pointer to the contents in the success state.
1516         /// Reading from this pointer when `result_ok` is not set is undefined.
1517         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1518         /// Note that this value is always NULL, as there are no contents in the Err variant
1519         pub err: *mut core::ffi::c_void,
1520 }
1521 #[repr(C)]
1522 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1523 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1524 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1525 pub struct CResult_CVec_SignatureZNoneZ {
1526         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1527         /// `err` or `result` depending on the state of `result_ok`.
1528         pub contents: CResult_CVec_SignatureZNoneZPtr,
1529         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1530         pub result_ok: bool,
1531 }
1532 #[no_mangle]
1533 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1534 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1535         CResult_CVec_SignatureZNoneZ {
1536                 contents: CResult_CVec_SignatureZNoneZPtr {
1537                         result: Box::into_raw(Box::new(o)),
1538                 },
1539                 result_ok: true,
1540         }
1541 }
1542 #[no_mangle]
1543 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1544 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1545         CResult_CVec_SignatureZNoneZ {
1546                 contents: CResult_CVec_SignatureZNoneZPtr {
1547                         err: core::ptr::null_mut(),
1548                 },
1549                 result_ok: false,
1550         }
1551 }
1552 /// Checks if the given object is currently in the success state
1553 #[no_mangle]
1554 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1555         o.result_ok
1556 }
1557 #[no_mangle]
1558 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1559 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1560 impl Drop for CResult_CVec_SignatureZNoneZ {
1561         fn drop(&mut self) {
1562                 if self.result_ok {
1563                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1564                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1565                         }
1566                 } else {
1567                 }
1568         }
1569 }
1570 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1571         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1572                 let contents = if o.result_ok {
1573                         let result = unsafe { o.contents.result };
1574                         unsafe { o.contents.result = core::ptr::null_mut() };
1575                         CResult_CVec_SignatureZNoneZPtr { result }
1576                 } else {
1577                         let _ = unsafe { Box::from_raw(o.contents.err) };
1578                         o.contents.err = core::ptr::null_mut();
1579                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1580                 };
1581                 Self {
1582                         contents,
1583                         result_ok: o.result_ok,
1584                 }
1585         }
1586 }
1587 impl Clone for CResult_CVec_SignatureZNoneZ {
1588         fn clone(&self) -> Self {
1589                 if self.result_ok {
1590                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1591                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1592                         } }
1593                 } else {
1594                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1595                                 err: core::ptr::null_mut()
1596                         } }
1597                 }
1598         }
1599 }
1600 #[no_mangle]
1601 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1602 /// but with all dynamically-allocated buffers duplicated in new buffers.
1603 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1604 #[repr(C)]
1605 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1606 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1607         /// A pointer to the contents in the success state.
1608         /// Reading from this pointer when `result_ok` is not set is undefined.
1609         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1610         /// A pointer to the contents in the error state.
1611         /// Reading from this pointer when `result_ok` is set is undefined.
1612         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1613 }
1614 #[repr(C)]
1615 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1616 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1617 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1618 pub struct CResult_ShutdownScriptDecodeErrorZ {
1619         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1620         /// `err` or `result` depending on the state of `result_ok`.
1621         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1622         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1623         pub result_ok: bool,
1624 }
1625 #[no_mangle]
1626 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1627 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1628         CResult_ShutdownScriptDecodeErrorZ {
1629                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1630                         result: Box::into_raw(Box::new(o)),
1631                 },
1632                 result_ok: true,
1633         }
1634 }
1635 #[no_mangle]
1636 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1637 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1638         CResult_ShutdownScriptDecodeErrorZ {
1639                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1640                         err: Box::into_raw(Box::new(e)),
1641                 },
1642                 result_ok: false,
1643         }
1644 }
1645 /// Checks if the given object is currently in the success state
1646 #[no_mangle]
1647 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1648         o.result_ok
1649 }
1650 #[no_mangle]
1651 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1652 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1653 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1654         fn drop(&mut self) {
1655                 if self.result_ok {
1656                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1657                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1658                         }
1659                 } else {
1660                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1661                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1662                         }
1663                 }
1664         }
1665 }
1666 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1667         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1668                 let contents = if o.result_ok {
1669                         let result = unsafe { o.contents.result };
1670                         unsafe { o.contents.result = core::ptr::null_mut() };
1671                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1672                 } else {
1673                         let err = unsafe { o.contents.err };
1674                         unsafe { o.contents.err = core::ptr::null_mut(); }
1675                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1676                 };
1677                 Self {
1678                         contents,
1679                         result_ok: o.result_ok,
1680                 }
1681         }
1682 }
1683 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1684         fn clone(&self) -> Self {
1685                 if self.result_ok {
1686                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1687                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1688                         } }
1689                 } else {
1690                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1691                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1692                         } }
1693                 }
1694         }
1695 }
1696 #[no_mangle]
1697 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1698 /// but with all dynamically-allocated buffers duplicated in new buffers.
1699 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1700 #[repr(C)]
1701 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1702 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1703         /// A pointer to the contents in the success state.
1704         /// Reading from this pointer when `result_ok` is not set is undefined.
1705         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1706         /// A pointer to the contents in the error state.
1707         /// Reading from this pointer when `result_ok` is set is undefined.
1708         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1709 }
1710 #[repr(C)]
1711 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1712 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1713 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1714 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1715         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1716         /// `err` or `result` depending on the state of `result_ok`.
1717         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1718         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1719         pub result_ok: bool,
1720 }
1721 #[no_mangle]
1722 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1723 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1724         CResult_ShutdownScriptInvalidShutdownScriptZ {
1725                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1726                         result: Box::into_raw(Box::new(o)),
1727                 },
1728                 result_ok: true,
1729         }
1730 }
1731 #[no_mangle]
1732 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1733 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1734         CResult_ShutdownScriptInvalidShutdownScriptZ {
1735                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1736                         err: Box::into_raw(Box::new(e)),
1737                 },
1738                 result_ok: false,
1739         }
1740 }
1741 /// Checks if the given object is currently in the success state
1742 #[no_mangle]
1743 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1744         o.result_ok
1745 }
1746 #[no_mangle]
1747 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1748 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1749 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1750         fn drop(&mut self) {
1751                 if self.result_ok {
1752                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1753                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1754                         }
1755                 } else {
1756                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1757                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1758                         }
1759                 }
1760         }
1761 }
1762 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1764                 let contents = if o.result_ok {
1765                         let result = unsafe { o.contents.result };
1766                         unsafe { o.contents.result = core::ptr::null_mut() };
1767                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1768                 } else {
1769                         let err = unsafe { o.contents.err };
1770                         unsafe { o.contents.err = core::ptr::null_mut(); }
1771                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1772                 };
1773                 Self {
1774                         contents,
1775                         result_ok: o.result_ok,
1776                 }
1777         }
1778 }
1779 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1780         fn clone(&self) -> Self {
1781                 if self.result_ok {
1782                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1783                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1784                         } }
1785                 } else {
1786                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1787                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1788                         } }
1789                 }
1790         }
1791 }
1792 #[no_mangle]
1793 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1794 /// but with all dynamically-allocated buffers duplicated in new buffers.
1795 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1796 #[repr(C)]
1797 /// The contents of CResult_NoneErrorZ
1798 pub union CResult_NoneErrorZPtr {
1799         /// Note that this value is always NULL, as there are no contents in the OK variant
1800         pub result: *mut core::ffi::c_void,
1801         /// A pointer to the contents in the error state.
1802         /// Reading from this pointer when `result_ok` is set is undefined.
1803         pub err: *mut crate::c_types::IOError,
1804 }
1805 #[repr(C)]
1806 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1807 /// containing a () on success and a crate::c_types::IOError on failure.
1808 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1809 pub struct CResult_NoneErrorZ {
1810         /// The contents of this CResult_NoneErrorZ, accessible via either
1811         /// `err` or `result` depending on the state of `result_ok`.
1812         pub contents: CResult_NoneErrorZPtr,
1813         /// Whether this CResult_NoneErrorZ represents a success state.
1814         pub result_ok: bool,
1815 }
1816 #[no_mangle]
1817 /// Creates a new CResult_NoneErrorZ in the success state.
1818 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1819         CResult_NoneErrorZ {
1820                 contents: CResult_NoneErrorZPtr {
1821                         result: core::ptr::null_mut(),
1822                 },
1823                 result_ok: true,
1824         }
1825 }
1826 #[no_mangle]
1827 /// Creates a new CResult_NoneErrorZ in the error state.
1828 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1829         CResult_NoneErrorZ {
1830                 contents: CResult_NoneErrorZPtr {
1831                         err: Box::into_raw(Box::new(e)),
1832                 },
1833                 result_ok: false,
1834         }
1835 }
1836 /// Checks if the given object is currently in the success state
1837 #[no_mangle]
1838 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1839         o.result_ok
1840 }
1841 #[no_mangle]
1842 /// Frees any resources used by the CResult_NoneErrorZ.
1843 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1844 impl Drop for CResult_NoneErrorZ {
1845         fn drop(&mut self) {
1846                 if self.result_ok {
1847                 } else {
1848                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1849                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1850                         }
1851                 }
1852         }
1853 }
1854 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1855         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1856                 let contents = if o.result_ok {
1857                         let _ = unsafe { Box::from_raw(o.contents.result) };
1858                         o.contents.result = core::ptr::null_mut();
1859                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1860                 } else {
1861                         let err = unsafe { o.contents.err };
1862                         unsafe { o.contents.err = core::ptr::null_mut(); }
1863                         CResult_NoneErrorZPtr { err }
1864                 };
1865                 Self {
1866                         contents,
1867                         result_ok: o.result_ok,
1868                 }
1869         }
1870 }
1871 impl Clone for CResult_NoneErrorZ {
1872         fn clone(&self) -> Self {
1873                 if self.result_ok {
1874                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1875                                 result: core::ptr::null_mut()
1876                         } }
1877                 } else {
1878                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1879                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1880                         } }
1881                 }
1882         }
1883 }
1884 #[no_mangle]
1885 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1886 /// but with all dynamically-allocated buffers duplicated in new buffers.
1887 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1888 #[repr(C)]
1889 /// The contents of CResult_RouteHopDecodeErrorZ
1890 pub union CResult_RouteHopDecodeErrorZPtr {
1891         /// A pointer to the contents in the success state.
1892         /// Reading from this pointer when `result_ok` is not set is undefined.
1893         pub result: *mut crate::lightning::routing::router::RouteHop,
1894         /// A pointer to the contents in the error state.
1895         /// Reading from this pointer when `result_ok` is set is undefined.
1896         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1897 }
1898 #[repr(C)]
1899 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1900 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1901 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1902 pub struct CResult_RouteHopDecodeErrorZ {
1903         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1904         /// `err` or `result` depending on the state of `result_ok`.
1905         pub contents: CResult_RouteHopDecodeErrorZPtr,
1906         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1907         pub result_ok: bool,
1908 }
1909 #[no_mangle]
1910 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1911 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1912         CResult_RouteHopDecodeErrorZ {
1913                 contents: CResult_RouteHopDecodeErrorZPtr {
1914                         result: Box::into_raw(Box::new(o)),
1915                 },
1916                 result_ok: true,
1917         }
1918 }
1919 #[no_mangle]
1920 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1921 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1922         CResult_RouteHopDecodeErrorZ {
1923                 contents: CResult_RouteHopDecodeErrorZPtr {
1924                         err: Box::into_raw(Box::new(e)),
1925                 },
1926                 result_ok: false,
1927         }
1928 }
1929 /// Checks if the given object is currently in the success state
1930 #[no_mangle]
1931 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1932         o.result_ok
1933 }
1934 #[no_mangle]
1935 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1936 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1937 impl Drop for CResult_RouteHopDecodeErrorZ {
1938         fn drop(&mut self) {
1939                 if self.result_ok {
1940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1942                         }
1943                 } else {
1944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1946                         }
1947                 }
1948         }
1949 }
1950 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1951         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1952                 let contents = if o.result_ok {
1953                         let result = unsafe { o.contents.result };
1954                         unsafe { o.contents.result = core::ptr::null_mut() };
1955                         CResult_RouteHopDecodeErrorZPtr { result }
1956                 } else {
1957                         let err = unsafe { o.contents.err };
1958                         unsafe { o.contents.err = core::ptr::null_mut(); }
1959                         CResult_RouteHopDecodeErrorZPtr { err }
1960                 };
1961                 Self {
1962                         contents,
1963                         result_ok: o.result_ok,
1964                 }
1965         }
1966 }
1967 impl Clone for CResult_RouteHopDecodeErrorZ {
1968         fn clone(&self) -> Self {
1969                 if self.result_ok {
1970                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1971                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1972                         } }
1973                 } else {
1974                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1975                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1976                         } }
1977                 }
1978         }
1979 }
1980 #[no_mangle]
1981 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1982 /// but with all dynamically-allocated buffers duplicated in new buffers.
1983 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1984 #[repr(C)]
1985 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1986 /// This corresponds to std::vector in C++
1987 pub struct CVec_RouteHopZ {
1988         /// The elements in the array.
1989         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1990         pub data: *mut crate::lightning::routing::router::RouteHop,
1991         /// The number of elements pointed to by `data`.
1992         pub datalen: usize
1993 }
1994 impl CVec_RouteHopZ {
1995         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1996                 if self.datalen == 0 { return Vec::new(); }
1997                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1998                 self.data = core::ptr::null_mut();
1999                 self.datalen = 0;
2000                 ret
2001         }
2002         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
2003                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2004         }
2005 }
2006 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
2007         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
2008                 let datalen = v.len();
2009                 let data = Box::into_raw(v.into_boxed_slice());
2010                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2011         }
2012 }
2013 #[no_mangle]
2014 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2015 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
2016 impl Drop for CVec_RouteHopZ {
2017         fn drop(&mut self) {
2018                 if self.datalen == 0 { return; }
2019                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2020         }
2021 }
2022 impl Clone for CVec_RouteHopZ {
2023         fn clone(&self) -> Self {
2024                 let mut res = Vec::new();
2025                 if self.datalen == 0 { return Self::from(res); }
2026                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2027                 Self::from(res)
2028         }
2029 }
2030 #[repr(C)]
2031 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2032 /// This corresponds to std::vector in C++
2033 pub struct CVec_CVec_RouteHopZZ {
2034         /// The elements in the array.
2035         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2036         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2037         /// The number of elements pointed to by `data`.
2038         pub datalen: usize
2039 }
2040 impl CVec_CVec_RouteHopZZ {
2041         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2042                 if self.datalen == 0 { return Vec::new(); }
2043                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2044                 self.data = core::ptr::null_mut();
2045                 self.datalen = 0;
2046                 ret
2047         }
2048         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2049                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2050         }
2051 }
2052 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2053         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2054                 let datalen = v.len();
2055                 let data = Box::into_raw(v.into_boxed_slice());
2056                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2057         }
2058 }
2059 #[no_mangle]
2060 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2061 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2062 impl Drop for CVec_CVec_RouteHopZZ {
2063         fn drop(&mut self) {
2064                 if self.datalen == 0 { return; }
2065                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2066         }
2067 }
2068 impl Clone for CVec_CVec_RouteHopZZ {
2069         fn clone(&self) -> Self {
2070                 let mut res = Vec::new();
2071                 if self.datalen == 0 { return Self::from(res); }
2072                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2073                 Self::from(res)
2074         }
2075 }
2076 #[repr(C)]
2077 /// The contents of CResult_RouteDecodeErrorZ
2078 pub union CResult_RouteDecodeErrorZPtr {
2079         /// A pointer to the contents in the success state.
2080         /// Reading from this pointer when `result_ok` is not set is undefined.
2081         pub result: *mut crate::lightning::routing::router::Route,
2082         /// A pointer to the contents in the error state.
2083         /// Reading from this pointer when `result_ok` is set is undefined.
2084         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2085 }
2086 #[repr(C)]
2087 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2088 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2089 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2090 pub struct CResult_RouteDecodeErrorZ {
2091         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2092         /// `err` or `result` depending on the state of `result_ok`.
2093         pub contents: CResult_RouteDecodeErrorZPtr,
2094         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2095         pub result_ok: bool,
2096 }
2097 #[no_mangle]
2098 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2099 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2100         CResult_RouteDecodeErrorZ {
2101                 contents: CResult_RouteDecodeErrorZPtr {
2102                         result: Box::into_raw(Box::new(o)),
2103                 },
2104                 result_ok: true,
2105         }
2106 }
2107 #[no_mangle]
2108 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2109 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2110         CResult_RouteDecodeErrorZ {
2111                 contents: CResult_RouteDecodeErrorZPtr {
2112                         err: Box::into_raw(Box::new(e)),
2113                 },
2114                 result_ok: false,
2115         }
2116 }
2117 /// Checks if the given object is currently in the success state
2118 #[no_mangle]
2119 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2120         o.result_ok
2121 }
2122 #[no_mangle]
2123 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2124 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2125 impl Drop for CResult_RouteDecodeErrorZ {
2126         fn drop(&mut self) {
2127                 if self.result_ok {
2128                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2129                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2130                         }
2131                 } else {
2132                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2133                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2134                         }
2135                 }
2136         }
2137 }
2138 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2139         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2140                 let contents = if o.result_ok {
2141                         let result = unsafe { o.contents.result };
2142                         unsafe { o.contents.result = core::ptr::null_mut() };
2143                         CResult_RouteDecodeErrorZPtr { result }
2144                 } else {
2145                         let err = unsafe { o.contents.err };
2146                         unsafe { o.contents.err = core::ptr::null_mut(); }
2147                         CResult_RouteDecodeErrorZPtr { err }
2148                 };
2149                 Self {
2150                         contents,
2151                         result_ok: o.result_ok,
2152                 }
2153         }
2154 }
2155 impl Clone for CResult_RouteDecodeErrorZ {
2156         fn clone(&self) -> Self {
2157                 if self.result_ok {
2158                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2159                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2160                         } }
2161                 } else {
2162                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2163                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2164                         } }
2165                 }
2166         }
2167 }
2168 #[no_mangle]
2169 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2170 /// but with all dynamically-allocated buffers duplicated in new buffers.
2171 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2172 #[repr(C)]
2173 /// The contents of CResult_RouteParametersDecodeErrorZ
2174 pub union CResult_RouteParametersDecodeErrorZPtr {
2175         /// A pointer to the contents in the success state.
2176         /// Reading from this pointer when `result_ok` is not set is undefined.
2177         pub result: *mut crate::lightning::routing::router::RouteParameters,
2178         /// A pointer to the contents in the error state.
2179         /// Reading from this pointer when `result_ok` is set is undefined.
2180         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2181 }
2182 #[repr(C)]
2183 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2184 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2185 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2186 pub struct CResult_RouteParametersDecodeErrorZ {
2187         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2188         /// `err` or `result` depending on the state of `result_ok`.
2189         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2190         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2191         pub result_ok: bool,
2192 }
2193 #[no_mangle]
2194 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2195 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2196         CResult_RouteParametersDecodeErrorZ {
2197                 contents: CResult_RouteParametersDecodeErrorZPtr {
2198                         result: Box::into_raw(Box::new(o)),
2199                 },
2200                 result_ok: true,
2201         }
2202 }
2203 #[no_mangle]
2204 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2205 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2206         CResult_RouteParametersDecodeErrorZ {
2207                 contents: CResult_RouteParametersDecodeErrorZPtr {
2208                         err: Box::into_raw(Box::new(e)),
2209                 },
2210                 result_ok: false,
2211         }
2212 }
2213 /// Checks if the given object is currently in the success state
2214 #[no_mangle]
2215 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2216         o.result_ok
2217 }
2218 #[no_mangle]
2219 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2220 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2221 impl Drop for CResult_RouteParametersDecodeErrorZ {
2222         fn drop(&mut self) {
2223                 if self.result_ok {
2224                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2225                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2226                         }
2227                 } else {
2228                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2229                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2230                         }
2231                 }
2232         }
2233 }
2234 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2235         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2236                 let contents = if o.result_ok {
2237                         let result = unsafe { o.contents.result };
2238                         unsafe { o.contents.result = core::ptr::null_mut() };
2239                         CResult_RouteParametersDecodeErrorZPtr { result }
2240                 } else {
2241                         let err = unsafe { o.contents.err };
2242                         unsafe { o.contents.err = core::ptr::null_mut(); }
2243                         CResult_RouteParametersDecodeErrorZPtr { err }
2244                 };
2245                 Self {
2246                         contents,
2247                         result_ok: o.result_ok,
2248                 }
2249         }
2250 }
2251 impl Clone for CResult_RouteParametersDecodeErrorZ {
2252         fn clone(&self) -> Self {
2253                 if self.result_ok {
2254                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2255                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2256                         } }
2257                 } else {
2258                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2259                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2260                         } }
2261                 }
2262         }
2263 }
2264 #[no_mangle]
2265 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2266 /// but with all dynamically-allocated buffers duplicated in new buffers.
2267 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2268 #[repr(C)]
2269 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2270 /// This corresponds to std::vector in C++
2271 pub struct CVec_RouteHintZ {
2272         /// The elements in the array.
2273         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2274         pub data: *mut crate::lightning::routing::router::RouteHint,
2275         /// The number of elements pointed to by `data`.
2276         pub datalen: usize
2277 }
2278 impl CVec_RouteHintZ {
2279         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2280                 if self.datalen == 0 { return Vec::new(); }
2281                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2282                 self.data = core::ptr::null_mut();
2283                 self.datalen = 0;
2284                 ret
2285         }
2286         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2287                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2288         }
2289 }
2290 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2291         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2292                 let datalen = v.len();
2293                 let data = Box::into_raw(v.into_boxed_slice());
2294                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2295         }
2296 }
2297 #[no_mangle]
2298 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2299 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2300 impl Drop for CVec_RouteHintZ {
2301         fn drop(&mut self) {
2302                 if self.datalen == 0 { return; }
2303                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2304         }
2305 }
2306 impl Clone for CVec_RouteHintZ {
2307         fn clone(&self) -> Self {
2308                 let mut res = Vec::new();
2309                 if self.datalen == 0 { return Self::from(res); }
2310                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2311                 Self::from(res)
2312         }
2313 }
2314 #[repr(C)]
2315 #[derive(Clone)]
2316 /// An enum which can either contain a u64 or not
2317 pub enum COption_u64Z {
2318         /// When we're in this state, this COption_u64Z contains a u64
2319         Some(u64),
2320         /// When we're in this state, this COption_u64Z contains nothing
2321         None
2322 }
2323 impl COption_u64Z {
2324         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2325                 if let Self::None = self { false } else { true }
2326         }
2327         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2328                 !self.is_some()
2329         }
2330         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2331                 if let Self::Some(v) = self { v } else { unreachable!() }
2332         }
2333 }
2334 #[no_mangle]
2335 /// Constructs a new COption_u64Z containing a u64
2336 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2337         COption_u64Z::Some(o)
2338 }
2339 #[no_mangle]
2340 /// Constructs a new COption_u64Z containing nothing
2341 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2342         COption_u64Z::None
2343 }
2344 #[no_mangle]
2345 /// Frees any resources associated with the u64, if we are in the Some state
2346 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2347 #[no_mangle]
2348 /// Creates a new COption_u64Z which has the same data as `orig`
2349 /// but with all dynamically-allocated buffers duplicated in new buffers.
2350 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2351 #[repr(C)]
2352 /// The contents of CResult_PaymentParametersDecodeErrorZ
2353 pub union CResult_PaymentParametersDecodeErrorZPtr {
2354         /// A pointer to the contents in the success state.
2355         /// Reading from this pointer when `result_ok` is not set is undefined.
2356         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2357         /// A pointer to the contents in the error state.
2358         /// Reading from this pointer when `result_ok` is set is undefined.
2359         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2360 }
2361 #[repr(C)]
2362 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2363 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2364 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2365 pub struct CResult_PaymentParametersDecodeErrorZ {
2366         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2367         /// `err` or `result` depending on the state of `result_ok`.
2368         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2369         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2370         pub result_ok: bool,
2371 }
2372 #[no_mangle]
2373 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2374 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2375         CResult_PaymentParametersDecodeErrorZ {
2376                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2377                         result: Box::into_raw(Box::new(o)),
2378                 },
2379                 result_ok: true,
2380         }
2381 }
2382 #[no_mangle]
2383 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2384 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2385         CResult_PaymentParametersDecodeErrorZ {
2386                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2387                         err: Box::into_raw(Box::new(e)),
2388                 },
2389                 result_ok: false,
2390         }
2391 }
2392 /// Checks if the given object is currently in the success state
2393 #[no_mangle]
2394 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2395         o.result_ok
2396 }
2397 #[no_mangle]
2398 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2399 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2400 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2401         fn drop(&mut self) {
2402                 if self.result_ok {
2403                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2404                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2405                         }
2406                 } else {
2407                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2408                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2409                         }
2410                 }
2411         }
2412 }
2413 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2414         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2415                 let contents = if o.result_ok {
2416                         let result = unsafe { o.contents.result };
2417                         unsafe { o.contents.result = core::ptr::null_mut() };
2418                         CResult_PaymentParametersDecodeErrorZPtr { result }
2419                 } else {
2420                         let err = unsafe { o.contents.err };
2421                         unsafe { o.contents.err = core::ptr::null_mut(); }
2422                         CResult_PaymentParametersDecodeErrorZPtr { err }
2423                 };
2424                 Self {
2425                         contents,
2426                         result_ok: o.result_ok,
2427                 }
2428         }
2429 }
2430 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2431         fn clone(&self) -> Self {
2432                 if self.result_ok {
2433                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2434                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2435                         } }
2436                 } else {
2437                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2438                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2439                         } }
2440                 }
2441         }
2442 }
2443 #[no_mangle]
2444 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2445 /// but with all dynamically-allocated buffers duplicated in new buffers.
2446 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2447 #[repr(C)]
2448 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2449 /// This corresponds to std::vector in C++
2450 pub struct CVec_RouteHintHopZ {
2451         /// The elements in the array.
2452         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2453         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2454         /// The number of elements pointed to by `data`.
2455         pub datalen: usize
2456 }
2457 impl CVec_RouteHintHopZ {
2458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2459                 if self.datalen == 0 { return Vec::new(); }
2460                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2461                 self.data = core::ptr::null_mut();
2462                 self.datalen = 0;
2463                 ret
2464         }
2465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2466                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2467         }
2468 }
2469 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2470         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2471                 let datalen = v.len();
2472                 let data = Box::into_raw(v.into_boxed_slice());
2473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2474         }
2475 }
2476 #[no_mangle]
2477 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2478 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2479 impl Drop for CVec_RouteHintHopZ {
2480         fn drop(&mut self) {
2481                 if self.datalen == 0 { return; }
2482                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2483         }
2484 }
2485 impl Clone for CVec_RouteHintHopZ {
2486         fn clone(&self) -> Self {
2487                 let mut res = Vec::new();
2488                 if self.datalen == 0 { return Self::from(res); }
2489                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2490                 Self::from(res)
2491         }
2492 }
2493 #[repr(C)]
2494 /// The contents of CResult_RouteHintDecodeErrorZ
2495 pub union CResult_RouteHintDecodeErrorZPtr {
2496         /// A pointer to the contents in the success state.
2497         /// Reading from this pointer when `result_ok` is not set is undefined.
2498         pub result: *mut crate::lightning::routing::router::RouteHint,
2499         /// A pointer to the contents in the error state.
2500         /// Reading from this pointer when `result_ok` is set is undefined.
2501         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2502 }
2503 #[repr(C)]
2504 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2505 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2506 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2507 pub struct CResult_RouteHintDecodeErrorZ {
2508         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2509         /// `err` or `result` depending on the state of `result_ok`.
2510         pub contents: CResult_RouteHintDecodeErrorZPtr,
2511         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2512         pub result_ok: bool,
2513 }
2514 #[no_mangle]
2515 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2516 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2517         CResult_RouteHintDecodeErrorZ {
2518                 contents: CResult_RouteHintDecodeErrorZPtr {
2519                         result: Box::into_raw(Box::new(o)),
2520                 },
2521                 result_ok: true,
2522         }
2523 }
2524 #[no_mangle]
2525 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2526 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2527         CResult_RouteHintDecodeErrorZ {
2528                 contents: CResult_RouteHintDecodeErrorZPtr {
2529                         err: Box::into_raw(Box::new(e)),
2530                 },
2531                 result_ok: false,
2532         }
2533 }
2534 /// Checks if the given object is currently in the success state
2535 #[no_mangle]
2536 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2537         o.result_ok
2538 }
2539 #[no_mangle]
2540 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2541 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2542 impl Drop for CResult_RouteHintDecodeErrorZ {
2543         fn drop(&mut self) {
2544                 if self.result_ok {
2545                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2546                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2547                         }
2548                 } else {
2549                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2550                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2551                         }
2552                 }
2553         }
2554 }
2555 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2556         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2557                 let contents = if o.result_ok {
2558                         let result = unsafe { o.contents.result };
2559                         unsafe { o.contents.result = core::ptr::null_mut() };
2560                         CResult_RouteHintDecodeErrorZPtr { result }
2561                 } else {
2562                         let err = unsafe { o.contents.err };
2563                         unsafe { o.contents.err = core::ptr::null_mut(); }
2564                         CResult_RouteHintDecodeErrorZPtr { err }
2565                 };
2566                 Self {
2567                         contents,
2568                         result_ok: o.result_ok,
2569                 }
2570         }
2571 }
2572 impl Clone for CResult_RouteHintDecodeErrorZ {
2573         fn clone(&self) -> Self {
2574                 if self.result_ok {
2575                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2576                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2577                         } }
2578                 } else {
2579                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2580                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2581                         } }
2582                 }
2583         }
2584 }
2585 #[no_mangle]
2586 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2587 /// but with all dynamically-allocated buffers duplicated in new buffers.
2588 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2589 #[repr(C)]
2590 /// The contents of CResult_RouteHintHopDecodeErrorZ
2591 pub union CResult_RouteHintHopDecodeErrorZPtr {
2592         /// A pointer to the contents in the success state.
2593         /// Reading from this pointer when `result_ok` is not set is undefined.
2594         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2595         /// A pointer to the contents in the error state.
2596         /// Reading from this pointer when `result_ok` is set is undefined.
2597         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2598 }
2599 #[repr(C)]
2600 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2601 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2602 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2603 pub struct CResult_RouteHintHopDecodeErrorZ {
2604         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2605         /// `err` or `result` depending on the state of `result_ok`.
2606         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2607         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2608         pub result_ok: bool,
2609 }
2610 #[no_mangle]
2611 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2612 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2613         CResult_RouteHintHopDecodeErrorZ {
2614                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2615                         result: Box::into_raw(Box::new(o)),
2616                 },
2617                 result_ok: true,
2618         }
2619 }
2620 #[no_mangle]
2621 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2622 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2623         CResult_RouteHintHopDecodeErrorZ {
2624                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2625                         err: Box::into_raw(Box::new(e)),
2626                 },
2627                 result_ok: false,
2628         }
2629 }
2630 /// Checks if the given object is currently in the success state
2631 #[no_mangle]
2632 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2633         o.result_ok
2634 }
2635 #[no_mangle]
2636 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2637 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2638 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = core::ptr::null_mut() };
2656                         CResult_RouteHintHopDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = core::ptr::null_mut(); }
2660                         CResult_RouteHintHopDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2683 /// but with all dynamically-allocated buffers duplicated in new buffers.
2684 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2685 #[repr(C)]
2686 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2687 /// This corresponds to std::vector in C++
2688 pub struct CVec_ChannelDetailsZ {
2689         /// The elements in the array.
2690         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2691         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2692         /// The number of elements pointed to by `data`.
2693         pub datalen: usize
2694 }
2695 impl CVec_ChannelDetailsZ {
2696         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2697                 if self.datalen == 0 { return Vec::new(); }
2698                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2699                 self.data = core::ptr::null_mut();
2700                 self.datalen = 0;
2701                 ret
2702         }
2703         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2704                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2705         }
2706 }
2707 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2708         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2709                 let datalen = v.len();
2710                 let data = Box::into_raw(v.into_boxed_slice());
2711                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2712         }
2713 }
2714 #[no_mangle]
2715 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2716 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2717 impl Drop for CVec_ChannelDetailsZ {
2718         fn drop(&mut self) {
2719                 if self.datalen == 0 { return; }
2720                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2721         }
2722 }
2723 impl Clone for CVec_ChannelDetailsZ {
2724         fn clone(&self) -> Self {
2725                 let mut res = Vec::new();
2726                 if self.datalen == 0 { return Self::from(res); }
2727                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2728                 Self::from(res)
2729         }
2730 }
2731 #[repr(C)]
2732 /// The contents of CResult_RouteLightningErrorZ
2733 pub union CResult_RouteLightningErrorZPtr {
2734         /// A pointer to the contents in the success state.
2735         /// Reading from this pointer when `result_ok` is not set is undefined.
2736         pub result: *mut crate::lightning::routing::router::Route,
2737         /// A pointer to the contents in the error state.
2738         /// Reading from this pointer when `result_ok` is set is undefined.
2739         pub err: *mut crate::lightning::ln::msgs::LightningError,
2740 }
2741 #[repr(C)]
2742 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2743 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2744 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2745 pub struct CResult_RouteLightningErrorZ {
2746         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2747         /// `err` or `result` depending on the state of `result_ok`.
2748         pub contents: CResult_RouteLightningErrorZPtr,
2749         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2750         pub result_ok: bool,
2751 }
2752 #[no_mangle]
2753 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2754 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2755         CResult_RouteLightningErrorZ {
2756                 contents: CResult_RouteLightningErrorZPtr {
2757                         result: Box::into_raw(Box::new(o)),
2758                 },
2759                 result_ok: true,
2760         }
2761 }
2762 #[no_mangle]
2763 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2764 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2765         CResult_RouteLightningErrorZ {
2766                 contents: CResult_RouteLightningErrorZPtr {
2767                         err: Box::into_raw(Box::new(e)),
2768                 },
2769                 result_ok: false,
2770         }
2771 }
2772 /// Checks if the given object is currently in the success state
2773 #[no_mangle]
2774 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2775         o.result_ok
2776 }
2777 #[no_mangle]
2778 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2779 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2780 impl Drop for CResult_RouteLightningErrorZ {
2781         fn drop(&mut self) {
2782                 if self.result_ok {
2783                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2784                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2785                         }
2786                 } else {
2787                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2788                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2789                         }
2790                 }
2791         }
2792 }
2793 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2794         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2795                 let contents = if o.result_ok {
2796                         let result = unsafe { o.contents.result };
2797                         unsafe { o.contents.result = core::ptr::null_mut() };
2798                         CResult_RouteLightningErrorZPtr { result }
2799                 } else {
2800                         let err = unsafe { o.contents.err };
2801                         unsafe { o.contents.err = core::ptr::null_mut(); }
2802                         CResult_RouteLightningErrorZPtr { err }
2803                 };
2804                 Self {
2805                         contents,
2806                         result_ok: o.result_ok,
2807                 }
2808         }
2809 }
2810 impl Clone for CResult_RouteLightningErrorZ {
2811         fn clone(&self) -> Self {
2812                 if self.result_ok {
2813                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2814                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2815                         } }
2816                 } else {
2817                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2818                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2819                         } }
2820                 }
2821         }
2822 }
2823 #[no_mangle]
2824 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2825 /// but with all dynamically-allocated buffers duplicated in new buffers.
2826 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2827 #[repr(C)]
2828 /// The contents of CResult_TxOutAccessErrorZ
2829 pub union CResult_TxOutAccessErrorZPtr {
2830         /// A pointer to the contents in the success state.
2831         /// Reading from this pointer when `result_ok` is not set is undefined.
2832         pub result: *mut crate::c_types::TxOut,
2833         /// A pointer to the contents in the error state.
2834         /// Reading from this pointer when `result_ok` is set is undefined.
2835         pub err: *mut crate::lightning::chain::AccessError,
2836 }
2837 #[repr(C)]
2838 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2839 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2841 pub struct CResult_TxOutAccessErrorZ {
2842         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2843         /// `err` or `result` depending on the state of `result_ok`.
2844         pub contents: CResult_TxOutAccessErrorZPtr,
2845         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2846         pub result_ok: bool,
2847 }
2848 #[no_mangle]
2849 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2850 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2851         CResult_TxOutAccessErrorZ {
2852                 contents: CResult_TxOutAccessErrorZPtr {
2853                         result: Box::into_raw(Box::new(o)),
2854                 },
2855                 result_ok: true,
2856         }
2857 }
2858 #[no_mangle]
2859 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2860 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2861         CResult_TxOutAccessErrorZ {
2862                 contents: CResult_TxOutAccessErrorZPtr {
2863                         err: Box::into_raw(Box::new(e)),
2864                 },
2865                 result_ok: false,
2866         }
2867 }
2868 /// Checks if the given object is currently in the success state
2869 #[no_mangle]
2870 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2871         o.result_ok
2872 }
2873 #[no_mangle]
2874 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2875 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2876 impl Drop for CResult_TxOutAccessErrorZ {
2877         fn drop(&mut self) {
2878                 if self.result_ok {
2879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2881                         }
2882                 } else {
2883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2885                         }
2886                 }
2887         }
2888 }
2889 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2891                 let contents = if o.result_ok {
2892                         let result = unsafe { o.contents.result };
2893                         unsafe { o.contents.result = core::ptr::null_mut() };
2894                         CResult_TxOutAccessErrorZPtr { result }
2895                 } else {
2896                         let err = unsafe { o.contents.err };
2897                         unsafe { o.contents.err = core::ptr::null_mut(); }
2898                         CResult_TxOutAccessErrorZPtr { err }
2899                 };
2900                 Self {
2901                         contents,
2902                         result_ok: o.result_ok,
2903                 }
2904         }
2905 }
2906 impl Clone for CResult_TxOutAccessErrorZ {
2907         fn clone(&self) -> Self {
2908                 if self.result_ok {
2909                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2910                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2911                         } }
2912                 } else {
2913                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2914                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2915                         } }
2916                 }
2917         }
2918 }
2919 #[no_mangle]
2920 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2921 /// but with all dynamically-allocated buffers duplicated in new buffers.
2922 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2923 #[repr(C)]
2924 /// A tuple of 2 elements. See the individual fields for the types contained.
2925 pub struct C2Tuple_usizeTransactionZ {
2926         /// The element at position 0
2927         pub a: usize,
2928         /// The element at position 1
2929         pub b: crate::c_types::Transaction,
2930 }
2931 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2932         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2933                 Self {
2934                         a: tup.0,
2935                         b: tup.1,
2936                 }
2937         }
2938 }
2939 impl C2Tuple_usizeTransactionZ {
2940         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2941                 (self.a, self.b)
2942         }
2943 }
2944 impl Clone for C2Tuple_usizeTransactionZ {
2945         fn clone(&self) -> Self {
2946                 Self {
2947                         a: Clone::clone(&self.a),
2948                         b: Clone::clone(&self.b),
2949                 }
2950         }
2951 }
2952 #[no_mangle]
2953 /// Creates a new tuple which has the same data as `orig`
2954 /// but with all dynamically-allocated buffers duplicated in new buffers.
2955 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2956 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2957 #[no_mangle]
2958 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2959         C2Tuple_usizeTransactionZ { a, b, }
2960 }
2961
2962 #[no_mangle]
2963 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2964 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2965 #[repr(C)]
2966 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2967 /// This corresponds to std::vector in C++
2968 pub struct CVec_C2Tuple_usizeTransactionZZ {
2969         /// The elements in the array.
2970         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2971         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2972         /// The number of elements pointed to by `data`.
2973         pub datalen: usize
2974 }
2975 impl CVec_C2Tuple_usizeTransactionZZ {
2976         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2977                 if self.datalen == 0 { return Vec::new(); }
2978                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2979                 self.data = core::ptr::null_mut();
2980                 self.datalen = 0;
2981                 ret
2982         }
2983         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2984                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2985         }
2986 }
2987 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2988         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2989                 let datalen = v.len();
2990                 let data = Box::into_raw(v.into_boxed_slice());
2991                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2992         }
2993 }
2994 #[no_mangle]
2995 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2996 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2997 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2998         fn drop(&mut self) {
2999                 if self.datalen == 0 { return; }
3000                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3001         }
3002 }
3003 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
3004         fn clone(&self) -> Self {
3005                 let mut res = Vec::new();
3006                 if self.datalen == 0 { return Self::from(res); }
3007                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3008                 Self::from(res)
3009         }
3010 }
3011 #[repr(C)]
3012 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
3013 /// This corresponds to std::vector in C++
3014 pub struct CVec_TxidZ {
3015         /// The elements in the array.
3016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3017         pub data: *mut crate::c_types::ThirtyTwoBytes,
3018         /// The number of elements pointed to by `data`.
3019         pub datalen: usize
3020 }
3021 impl CVec_TxidZ {
3022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3023                 if self.datalen == 0 { return Vec::new(); }
3024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3025                 self.data = core::ptr::null_mut();
3026                 self.datalen = 0;
3027                 ret
3028         }
3029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3031         }
3032 }
3033 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3034         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3035                 let datalen = v.len();
3036                 let data = Box::into_raw(v.into_boxed_slice());
3037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3038         }
3039 }
3040 #[no_mangle]
3041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3042 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3043 impl Drop for CVec_TxidZ {
3044         fn drop(&mut self) {
3045                 if self.datalen == 0 { return; }
3046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3047         }
3048 }
3049 impl Clone for CVec_TxidZ {
3050         fn clone(&self) -> Self {
3051                 let mut res = Vec::new();
3052                 if self.datalen == 0 { return Self::from(res); }
3053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3054                 Self::from(res)
3055         }
3056 }
3057 #[repr(C)]
3058 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3059 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3060         /// Note that this value is always NULL, as there are no contents in the OK variant
3061         pub result: *mut core::ffi::c_void,
3062         /// A pointer to the contents in the error state.
3063         /// Reading from this pointer when `result_ok` is set is undefined.
3064         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3065 }
3066 #[repr(C)]
3067 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3068 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3070 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3071         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3072         /// `err` or `result` depending on the state of `result_ok`.
3073         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3074         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3075         pub result_ok: bool,
3076 }
3077 #[no_mangle]
3078 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3079 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3080         CResult_NoneChannelMonitorUpdateErrZ {
3081                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3082                         result: core::ptr::null_mut(),
3083                 },
3084                 result_ok: true,
3085         }
3086 }
3087 #[no_mangle]
3088 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3089 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3090         CResult_NoneChannelMonitorUpdateErrZ {
3091                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3092                         err: Box::into_raw(Box::new(e)),
3093                 },
3094                 result_ok: false,
3095         }
3096 }
3097 /// Checks if the given object is currently in the success state
3098 #[no_mangle]
3099 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3100         o.result_ok
3101 }
3102 #[no_mangle]
3103 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3104 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3105 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3106         fn drop(&mut self) {
3107                 if self.result_ok {
3108                 } else {
3109                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3110                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3111                         }
3112                 }
3113         }
3114 }
3115 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3117                 let contents = if o.result_ok {
3118                         let _ = unsafe { Box::from_raw(o.contents.result) };
3119                         o.contents.result = core::ptr::null_mut();
3120                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3121                 } else {
3122                         let err = unsafe { o.contents.err };
3123                         unsafe { o.contents.err = core::ptr::null_mut(); }
3124                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3125                 };
3126                 Self {
3127                         contents,
3128                         result_ok: o.result_ok,
3129                 }
3130         }
3131 }
3132 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3133         fn clone(&self) -> Self {
3134                 if self.result_ok {
3135                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3136                                 result: core::ptr::null_mut()
3137                         } }
3138                 } else {
3139                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3140                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3141                         } }
3142                 }
3143         }
3144 }
3145 #[no_mangle]
3146 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3147 /// but with all dynamically-allocated buffers duplicated in new buffers.
3148 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3149 #[repr(C)]
3150 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3151 /// This corresponds to std::vector in C++
3152 pub struct CVec_MonitorEventZ {
3153         /// The elements in the array.
3154         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3155         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3156         /// The number of elements pointed to by `data`.
3157         pub datalen: usize
3158 }
3159 impl CVec_MonitorEventZ {
3160         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3161                 if self.datalen == 0 { return Vec::new(); }
3162                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3163                 self.data = core::ptr::null_mut();
3164                 self.datalen = 0;
3165                 ret
3166         }
3167         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3168                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3169         }
3170 }
3171 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3172         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3173                 let datalen = v.len();
3174                 let data = Box::into_raw(v.into_boxed_slice());
3175                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3176         }
3177 }
3178 #[no_mangle]
3179 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3180 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3181 impl Drop for CVec_MonitorEventZ {
3182         fn drop(&mut self) {
3183                 if self.datalen == 0 { return; }
3184                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3185         }
3186 }
3187 impl Clone for CVec_MonitorEventZ {
3188         fn clone(&self) -> Self {
3189                 let mut res = Vec::new();
3190                 if self.datalen == 0 { return Self::from(res); }
3191                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3192                 Self::from(res)
3193         }
3194 }
3195 #[repr(C)]
3196 #[derive(Clone)]
3197 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3198 pub enum COption_C2Tuple_usizeTransactionZZ {
3199         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3201         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3202         None
3203 }
3204 impl COption_C2Tuple_usizeTransactionZZ {
3205         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3206                 if let Self::None = self { false } else { true }
3207         }
3208         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3209                 !self.is_some()
3210         }
3211         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3212                 if let Self::Some(v) = self { v } else { unreachable!() }
3213         }
3214 }
3215 #[no_mangle]
3216 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3217 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3218         COption_C2Tuple_usizeTransactionZZ::Some(o)
3219 }
3220 #[no_mangle]
3221 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3222 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3223         COption_C2Tuple_usizeTransactionZZ::None
3224 }
3225 #[no_mangle]
3226 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3227 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3228 #[no_mangle]
3229 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3230 /// but with all dynamically-allocated buffers duplicated in new buffers.
3231 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3232 #[repr(C)]
3233 #[derive(Clone)]
3234 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3235 pub enum COption_ClosureReasonZ {
3236         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3237         Some(crate::lightning::util::events::ClosureReason),
3238         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3239         None
3240 }
3241 impl COption_ClosureReasonZ {
3242         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3243                 if let Self::None = self { false } else { true }
3244         }
3245         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3246                 !self.is_some()
3247         }
3248         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3249                 if let Self::Some(v) = self { v } else { unreachable!() }
3250         }
3251 }
3252 #[no_mangle]
3253 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3254 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3255         COption_ClosureReasonZ::Some(o)
3256 }
3257 #[no_mangle]
3258 /// Constructs a new COption_ClosureReasonZ containing nothing
3259 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3260         COption_ClosureReasonZ::None
3261 }
3262 #[no_mangle]
3263 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3264 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3265 #[no_mangle]
3266 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3267 /// but with all dynamically-allocated buffers duplicated in new buffers.
3268 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3269 #[repr(C)]
3270 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3271 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3272         /// A pointer to the contents in the success state.
3273         /// Reading from this pointer when `result_ok` is not set is undefined.
3274         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3275         /// A pointer to the contents in the error state.
3276         /// Reading from this pointer when `result_ok` is set is undefined.
3277         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3278 }
3279 #[repr(C)]
3280 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3281 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3282 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3283 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3284         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3285         /// `err` or `result` depending on the state of `result_ok`.
3286         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3287         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3288         pub result_ok: bool,
3289 }
3290 #[no_mangle]
3291 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3292 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3293         CResult_COption_ClosureReasonZDecodeErrorZ {
3294                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3295                         result: Box::into_raw(Box::new(o)),
3296                 },
3297                 result_ok: true,
3298         }
3299 }
3300 #[no_mangle]
3301 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3302 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3303         CResult_COption_ClosureReasonZDecodeErrorZ {
3304                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3305                         err: Box::into_raw(Box::new(e)),
3306                 },
3307                 result_ok: false,
3308         }
3309 }
3310 /// Checks if the given object is currently in the success state
3311 #[no_mangle]
3312 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3313         o.result_ok
3314 }
3315 #[no_mangle]
3316 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3317 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3318 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3319         fn drop(&mut self) {
3320                 if self.result_ok {
3321                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3322                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3323                         }
3324                 } else {
3325                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3326                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3327                         }
3328                 }
3329         }
3330 }
3331 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3333                 let contents = if o.result_ok {
3334                         let result = unsafe { o.contents.result };
3335                         unsafe { o.contents.result = core::ptr::null_mut() };
3336                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3337                 } else {
3338                         let err = unsafe { o.contents.err };
3339                         unsafe { o.contents.err = core::ptr::null_mut(); }
3340                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3341                 };
3342                 Self {
3343                         contents,
3344                         result_ok: o.result_ok,
3345                 }
3346         }
3347 }
3348 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3349         fn clone(&self) -> Self {
3350                 if self.result_ok {
3351                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3352                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3353                         } }
3354                 } else {
3355                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3356                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3357                         } }
3358                 }
3359         }
3360 }
3361 #[no_mangle]
3362 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3363 /// but with all dynamically-allocated buffers duplicated in new buffers.
3364 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3365 #[repr(C)]
3366 #[derive(Clone)]
3367 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3368 pub enum COption_NetworkUpdateZ {
3369         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3370         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3371         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3372         None
3373 }
3374 impl COption_NetworkUpdateZ {
3375         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3376                 if let Self::None = self { false } else { true }
3377         }
3378         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3379                 !self.is_some()
3380         }
3381         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3382                 if let Self::Some(v) = self { v } else { unreachable!() }
3383         }
3384 }
3385 #[no_mangle]
3386 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3387 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3388         COption_NetworkUpdateZ::Some(o)
3389 }
3390 #[no_mangle]
3391 /// Constructs a new COption_NetworkUpdateZ containing nothing
3392 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3393         COption_NetworkUpdateZ::None
3394 }
3395 #[no_mangle]
3396 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3397 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3398 #[no_mangle]
3399 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3400 /// but with all dynamically-allocated buffers duplicated in new buffers.
3401 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3402 #[repr(C)]
3403 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3404 /// This corresponds to std::vector in C++
3405 pub struct CVec_SpendableOutputDescriptorZ {
3406         /// The elements in the array.
3407         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3408         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3409         /// The number of elements pointed to by `data`.
3410         pub datalen: usize
3411 }
3412 impl CVec_SpendableOutputDescriptorZ {
3413         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3414                 if self.datalen == 0 { return Vec::new(); }
3415                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3416                 self.data = core::ptr::null_mut();
3417                 self.datalen = 0;
3418                 ret
3419         }
3420         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3421                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3422         }
3423 }
3424 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3425         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3426                 let datalen = v.len();
3427                 let data = Box::into_raw(v.into_boxed_slice());
3428                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3429         }
3430 }
3431 #[no_mangle]
3432 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3433 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3434 impl Drop for CVec_SpendableOutputDescriptorZ {
3435         fn drop(&mut self) {
3436                 if self.datalen == 0 { return; }
3437                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3438         }
3439 }
3440 impl Clone for CVec_SpendableOutputDescriptorZ {
3441         fn clone(&self) -> Self {
3442                 let mut res = Vec::new();
3443                 if self.datalen == 0 { return Self::from(res); }
3444                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3445                 Self::from(res)
3446         }
3447 }
3448 #[repr(C)]
3449 #[derive(Clone)]
3450 /// An enum which can either contain a crate::lightning::util::events::Event or not
3451 pub enum COption_EventZ {
3452         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3453         Some(crate::lightning::util::events::Event),
3454         /// When we're in this state, this COption_EventZ contains nothing
3455         None
3456 }
3457 impl COption_EventZ {
3458         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3459                 if let Self::None = self { false } else { true }
3460         }
3461         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3462                 !self.is_some()
3463         }
3464         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3465                 if let Self::Some(v) = self { v } else { unreachable!() }
3466         }
3467 }
3468 #[no_mangle]
3469 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3470 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3471         COption_EventZ::Some(o)
3472 }
3473 #[no_mangle]
3474 /// Constructs a new COption_EventZ containing nothing
3475 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3476         COption_EventZ::None
3477 }
3478 #[no_mangle]
3479 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3480 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3481 #[no_mangle]
3482 /// Creates a new COption_EventZ which has the same data as `orig`
3483 /// but with all dynamically-allocated buffers duplicated in new buffers.
3484 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3485 #[repr(C)]
3486 /// The contents of CResult_COption_EventZDecodeErrorZ
3487 pub union CResult_COption_EventZDecodeErrorZPtr {
3488         /// A pointer to the contents in the success state.
3489         /// Reading from this pointer when `result_ok` is not set is undefined.
3490         pub result: *mut crate::c_types::derived::COption_EventZ,
3491         /// A pointer to the contents in the error state.
3492         /// Reading from this pointer when `result_ok` is set is undefined.
3493         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3494 }
3495 #[repr(C)]
3496 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3497 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3498 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3499 pub struct CResult_COption_EventZDecodeErrorZ {
3500         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3501         /// `err` or `result` depending on the state of `result_ok`.
3502         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3503         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3504         pub result_ok: bool,
3505 }
3506 #[no_mangle]
3507 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3508 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3509         CResult_COption_EventZDecodeErrorZ {
3510                 contents: CResult_COption_EventZDecodeErrorZPtr {
3511                         result: Box::into_raw(Box::new(o)),
3512                 },
3513                 result_ok: true,
3514         }
3515 }
3516 #[no_mangle]
3517 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3518 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3519         CResult_COption_EventZDecodeErrorZ {
3520                 contents: CResult_COption_EventZDecodeErrorZPtr {
3521                         err: Box::into_raw(Box::new(e)),
3522                 },
3523                 result_ok: false,
3524         }
3525 }
3526 /// Checks if the given object is currently in the success state
3527 #[no_mangle]
3528 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3529         o.result_ok
3530 }
3531 #[no_mangle]
3532 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3533 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3534 impl Drop for CResult_COption_EventZDecodeErrorZ {
3535         fn drop(&mut self) {
3536                 if self.result_ok {
3537                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3538                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3539                         }
3540                 } else {
3541                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3542                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3543                         }
3544                 }
3545         }
3546 }
3547 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3548         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3549                 let contents = if o.result_ok {
3550                         let result = unsafe { o.contents.result };
3551                         unsafe { o.contents.result = core::ptr::null_mut() };
3552                         CResult_COption_EventZDecodeErrorZPtr { result }
3553                 } else {
3554                         let err = unsafe { o.contents.err };
3555                         unsafe { o.contents.err = core::ptr::null_mut(); }
3556                         CResult_COption_EventZDecodeErrorZPtr { err }
3557                 };
3558                 Self {
3559                         contents,
3560                         result_ok: o.result_ok,
3561                 }
3562         }
3563 }
3564 impl Clone for CResult_COption_EventZDecodeErrorZ {
3565         fn clone(&self) -> Self {
3566                 if self.result_ok {
3567                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3568                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3569                         } }
3570                 } else {
3571                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3572                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3573                         } }
3574                 }
3575         }
3576 }
3577 #[no_mangle]
3578 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3579 /// but with all dynamically-allocated buffers duplicated in new buffers.
3580 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3581 #[repr(C)]
3582 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3583 /// This corresponds to std::vector in C++
3584 pub struct CVec_MessageSendEventZ {
3585         /// The elements in the array.
3586         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3587         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3588         /// The number of elements pointed to by `data`.
3589         pub datalen: usize
3590 }
3591 impl CVec_MessageSendEventZ {
3592         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3593                 if self.datalen == 0 { return Vec::new(); }
3594                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3595                 self.data = core::ptr::null_mut();
3596                 self.datalen = 0;
3597                 ret
3598         }
3599         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3600                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3601         }
3602 }
3603 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3604         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3605                 let datalen = v.len();
3606                 let data = Box::into_raw(v.into_boxed_slice());
3607                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3608         }
3609 }
3610 #[no_mangle]
3611 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3612 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3613 impl Drop for CVec_MessageSendEventZ {
3614         fn drop(&mut self) {
3615                 if self.datalen == 0 { return; }
3616                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3617         }
3618 }
3619 impl Clone for CVec_MessageSendEventZ {
3620         fn clone(&self) -> Self {
3621                 let mut res = Vec::new();
3622                 if self.datalen == 0 { return Self::from(res); }
3623                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3624                 Self::from(res)
3625         }
3626 }
3627 #[repr(C)]
3628 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3629 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3630         /// A pointer to the contents in the success state.
3631         /// Reading from this pointer when `result_ok` is not set is undefined.
3632         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3633         /// A pointer to the contents in the error state.
3634         /// Reading from this pointer when `result_ok` is set is undefined.
3635         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3636 }
3637 #[repr(C)]
3638 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3639 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3640 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3641 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3642         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3643         /// `err` or `result` depending on the state of `result_ok`.
3644         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3645         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3646         pub result_ok: bool,
3647 }
3648 #[no_mangle]
3649 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3650 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3651         CResult_FixedPenaltyScorerDecodeErrorZ {
3652                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3653                         result: Box::into_raw(Box::new(o)),
3654                 },
3655                 result_ok: true,
3656         }
3657 }
3658 #[no_mangle]
3659 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3660 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3661         CResult_FixedPenaltyScorerDecodeErrorZ {
3662                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3663                         err: Box::into_raw(Box::new(e)),
3664                 },
3665                 result_ok: false,
3666         }
3667 }
3668 /// Checks if the given object is currently in the success state
3669 #[no_mangle]
3670 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3671         o.result_ok
3672 }
3673 #[no_mangle]
3674 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3675 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3676 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3680                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3681                         }
3682                 } else {
3683                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3684                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3685                         }
3686                 }
3687         }
3688 }
3689 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3690         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3691                 let contents = if o.result_ok {
3692                         let result = unsafe { o.contents.result };
3693                         unsafe { o.contents.result = core::ptr::null_mut() };
3694                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3695                 } else {
3696                         let err = unsafe { o.contents.err };
3697                         unsafe { o.contents.err = core::ptr::null_mut(); }
3698                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3699                 };
3700                 Self {
3701                         contents,
3702                         result_ok: o.result_ok,
3703                 }
3704         }
3705 }
3706 impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ {
3707         fn clone(&self) -> Self {
3708                 if self.result_ok {
3709                         Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3710                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::FixedPenaltyScorer>::clone(unsafe { &*self.contents.result })))
3711                         } }
3712                 } else {
3713                         Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3714                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3715                         } }
3716                 }
3717         }
3718 }
3719 #[no_mangle]
3720 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
3721 /// but with all dynamically-allocated buffers duplicated in new buffers.
3722 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) }
3723 #[repr(C)]
3724 /// The contents of CResult_ScoringParametersDecodeErrorZ
3725 pub union CResult_ScoringParametersDecodeErrorZPtr {
3726         /// A pointer to the contents in the success state.
3727         /// Reading from this pointer when `result_ok` is not set is undefined.
3728         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3729         /// A pointer to the contents in the error state.
3730         /// Reading from this pointer when `result_ok` is set is undefined.
3731         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3732 }
3733 #[repr(C)]
3734 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3735 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3736 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3737 pub struct CResult_ScoringParametersDecodeErrorZ {
3738         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3739         /// `err` or `result` depending on the state of `result_ok`.
3740         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3741         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3742         pub result_ok: bool,
3743 }
3744 #[no_mangle]
3745 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3746 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3747         CResult_ScoringParametersDecodeErrorZ {
3748                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3749                         result: Box::into_raw(Box::new(o)),
3750                 },
3751                 result_ok: true,
3752         }
3753 }
3754 #[no_mangle]
3755 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3756 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3757         CResult_ScoringParametersDecodeErrorZ {
3758                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3759                         err: Box::into_raw(Box::new(e)),
3760                 },
3761                 result_ok: false,
3762         }
3763 }
3764 /// Checks if the given object is currently in the success state
3765 #[no_mangle]
3766 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3767         o.result_ok
3768 }
3769 #[no_mangle]
3770 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3771 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3772 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3773         fn drop(&mut self) {
3774                 if self.result_ok {
3775                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3776                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3777                         }
3778                 } else {
3779                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3780                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3781                         }
3782                 }
3783         }
3784 }
3785 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3786         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3787                 let contents = if o.result_ok {
3788                         let result = unsafe { o.contents.result };
3789                         unsafe { o.contents.result = core::ptr::null_mut() };
3790                         CResult_ScoringParametersDecodeErrorZPtr { result }
3791                 } else {
3792                         let err = unsafe { o.contents.err };
3793                         unsafe { o.contents.err = core::ptr::null_mut(); }
3794                         CResult_ScoringParametersDecodeErrorZPtr { err }
3795                 };
3796                 Self {
3797                         contents,
3798                         result_ok: o.result_ok,
3799                 }
3800         }
3801 }
3802 impl Clone for CResult_ScoringParametersDecodeErrorZ {
3803         fn clone(&self) -> Self {
3804                 if self.result_ok {
3805                         Self { result_ok: true, contents: CResult_ScoringParametersDecodeErrorZPtr {
3806                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ScoringParameters>::clone(unsafe { &*self.contents.result })))
3807                         } }
3808                 } else {
3809                         Self { result_ok: false, contents: CResult_ScoringParametersDecodeErrorZPtr {
3810                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3811                         } }
3812                 }
3813         }
3814 }
3815 #[no_mangle]
3816 /// Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
3817 /// but with all dynamically-allocated buffers duplicated in new buffers.
3818 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_clone(orig: &CResult_ScoringParametersDecodeErrorZ) -> CResult_ScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3819 #[repr(C)]
3820 /// The contents of CResult_ScorerDecodeErrorZ
3821 pub union CResult_ScorerDecodeErrorZPtr {
3822         /// A pointer to the contents in the success state.
3823         /// Reading from this pointer when `result_ok` is not set is undefined.
3824         pub result: *mut crate::lightning::routing::scoring::Scorer,
3825         /// A pointer to the contents in the error state.
3826         /// Reading from this pointer when `result_ok` is set is undefined.
3827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3828 }
3829 #[repr(C)]
3830 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3831 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3833 pub struct CResult_ScorerDecodeErrorZ {
3834         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3835         /// `err` or `result` depending on the state of `result_ok`.
3836         pub contents: CResult_ScorerDecodeErrorZPtr,
3837         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3838         pub result_ok: bool,
3839 }
3840 #[no_mangle]
3841 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3842 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3843         CResult_ScorerDecodeErrorZ {
3844                 contents: CResult_ScorerDecodeErrorZPtr {
3845                         result: Box::into_raw(Box::new(o)),
3846                 },
3847                 result_ok: true,
3848         }
3849 }
3850 #[no_mangle]
3851 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3852 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3853         CResult_ScorerDecodeErrorZ {
3854                 contents: CResult_ScorerDecodeErrorZPtr {
3855                         err: Box::into_raw(Box::new(e)),
3856                 },
3857                 result_ok: false,
3858         }
3859 }
3860 /// Checks if the given object is currently in the success state
3861 #[no_mangle]
3862 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3863         o.result_ok
3864 }
3865 #[no_mangle]
3866 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3867 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3868 impl Drop for CResult_ScorerDecodeErrorZ {
3869         fn drop(&mut self) {
3870                 if self.result_ok {
3871                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3872                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3873                         }
3874                 } else {
3875                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3876                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3877                         }
3878                 }
3879         }
3880 }
3881 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3882         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3883                 let contents = if o.result_ok {
3884                         let result = unsafe { o.contents.result };
3885                         unsafe { o.contents.result = core::ptr::null_mut() };
3886                         CResult_ScorerDecodeErrorZPtr { result }
3887                 } else {
3888                         let err = unsafe { o.contents.err };
3889                         unsafe { o.contents.err = core::ptr::null_mut(); }
3890                         CResult_ScorerDecodeErrorZPtr { err }
3891                 };
3892                 Self {
3893                         contents,
3894                         result_ok: o.result_ok,
3895                 }
3896         }
3897 }
3898 #[repr(C)]
3899 /// The contents of CResult_ProbabilisticScorerDecodeErrorZ
3900 pub union CResult_ProbabilisticScorerDecodeErrorZPtr {
3901         /// A pointer to the contents in the success state.
3902         /// Reading from this pointer when `result_ok` is not set is undefined.
3903         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer,
3904         /// A pointer to the contents in the error state.
3905         /// Reading from this pointer when `result_ok` is set is undefined.
3906         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3907 }
3908 #[repr(C)]
3909 /// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
3910 /// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3912 pub struct CResult_ProbabilisticScorerDecodeErrorZ {
3913         /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
3914         /// `err` or `result` depending on the state of `result_ok`.
3915         pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr,
3916         /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
3917         pub result_ok: bool,
3918 }
3919 #[no_mangle]
3920 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
3921 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ {
3922         CResult_ProbabilisticScorerDecodeErrorZ {
3923                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3924                         result: Box::into_raw(Box::new(o)),
3925                 },
3926                 result_ok: true,
3927         }
3928 }
3929 #[no_mangle]
3930 /// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
3931 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ {
3932         CResult_ProbabilisticScorerDecodeErrorZ {
3933                 contents: CResult_ProbabilisticScorerDecodeErrorZPtr {
3934                         err: Box::into_raw(Box::new(e)),
3935                 },
3936                 result_ok: false,
3937         }
3938 }
3939 /// Checks if the given object is currently in the success state
3940 #[no_mangle]
3941 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool {
3942         o.result_ok
3943 }
3944 #[no_mangle]
3945 /// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
3946 pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { }
3947 impl Drop for CResult_ProbabilisticScorerDecodeErrorZ {
3948         fn drop(&mut self) {
3949                 if self.result_ok {
3950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3952                         }
3953                 } else {
3954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3956                         }
3957                 }
3958         }
3959 }
3960 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScorerDecodeErrorZ {
3961         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3962                 let contents = if o.result_ok {
3963                         let result = unsafe { o.contents.result };
3964                         unsafe { o.contents.result = core::ptr::null_mut() };
3965                         CResult_ProbabilisticScorerDecodeErrorZPtr { result }
3966                 } else {
3967                         let err = unsafe { o.contents.err };
3968                         unsafe { o.contents.err = core::ptr::null_mut(); }
3969                         CResult_ProbabilisticScorerDecodeErrorZPtr { err }
3970                 };
3971                 Self {
3972                         contents,
3973                         result_ok: o.result_ok,
3974                 }
3975         }
3976 }
3977 #[repr(C)]
3978 /// The contents of CResult_InitFeaturesDecodeErrorZ
3979 pub union CResult_InitFeaturesDecodeErrorZPtr {
3980         /// A pointer to the contents in the success state.
3981         /// Reading from this pointer when `result_ok` is not set is undefined.
3982         pub result: *mut crate::lightning::ln::features::InitFeatures,
3983         /// A pointer to the contents in the error state.
3984         /// Reading from this pointer when `result_ok` is set is undefined.
3985         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3986 }
3987 #[repr(C)]
3988 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3989 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3990 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3991 pub struct CResult_InitFeaturesDecodeErrorZ {
3992         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3993         /// `err` or `result` depending on the state of `result_ok`.
3994         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3995         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3996         pub result_ok: bool,
3997 }
3998 #[no_mangle]
3999 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
4000 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
4001         CResult_InitFeaturesDecodeErrorZ {
4002                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4003                         result: Box::into_raw(Box::new(o)),
4004                 },
4005                 result_ok: true,
4006         }
4007 }
4008 #[no_mangle]
4009 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
4010 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
4011         CResult_InitFeaturesDecodeErrorZ {
4012                 contents: CResult_InitFeaturesDecodeErrorZPtr {
4013                         err: Box::into_raw(Box::new(e)),
4014                 },
4015                 result_ok: false,
4016         }
4017 }
4018 /// Checks if the given object is currently in the success state
4019 #[no_mangle]
4020 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
4021         o.result_ok
4022 }
4023 #[no_mangle]
4024 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
4025 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
4026 impl Drop for CResult_InitFeaturesDecodeErrorZ {
4027         fn drop(&mut self) {
4028                 if self.result_ok {
4029                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4030                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4031                         }
4032                 } else {
4033                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4034                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4035                         }
4036                 }
4037         }
4038 }
4039 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4040         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4041                 let contents = if o.result_ok {
4042                         let result = unsafe { o.contents.result };
4043                         unsafe { o.contents.result = core::ptr::null_mut() };
4044                         CResult_InitFeaturesDecodeErrorZPtr { result }
4045                 } else {
4046                         let err = unsafe { o.contents.err };
4047                         unsafe { o.contents.err = core::ptr::null_mut(); }
4048                         CResult_InitFeaturesDecodeErrorZPtr { err }
4049                 };
4050                 Self {
4051                         contents,
4052                         result_ok: o.result_ok,
4053                 }
4054         }
4055 }
4056 #[repr(C)]
4057 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4058 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4059         /// A pointer to the contents in the success state.
4060         /// Reading from this pointer when `result_ok` is not set is undefined.
4061         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4062         /// A pointer to the contents in the error state.
4063         /// Reading from this pointer when `result_ok` is set is undefined.
4064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4065 }
4066 #[repr(C)]
4067 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4068 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4070 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4071         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4072         /// `err` or `result` depending on the state of `result_ok`.
4073         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4074         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4075         pub result_ok: bool,
4076 }
4077 #[no_mangle]
4078 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4079 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4080         CResult_ChannelFeaturesDecodeErrorZ {
4081                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4082                         result: Box::into_raw(Box::new(o)),
4083                 },
4084                 result_ok: true,
4085         }
4086 }
4087 #[no_mangle]
4088 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4089 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4090         CResult_ChannelFeaturesDecodeErrorZ {
4091                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4092                         err: Box::into_raw(Box::new(e)),
4093                 },
4094                 result_ok: false,
4095         }
4096 }
4097 /// Checks if the given object is currently in the success state
4098 #[no_mangle]
4099 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4100         o.result_ok
4101 }
4102 #[no_mangle]
4103 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4104 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4105 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4106         fn drop(&mut self) {
4107                 if self.result_ok {
4108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4110                         }
4111                 } else {
4112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4114                         }
4115                 }
4116         }
4117 }
4118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4120                 let contents = if o.result_ok {
4121                         let result = unsafe { o.contents.result };
4122                         unsafe { o.contents.result = core::ptr::null_mut() };
4123                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4124                 } else {
4125                         let err = unsafe { o.contents.err };
4126                         unsafe { o.contents.err = core::ptr::null_mut(); }
4127                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4128                 };
4129                 Self {
4130                         contents,
4131                         result_ok: o.result_ok,
4132                 }
4133         }
4134 }
4135 #[repr(C)]
4136 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4137 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4138         /// A pointer to the contents in the success state.
4139         /// Reading from this pointer when `result_ok` is not set is undefined.
4140         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4141         /// A pointer to the contents in the error state.
4142         /// Reading from this pointer when `result_ok` is set is undefined.
4143         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4144 }
4145 #[repr(C)]
4146 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4147 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4148 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4149 pub struct CResult_NodeFeaturesDecodeErrorZ {
4150         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4151         /// `err` or `result` depending on the state of `result_ok`.
4152         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4153         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4154         pub result_ok: bool,
4155 }
4156 #[no_mangle]
4157 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4158 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4159         CResult_NodeFeaturesDecodeErrorZ {
4160                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4161                         result: Box::into_raw(Box::new(o)),
4162                 },
4163                 result_ok: true,
4164         }
4165 }
4166 #[no_mangle]
4167 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4168 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4169         CResult_NodeFeaturesDecodeErrorZ {
4170                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4171                         err: Box::into_raw(Box::new(e)),
4172                 },
4173                 result_ok: false,
4174         }
4175 }
4176 /// Checks if the given object is currently in the success state
4177 #[no_mangle]
4178 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4179         o.result_ok
4180 }
4181 #[no_mangle]
4182 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4183 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4184 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4185         fn drop(&mut self) {
4186                 if self.result_ok {
4187                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4188                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4189                         }
4190                 } else {
4191                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4192                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4193                         }
4194                 }
4195         }
4196 }
4197 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4198         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4199                 let contents = if o.result_ok {
4200                         let result = unsafe { o.contents.result };
4201                         unsafe { o.contents.result = core::ptr::null_mut() };
4202                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4203                 } else {
4204                         let err = unsafe { o.contents.err };
4205                         unsafe { o.contents.err = core::ptr::null_mut(); }
4206                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4207                 };
4208                 Self {
4209                         contents,
4210                         result_ok: o.result_ok,
4211                 }
4212         }
4213 }
4214 #[repr(C)]
4215 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4216 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4217         /// A pointer to the contents in the success state.
4218         /// Reading from this pointer when `result_ok` is not set is undefined.
4219         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4220         /// A pointer to the contents in the error state.
4221         /// Reading from this pointer when `result_ok` is set is undefined.
4222         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4223 }
4224 #[repr(C)]
4225 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4226 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4227 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4228 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4229         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4230         /// `err` or `result` depending on the state of `result_ok`.
4231         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4232         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4233         pub result_ok: bool,
4234 }
4235 #[no_mangle]
4236 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4237 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4238         CResult_InvoiceFeaturesDecodeErrorZ {
4239                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4240                         result: Box::into_raw(Box::new(o)),
4241                 },
4242                 result_ok: true,
4243         }
4244 }
4245 #[no_mangle]
4246 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4247 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4248         CResult_InvoiceFeaturesDecodeErrorZ {
4249                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4250                         err: Box::into_raw(Box::new(e)),
4251                 },
4252                 result_ok: false,
4253         }
4254 }
4255 /// Checks if the given object is currently in the success state
4256 #[no_mangle]
4257 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4258         o.result_ok
4259 }
4260 #[no_mangle]
4261 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4262 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4263 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4264         fn drop(&mut self) {
4265                 if self.result_ok {
4266                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4267                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4268                         }
4269                 } else {
4270                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4271                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4272                         }
4273                 }
4274         }
4275 }
4276 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4277         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4278                 let contents = if o.result_ok {
4279                         let result = unsafe { o.contents.result };
4280                         unsafe { o.contents.result = core::ptr::null_mut() };
4281                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4282                 } else {
4283                         let err = unsafe { o.contents.err };
4284                         unsafe { o.contents.err = core::ptr::null_mut(); }
4285                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4286                 };
4287                 Self {
4288                         contents,
4289                         result_ok: o.result_ok,
4290                 }
4291         }
4292 }
4293 #[repr(C)]
4294 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4295 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4296         /// A pointer to the contents in the success state.
4297         /// Reading from this pointer when `result_ok` is not set is undefined.
4298         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4299         /// A pointer to the contents in the error state.
4300         /// Reading from this pointer when `result_ok` is set is undefined.
4301         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4302 }
4303 #[repr(C)]
4304 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4305 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4306 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4307 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4308         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4309         /// `err` or `result` depending on the state of `result_ok`.
4310         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4311         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4312         pub result_ok: bool,
4313 }
4314 #[no_mangle]
4315 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4316 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4317         CResult_ChannelTypeFeaturesDecodeErrorZ {
4318                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4319                         result: Box::into_raw(Box::new(o)),
4320                 },
4321                 result_ok: true,
4322         }
4323 }
4324 #[no_mangle]
4325 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4326 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4327         CResult_ChannelTypeFeaturesDecodeErrorZ {
4328                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4329                         err: Box::into_raw(Box::new(e)),
4330                 },
4331                 result_ok: false,
4332         }
4333 }
4334 /// Checks if the given object is currently in the success state
4335 #[no_mangle]
4336 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4337         o.result_ok
4338 }
4339 #[no_mangle]
4340 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4341 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4342 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4343         fn drop(&mut self) {
4344                 if self.result_ok {
4345                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4346                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4347                         }
4348                 } else {
4349                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4350                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4351                         }
4352                 }
4353         }
4354 }
4355 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4356         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4357                 let contents = if o.result_ok {
4358                         let result = unsafe { o.contents.result };
4359                         unsafe { o.contents.result = core::ptr::null_mut() };
4360                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4361                 } else {
4362                         let err = unsafe { o.contents.err };
4363                         unsafe { o.contents.err = core::ptr::null_mut(); }
4364                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4365                 };
4366                 Self {
4367                         contents,
4368                         result_ok: o.result_ok,
4369                 }
4370         }
4371 }
4372 #[repr(C)]
4373 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4374 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4375         /// A pointer to the contents in the success state.
4376         /// Reading from this pointer when `result_ok` is not set is undefined.
4377         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4378         /// A pointer to the contents in the error state.
4379         /// Reading from this pointer when `result_ok` is set is undefined.
4380         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4381 }
4382 #[repr(C)]
4383 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4384 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4385 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4386 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4387         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4388         /// `err` or `result` depending on the state of `result_ok`.
4389         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4390         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4391         pub result_ok: bool,
4392 }
4393 #[no_mangle]
4394 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4395 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4396         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4397                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4398                         result: Box::into_raw(Box::new(o)),
4399                 },
4400                 result_ok: true,
4401         }
4402 }
4403 #[no_mangle]
4404 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4405 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4406         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4407                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4408                         err: Box::into_raw(Box::new(e)),
4409                 },
4410                 result_ok: false,
4411         }
4412 }
4413 /// Checks if the given object is currently in the success state
4414 #[no_mangle]
4415 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4416         o.result_ok
4417 }
4418 #[no_mangle]
4419 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4420 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4421 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4422         fn drop(&mut self) {
4423                 if self.result_ok {
4424                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4425                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4426                         }
4427                 } else {
4428                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4429                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4430                         }
4431                 }
4432         }
4433 }
4434 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4435         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4436                 let contents = if o.result_ok {
4437                         let result = unsafe { o.contents.result };
4438                         unsafe { o.contents.result = core::ptr::null_mut() };
4439                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4440                 } else {
4441                         let err = unsafe { o.contents.err };
4442                         unsafe { o.contents.err = core::ptr::null_mut(); }
4443                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4444                 };
4445                 Self {
4446                         contents,
4447                         result_ok: o.result_ok,
4448                 }
4449         }
4450 }
4451 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4452         fn clone(&self) -> Self {
4453                 if self.result_ok {
4454                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4455                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4456                         } }
4457                 } else {
4458                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4459                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4460                         } }
4461                 }
4462         }
4463 }
4464 #[no_mangle]
4465 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4466 /// but with all dynamically-allocated buffers duplicated in new buffers.
4467 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4468 #[repr(C)]
4469 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4470 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4471         /// A pointer to the contents in the success state.
4472         /// Reading from this pointer when `result_ok` is not set is undefined.
4473         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4474         /// A pointer to the contents in the error state.
4475         /// Reading from this pointer when `result_ok` is set is undefined.
4476         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4477 }
4478 #[repr(C)]
4479 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4480 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4482 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4483         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4484         /// `err` or `result` depending on the state of `result_ok`.
4485         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4486         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4487         pub result_ok: bool,
4488 }
4489 #[no_mangle]
4490 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4491 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4492         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4493                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4494                         result: Box::into_raw(Box::new(o)),
4495                 },
4496                 result_ok: true,
4497         }
4498 }
4499 #[no_mangle]
4500 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4501 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4502         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4503                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4504                         err: Box::into_raw(Box::new(e)),
4505                 },
4506                 result_ok: false,
4507         }
4508 }
4509 /// Checks if the given object is currently in the success state
4510 #[no_mangle]
4511 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4512         o.result_ok
4513 }
4514 #[no_mangle]
4515 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4516 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4517 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4518         fn drop(&mut self) {
4519                 if self.result_ok {
4520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4522                         }
4523                 } else {
4524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4526                         }
4527                 }
4528         }
4529 }
4530 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4531         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4532                 let contents = if o.result_ok {
4533                         let result = unsafe { o.contents.result };
4534                         unsafe { o.contents.result = core::ptr::null_mut() };
4535                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4536                 } else {
4537                         let err = unsafe { o.contents.err };
4538                         unsafe { o.contents.err = core::ptr::null_mut(); }
4539                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4540                 };
4541                 Self {
4542                         contents,
4543                         result_ok: o.result_ok,
4544                 }
4545         }
4546 }
4547 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4548         fn clone(&self) -> Self {
4549                 if self.result_ok {
4550                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4551                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4552                         } }
4553                 } else {
4554                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4556                         } }
4557                 }
4558         }
4559 }
4560 #[no_mangle]
4561 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4562 /// but with all dynamically-allocated buffers duplicated in new buffers.
4563 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4564 #[repr(C)]
4565 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4566 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4567         /// A pointer to the contents in the success state.
4568         /// Reading from this pointer when `result_ok` is not set is undefined.
4569         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4570         /// A pointer to the contents in the error state.
4571         /// Reading from this pointer when `result_ok` is set is undefined.
4572         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4573 }
4574 #[repr(C)]
4575 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4576 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4577 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4578 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4579         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4580         /// `err` or `result` depending on the state of `result_ok`.
4581         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4582         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4583         pub result_ok: bool,
4584 }
4585 #[no_mangle]
4586 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4587 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4588         CResult_SpendableOutputDescriptorDecodeErrorZ {
4589                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4590                         result: Box::into_raw(Box::new(o)),
4591                 },
4592                 result_ok: true,
4593         }
4594 }
4595 #[no_mangle]
4596 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4597 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4598         CResult_SpendableOutputDescriptorDecodeErrorZ {
4599                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4600                         err: Box::into_raw(Box::new(e)),
4601                 },
4602                 result_ok: false,
4603         }
4604 }
4605 /// Checks if the given object is currently in the success state
4606 #[no_mangle]
4607 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4608         o.result_ok
4609 }
4610 #[no_mangle]
4611 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4612 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4613 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4614         fn drop(&mut self) {
4615                 if self.result_ok {
4616                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4617                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4618                         }
4619                 } else {
4620                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4621                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4622                         }
4623                 }
4624         }
4625 }
4626 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4627         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4628                 let contents = if o.result_ok {
4629                         let result = unsafe { o.contents.result };
4630                         unsafe { o.contents.result = core::ptr::null_mut() };
4631                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4632                 } else {
4633                         let err = unsafe { o.contents.err };
4634                         unsafe { o.contents.err = core::ptr::null_mut(); }
4635                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4636                 };
4637                 Self {
4638                         contents,
4639                         result_ok: o.result_ok,
4640                 }
4641         }
4642 }
4643 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4644         fn clone(&self) -> Self {
4645                 if self.result_ok {
4646                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4647                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4648                         } }
4649                 } else {
4650                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4651                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4652                         } }
4653                 }
4654         }
4655 }
4656 #[no_mangle]
4657 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4658 /// but with all dynamically-allocated buffers duplicated in new buffers.
4659 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4660 #[repr(C)]
4661 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4662 /// This corresponds to std::vector in C++
4663 pub struct CVec_PaymentPreimageZ {
4664         /// The elements in the array.
4665         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4666         pub data: *mut crate::c_types::ThirtyTwoBytes,
4667         /// The number of elements pointed to by `data`.
4668         pub datalen: usize
4669 }
4670 impl CVec_PaymentPreimageZ {
4671         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4672                 if self.datalen == 0 { return Vec::new(); }
4673                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4674                 self.data = core::ptr::null_mut();
4675                 self.datalen = 0;
4676                 ret
4677         }
4678         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4679                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4680         }
4681 }
4682 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4683         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4684                 let datalen = v.len();
4685                 let data = Box::into_raw(v.into_boxed_slice());
4686                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4687         }
4688 }
4689 #[no_mangle]
4690 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4691 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4692 impl Drop for CVec_PaymentPreimageZ {
4693         fn drop(&mut self) {
4694                 if self.datalen == 0 { return; }
4695                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4696         }
4697 }
4698 impl Clone for CVec_PaymentPreimageZ {
4699         fn clone(&self) -> Self {
4700                 let mut res = Vec::new();
4701                 if self.datalen == 0 { return Self::from(res); }
4702                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4703                 Self::from(res)
4704         }
4705 }
4706 #[repr(C)]
4707 /// A tuple of 2 elements. See the individual fields for the types contained.
4708 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4709         /// The element at position 0
4710         pub a: crate::c_types::Signature,
4711         /// The element at position 1
4712         pub b: crate::c_types::derived::CVec_SignatureZ,
4713 }
4714 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4715         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4716                 Self {
4717                         a: tup.0,
4718                         b: tup.1,
4719                 }
4720         }
4721 }
4722 impl C2Tuple_SignatureCVec_SignatureZZ {
4723         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4724                 (self.a, self.b)
4725         }
4726 }
4727 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4728         fn clone(&self) -> Self {
4729                 Self {
4730                         a: Clone::clone(&self.a),
4731                         b: Clone::clone(&self.b),
4732                 }
4733         }
4734 }
4735 #[no_mangle]
4736 /// Creates a new tuple which has the same data as `orig`
4737 /// but with all dynamically-allocated buffers duplicated in new buffers.
4738 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4739 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4740 #[no_mangle]
4741 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4742         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4743 }
4744
4745 #[no_mangle]
4746 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4747 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4748 #[repr(C)]
4749 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4750 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4751         /// A pointer to the contents in the success state.
4752         /// Reading from this pointer when `result_ok` is not set is undefined.
4753         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4754         /// Note that this value is always NULL, as there are no contents in the Err variant
4755         pub err: *mut core::ffi::c_void,
4756 }
4757 #[repr(C)]
4758 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4759 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4760 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4761 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4762         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4763         /// `err` or `result` depending on the state of `result_ok`.
4764         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4765         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4766         pub result_ok: bool,
4767 }
4768 #[no_mangle]
4769 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4770 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4771         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4772                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4773                         result: Box::into_raw(Box::new(o)),
4774                 },
4775                 result_ok: true,
4776         }
4777 }
4778 #[no_mangle]
4779 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4780 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4781         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4782                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4783                         err: core::ptr::null_mut(),
4784                 },
4785                 result_ok: false,
4786         }
4787 }
4788 /// Checks if the given object is currently in the success state
4789 #[no_mangle]
4790 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4791         o.result_ok
4792 }
4793 #[no_mangle]
4794 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4795 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4796 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4797         fn drop(&mut self) {
4798                 if self.result_ok {
4799                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4800                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4801                         }
4802                 } else {
4803                 }
4804         }
4805 }
4806 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4807         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4808                 let contents = if o.result_ok {
4809                         let result = unsafe { o.contents.result };
4810                         unsafe { o.contents.result = core::ptr::null_mut() };
4811                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4812                 } else {
4813                         let _ = unsafe { Box::from_raw(o.contents.err) };
4814                         o.contents.err = core::ptr::null_mut();
4815                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4816                 };
4817                 Self {
4818                         contents,
4819                         result_ok: o.result_ok,
4820                 }
4821         }
4822 }
4823 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4824         fn clone(&self) -> Self {
4825                 if self.result_ok {
4826                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4827                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4828                         } }
4829                 } else {
4830                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4831                                 err: core::ptr::null_mut()
4832                         } }
4833                 }
4834         }
4835 }
4836 #[no_mangle]
4837 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4838 /// but with all dynamically-allocated buffers duplicated in new buffers.
4839 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4840 #[repr(C)]
4841 /// The contents of CResult_SignatureNoneZ
4842 pub union CResult_SignatureNoneZPtr {
4843         /// A pointer to the contents in the success state.
4844         /// Reading from this pointer when `result_ok` is not set is undefined.
4845         pub result: *mut crate::c_types::Signature,
4846         /// Note that this value is always NULL, as there are no contents in the Err variant
4847         pub err: *mut core::ffi::c_void,
4848 }
4849 #[repr(C)]
4850 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4851 /// containing a crate::c_types::Signature on success and a () on failure.
4852 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4853 pub struct CResult_SignatureNoneZ {
4854         /// The contents of this CResult_SignatureNoneZ, accessible via either
4855         /// `err` or `result` depending on the state of `result_ok`.
4856         pub contents: CResult_SignatureNoneZPtr,
4857         /// Whether this CResult_SignatureNoneZ represents a success state.
4858         pub result_ok: bool,
4859 }
4860 #[no_mangle]
4861 /// Creates a new CResult_SignatureNoneZ in the success state.
4862 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4863         CResult_SignatureNoneZ {
4864                 contents: CResult_SignatureNoneZPtr {
4865                         result: Box::into_raw(Box::new(o)),
4866                 },
4867                 result_ok: true,
4868         }
4869 }
4870 #[no_mangle]
4871 /// Creates a new CResult_SignatureNoneZ in the error state.
4872 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4873         CResult_SignatureNoneZ {
4874                 contents: CResult_SignatureNoneZPtr {
4875                         err: core::ptr::null_mut(),
4876                 },
4877                 result_ok: false,
4878         }
4879 }
4880 /// Checks if the given object is currently in the success state
4881 #[no_mangle]
4882 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4883         o.result_ok
4884 }
4885 #[no_mangle]
4886 /// Frees any resources used by the CResult_SignatureNoneZ.
4887 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4888 impl Drop for CResult_SignatureNoneZ {
4889         fn drop(&mut self) {
4890                 if self.result_ok {
4891                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4892                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4893                         }
4894                 } else {
4895                 }
4896         }
4897 }
4898 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4899         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4900                 let contents = if o.result_ok {
4901                         let result = unsafe { o.contents.result };
4902                         unsafe { o.contents.result = core::ptr::null_mut() };
4903                         CResult_SignatureNoneZPtr { result }
4904                 } else {
4905                         let _ = unsafe { Box::from_raw(o.contents.err) };
4906                         o.contents.err = core::ptr::null_mut();
4907                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4908                 };
4909                 Self {
4910                         contents,
4911                         result_ok: o.result_ok,
4912                 }
4913         }
4914 }
4915 impl Clone for CResult_SignatureNoneZ {
4916         fn clone(&self) -> Self {
4917                 if self.result_ok {
4918                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4919                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4920                         } }
4921                 } else {
4922                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4923                                 err: core::ptr::null_mut()
4924                         } }
4925                 }
4926         }
4927 }
4928 #[no_mangle]
4929 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4930 /// but with all dynamically-allocated buffers duplicated in new buffers.
4931 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4932 #[repr(C)]
4933 /// A tuple of 2 elements. See the individual fields for the types contained.
4934 pub struct C2Tuple_SignatureSignatureZ {
4935         /// The element at position 0
4936         pub a: crate::c_types::Signature,
4937         /// The element at position 1
4938         pub b: crate::c_types::Signature,
4939 }
4940 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4941         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4942                 Self {
4943                         a: tup.0,
4944                         b: tup.1,
4945                 }
4946         }
4947 }
4948 impl C2Tuple_SignatureSignatureZ {
4949         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4950                 (self.a, self.b)
4951         }
4952 }
4953 impl Clone for C2Tuple_SignatureSignatureZ {
4954         fn clone(&self) -> Self {
4955                 Self {
4956                         a: Clone::clone(&self.a),
4957                         b: Clone::clone(&self.b),
4958                 }
4959         }
4960 }
4961 #[no_mangle]
4962 /// Creates a new tuple which has the same data as `orig`
4963 /// but with all dynamically-allocated buffers duplicated in new buffers.
4964 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4965 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4966 #[no_mangle]
4967 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4968         C2Tuple_SignatureSignatureZ { a, b, }
4969 }
4970
4971 #[no_mangle]
4972 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4973 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4974 #[repr(C)]
4975 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4976 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4977         /// A pointer to the contents in the success state.
4978         /// Reading from this pointer when `result_ok` is not set is undefined.
4979         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4980         /// Note that this value is always NULL, as there are no contents in the Err variant
4981         pub err: *mut core::ffi::c_void,
4982 }
4983 #[repr(C)]
4984 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4985 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4986 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4987 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4988         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4989         /// `err` or `result` depending on the state of `result_ok`.
4990         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4991         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4992         pub result_ok: bool,
4993 }
4994 #[no_mangle]
4995 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4996 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4997         CResult_C2Tuple_SignatureSignatureZNoneZ {
4998                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4999                         result: Box::into_raw(Box::new(o)),
5000                 },
5001                 result_ok: true,
5002         }
5003 }
5004 #[no_mangle]
5005 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
5006 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
5007         CResult_C2Tuple_SignatureSignatureZNoneZ {
5008                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5009                         err: core::ptr::null_mut(),
5010                 },
5011                 result_ok: false,
5012         }
5013 }
5014 /// Checks if the given object is currently in the success state
5015 #[no_mangle]
5016 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
5017         o.result_ok
5018 }
5019 #[no_mangle]
5020 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
5021 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
5022 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
5023         fn drop(&mut self) {
5024                 if self.result_ok {
5025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5027                         }
5028                 } else {
5029                 }
5030         }
5031 }
5032 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
5033         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5034                 let contents = if o.result_ok {
5035                         let result = unsafe { o.contents.result };
5036                         unsafe { o.contents.result = core::ptr::null_mut() };
5037                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5038                 } else {
5039                         let _ = unsafe { Box::from_raw(o.contents.err) };
5040                         o.contents.err = core::ptr::null_mut();
5041                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5042                 };
5043                 Self {
5044                         contents,
5045                         result_ok: o.result_ok,
5046                 }
5047         }
5048 }
5049 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5050         fn clone(&self) -> Self {
5051                 if self.result_ok {
5052                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5053                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5054                         } }
5055                 } else {
5056                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5057                                 err: core::ptr::null_mut()
5058                         } }
5059                 }
5060         }
5061 }
5062 #[no_mangle]
5063 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5064 /// but with all dynamically-allocated buffers duplicated in new buffers.
5065 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5066 #[repr(C)]
5067 /// The contents of CResult_SecretKeyNoneZ
5068 pub union CResult_SecretKeyNoneZPtr {
5069         /// A pointer to the contents in the success state.
5070         /// Reading from this pointer when `result_ok` is not set is undefined.
5071         pub result: *mut crate::c_types::SecretKey,
5072         /// Note that this value is always NULL, as there are no contents in the Err variant
5073         pub err: *mut core::ffi::c_void,
5074 }
5075 #[repr(C)]
5076 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5077 /// containing a crate::c_types::SecretKey on success and a () on failure.
5078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5079 pub struct CResult_SecretKeyNoneZ {
5080         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5081         /// `err` or `result` depending on the state of `result_ok`.
5082         pub contents: CResult_SecretKeyNoneZPtr,
5083         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5084         pub result_ok: bool,
5085 }
5086 #[no_mangle]
5087 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5088 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5089         CResult_SecretKeyNoneZ {
5090                 contents: CResult_SecretKeyNoneZPtr {
5091                         result: Box::into_raw(Box::new(o)),
5092                 },
5093                 result_ok: true,
5094         }
5095 }
5096 #[no_mangle]
5097 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5098 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5099         CResult_SecretKeyNoneZ {
5100                 contents: CResult_SecretKeyNoneZPtr {
5101                         err: core::ptr::null_mut(),
5102                 },
5103                 result_ok: false,
5104         }
5105 }
5106 /// Checks if the given object is currently in the success state
5107 #[no_mangle]
5108 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5109         o.result_ok
5110 }
5111 #[no_mangle]
5112 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5113 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5114 impl Drop for CResult_SecretKeyNoneZ {
5115         fn drop(&mut self) {
5116                 if self.result_ok {
5117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5119                         }
5120                 } else {
5121                 }
5122         }
5123 }
5124 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5125         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5126                 let contents = if o.result_ok {
5127                         let result = unsafe { o.contents.result };
5128                         unsafe { o.contents.result = core::ptr::null_mut() };
5129                         CResult_SecretKeyNoneZPtr { result }
5130                 } else {
5131                         let _ = unsafe { Box::from_raw(o.contents.err) };
5132                         o.contents.err = core::ptr::null_mut();
5133                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5134                 };
5135                 Self {
5136                         contents,
5137                         result_ok: o.result_ok,
5138                 }
5139         }
5140 }
5141 impl Clone for CResult_SecretKeyNoneZ {
5142         fn clone(&self) -> Self {
5143                 if self.result_ok {
5144                         Self { result_ok: true, contents: CResult_SecretKeyNoneZPtr {
5145                                 result: Box::into_raw(Box::new(<crate::c_types::SecretKey>::clone(unsafe { &*self.contents.result })))
5146                         } }
5147                 } else {
5148                         Self { result_ok: false, contents: CResult_SecretKeyNoneZPtr {
5149                                 err: core::ptr::null_mut()
5150                         } }
5151                 }
5152         }
5153 }
5154 #[no_mangle]
5155 /// Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
5156 /// but with all dynamically-allocated buffers duplicated in new buffers.
5157 pub extern "C" fn CResult_SecretKeyNoneZ_clone(orig: &CResult_SecretKeyNoneZ) -> CResult_SecretKeyNoneZ { Clone::clone(&orig) }
5158 #[repr(C)]
5159 /// The contents of CResult_SignDecodeErrorZ
5160 pub union CResult_SignDecodeErrorZPtr {
5161         /// A pointer to the contents in the success state.
5162         /// Reading from this pointer when `result_ok` is not set is undefined.
5163         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5164         /// A pointer to the contents in the error state.
5165         /// Reading from this pointer when `result_ok` is set is undefined.
5166         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5167 }
5168 #[repr(C)]
5169 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5170 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5171 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5172 pub struct CResult_SignDecodeErrorZ {
5173         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5174         /// `err` or `result` depending on the state of `result_ok`.
5175         pub contents: CResult_SignDecodeErrorZPtr,
5176         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5177         pub result_ok: bool,
5178 }
5179 #[no_mangle]
5180 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5181 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5182         CResult_SignDecodeErrorZ {
5183                 contents: CResult_SignDecodeErrorZPtr {
5184                         result: Box::into_raw(Box::new(o)),
5185                 },
5186                 result_ok: true,
5187         }
5188 }
5189 #[no_mangle]
5190 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5191 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5192         CResult_SignDecodeErrorZ {
5193                 contents: CResult_SignDecodeErrorZPtr {
5194                         err: Box::into_raw(Box::new(e)),
5195                 },
5196                 result_ok: false,
5197         }
5198 }
5199 /// Checks if the given object is currently in the success state
5200 #[no_mangle]
5201 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5202         o.result_ok
5203 }
5204 #[no_mangle]
5205 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5206 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5207 impl Drop for CResult_SignDecodeErrorZ {
5208         fn drop(&mut self) {
5209                 if self.result_ok {
5210                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5211                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5212                         }
5213                 } else {
5214                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5215                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5216                         }
5217                 }
5218         }
5219 }
5220 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5221         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5222                 let contents = if o.result_ok {
5223                         let result = unsafe { o.contents.result };
5224                         unsafe { o.contents.result = core::ptr::null_mut() };
5225                         CResult_SignDecodeErrorZPtr { result }
5226                 } else {
5227                         let err = unsafe { o.contents.err };
5228                         unsafe { o.contents.err = core::ptr::null_mut(); }
5229                         CResult_SignDecodeErrorZPtr { err }
5230                 };
5231                 Self {
5232                         contents,
5233                         result_ok: o.result_ok,
5234                 }
5235         }
5236 }
5237 impl Clone for CResult_SignDecodeErrorZ {
5238         fn clone(&self) -> Self {
5239                 if self.result_ok {
5240                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5241                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5242                         } }
5243                 } else {
5244                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5245                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5246                         } }
5247                 }
5248         }
5249 }
5250 #[no_mangle]
5251 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5252 /// but with all dynamically-allocated buffers duplicated in new buffers.
5253 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5254 #[repr(C)]
5255 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5256 /// This corresponds to std::vector in C++
5257 pub struct CVec_u5Z {
5258         /// The elements in the array.
5259         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5260         pub data: *mut crate::c_types::u5,
5261         /// The number of elements pointed to by `data`.
5262         pub datalen: usize
5263 }
5264 impl CVec_u5Z {
5265         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5266                 if self.datalen == 0 { return Vec::new(); }
5267                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5268                 self.data = core::ptr::null_mut();
5269                 self.datalen = 0;
5270                 ret
5271         }
5272         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5273                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5274         }
5275 }
5276 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5277         fn from(v: Vec<crate::c_types::u5>) -> Self {
5278                 let datalen = v.len();
5279                 let data = Box::into_raw(v.into_boxed_slice());
5280                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5281         }
5282 }
5283 #[no_mangle]
5284 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5285 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5286 impl Drop for CVec_u5Z {
5287         fn drop(&mut self) {
5288                 if self.datalen == 0 { return; }
5289                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5290         }
5291 }
5292 impl Clone for CVec_u5Z {
5293         fn clone(&self) -> Self {
5294                 let mut res = Vec::new();
5295                 if self.datalen == 0 { return Self::from(res); }
5296                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5297                 Self::from(res)
5298         }
5299 }
5300 #[repr(C)]
5301 /// The contents of CResult_RecoverableSignatureNoneZ
5302 pub union CResult_RecoverableSignatureNoneZPtr {
5303         /// A pointer to the contents in the success state.
5304         /// Reading from this pointer when `result_ok` is not set is undefined.
5305         pub result: *mut crate::c_types::RecoverableSignature,
5306         /// Note that this value is always NULL, as there are no contents in the Err variant
5307         pub err: *mut core::ffi::c_void,
5308 }
5309 #[repr(C)]
5310 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5311 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5312 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5313 pub struct CResult_RecoverableSignatureNoneZ {
5314         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5315         /// `err` or `result` depending on the state of `result_ok`.
5316         pub contents: CResult_RecoverableSignatureNoneZPtr,
5317         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5318         pub result_ok: bool,
5319 }
5320 #[no_mangle]
5321 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5322 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5323         CResult_RecoverableSignatureNoneZ {
5324                 contents: CResult_RecoverableSignatureNoneZPtr {
5325                         result: Box::into_raw(Box::new(o)),
5326                 },
5327                 result_ok: true,
5328         }
5329 }
5330 #[no_mangle]
5331 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5332 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5333         CResult_RecoverableSignatureNoneZ {
5334                 contents: CResult_RecoverableSignatureNoneZPtr {
5335                         err: core::ptr::null_mut(),
5336                 },
5337                 result_ok: false,
5338         }
5339 }
5340 /// Checks if the given object is currently in the success state
5341 #[no_mangle]
5342 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5343         o.result_ok
5344 }
5345 #[no_mangle]
5346 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5347 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5348 impl Drop for CResult_RecoverableSignatureNoneZ {
5349         fn drop(&mut self) {
5350                 if self.result_ok {
5351                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5352                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5353                         }
5354                 } else {
5355                 }
5356         }
5357 }
5358 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5359         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5360                 let contents = if o.result_ok {
5361                         let result = unsafe { o.contents.result };
5362                         unsafe { o.contents.result = core::ptr::null_mut() };
5363                         CResult_RecoverableSignatureNoneZPtr { result }
5364                 } else {
5365                         let _ = unsafe { Box::from_raw(o.contents.err) };
5366                         o.contents.err = core::ptr::null_mut();
5367                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5368                 };
5369                 Self {
5370                         contents,
5371                         result_ok: o.result_ok,
5372                 }
5373         }
5374 }
5375 impl Clone for CResult_RecoverableSignatureNoneZ {
5376         fn clone(&self) -> Self {
5377                 if self.result_ok {
5378                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5379                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5380                         } }
5381                 } else {
5382                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5383                                 err: core::ptr::null_mut()
5384                         } }
5385                 }
5386         }
5387 }
5388 #[no_mangle]
5389 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5390 /// but with all dynamically-allocated buffers duplicated in new buffers.
5391 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5392 #[repr(C)]
5393 /// A dynamically-allocated array of u8s of arbitrary size.
5394 /// This corresponds to std::vector in C++
5395 pub struct CVec_u8Z {
5396         /// The elements in the array.
5397         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5398         pub data: *mut u8,
5399         /// The number of elements pointed to by `data`.
5400         pub datalen: usize
5401 }
5402 impl CVec_u8Z {
5403         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5404                 if self.datalen == 0 { return Vec::new(); }
5405                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5406                 self.data = core::ptr::null_mut();
5407                 self.datalen = 0;
5408                 ret
5409         }
5410         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5411                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5412         }
5413 }
5414 impl From<Vec<u8>> for CVec_u8Z {
5415         fn from(v: Vec<u8>) -> Self {
5416                 let datalen = v.len();
5417                 let data = Box::into_raw(v.into_boxed_slice());
5418                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5419         }
5420 }
5421 #[no_mangle]
5422 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5423 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5424 impl Drop for CVec_u8Z {
5425         fn drop(&mut self) {
5426                 if self.datalen == 0 { return; }
5427                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5428         }
5429 }
5430 impl Clone for CVec_u8Z {
5431         fn clone(&self) -> Self {
5432                 let mut res = Vec::new();
5433                 if self.datalen == 0 { return Self::from(res); }
5434                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5435                 Self::from(res)
5436         }
5437 }
5438 #[repr(C)]
5439 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5440 /// This corresponds to std::vector in C++
5441 pub struct CVec_CVec_u8ZZ {
5442         /// The elements in the array.
5443         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5444         pub data: *mut crate::c_types::derived::CVec_u8Z,
5445         /// The number of elements pointed to by `data`.
5446         pub datalen: usize
5447 }
5448 impl CVec_CVec_u8ZZ {
5449         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5450                 if self.datalen == 0 { return Vec::new(); }
5451                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5452                 self.data = core::ptr::null_mut();
5453                 self.datalen = 0;
5454                 ret
5455         }
5456         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5457                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5458         }
5459 }
5460 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5461         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5462                 let datalen = v.len();
5463                 let data = Box::into_raw(v.into_boxed_slice());
5464                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5465         }
5466 }
5467 #[no_mangle]
5468 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5469 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5470 impl Drop for CVec_CVec_u8ZZ {
5471         fn drop(&mut self) {
5472                 if self.datalen == 0 { return; }
5473                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5474         }
5475 }
5476 impl Clone for CVec_CVec_u8ZZ {
5477         fn clone(&self) -> Self {
5478                 let mut res = Vec::new();
5479                 if self.datalen == 0 { return Self::from(res); }
5480                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5481                 Self::from(res)
5482         }
5483 }
5484 #[repr(C)]
5485 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5486 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5487         /// A pointer to the contents in the success state.
5488         /// Reading from this pointer when `result_ok` is not set is undefined.
5489         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5490         /// Note that this value is always NULL, as there are no contents in the Err variant
5491         pub err: *mut core::ffi::c_void,
5492 }
5493 #[repr(C)]
5494 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5495 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5496 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5497 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5498         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5499         /// `err` or `result` depending on the state of `result_ok`.
5500         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5501         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5502         pub result_ok: bool,
5503 }
5504 #[no_mangle]
5505 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5506 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5507         CResult_CVec_CVec_u8ZZNoneZ {
5508                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5509                         result: Box::into_raw(Box::new(o)),
5510                 },
5511                 result_ok: true,
5512         }
5513 }
5514 #[no_mangle]
5515 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5516 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5517         CResult_CVec_CVec_u8ZZNoneZ {
5518                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5519                         err: core::ptr::null_mut(),
5520                 },
5521                 result_ok: false,
5522         }
5523 }
5524 /// Checks if the given object is currently in the success state
5525 #[no_mangle]
5526 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5527         o.result_ok
5528 }
5529 #[no_mangle]
5530 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5531 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5532 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5533         fn drop(&mut self) {
5534                 if self.result_ok {
5535                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5536                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5537                         }
5538                 } else {
5539                 }
5540         }
5541 }
5542 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5543         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5544                 let contents = if o.result_ok {
5545                         let result = unsafe { o.contents.result };
5546                         unsafe { o.contents.result = core::ptr::null_mut() };
5547                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5548                 } else {
5549                         let _ = unsafe { Box::from_raw(o.contents.err) };
5550                         o.contents.err = core::ptr::null_mut();
5551                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5552                 };
5553                 Self {
5554                         contents,
5555                         result_ok: o.result_ok,
5556                 }
5557         }
5558 }
5559 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5560         fn clone(&self) -> Self {
5561                 if self.result_ok {
5562                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5563                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5564                         } }
5565                 } else {
5566                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5567                                 err: core::ptr::null_mut()
5568                         } }
5569                 }
5570         }
5571 }
5572 #[no_mangle]
5573 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5574 /// but with all dynamically-allocated buffers duplicated in new buffers.
5575 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5576 #[repr(C)]
5577 /// The contents of CResult_InMemorySignerDecodeErrorZ
5578 pub union CResult_InMemorySignerDecodeErrorZPtr {
5579         /// A pointer to the contents in the success state.
5580         /// Reading from this pointer when `result_ok` is not set is undefined.
5581         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5582         /// A pointer to the contents in the error state.
5583         /// Reading from this pointer when `result_ok` is set is undefined.
5584         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5585 }
5586 #[repr(C)]
5587 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5588 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5589 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5590 pub struct CResult_InMemorySignerDecodeErrorZ {
5591         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5592         /// `err` or `result` depending on the state of `result_ok`.
5593         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5594         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5595         pub result_ok: bool,
5596 }
5597 #[no_mangle]
5598 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5599 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5600         CResult_InMemorySignerDecodeErrorZ {
5601                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5602                         result: Box::into_raw(Box::new(o)),
5603                 },
5604                 result_ok: true,
5605         }
5606 }
5607 #[no_mangle]
5608 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5609 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5610         CResult_InMemorySignerDecodeErrorZ {
5611                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5612                         err: Box::into_raw(Box::new(e)),
5613                 },
5614                 result_ok: false,
5615         }
5616 }
5617 /// Checks if the given object is currently in the success state
5618 #[no_mangle]
5619 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5620         o.result_ok
5621 }
5622 #[no_mangle]
5623 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5624 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5625 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5626         fn drop(&mut self) {
5627                 if self.result_ok {
5628                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5629                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5630                         }
5631                 } else {
5632                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5633                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5634                         }
5635                 }
5636         }
5637 }
5638 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5639         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5640                 let contents = if o.result_ok {
5641                         let result = unsafe { o.contents.result };
5642                         unsafe { o.contents.result = core::ptr::null_mut() };
5643                         CResult_InMemorySignerDecodeErrorZPtr { result }
5644                 } else {
5645                         let err = unsafe { o.contents.err };
5646                         unsafe { o.contents.err = core::ptr::null_mut(); }
5647                         CResult_InMemorySignerDecodeErrorZPtr { err }
5648                 };
5649                 Self {
5650                         contents,
5651                         result_ok: o.result_ok,
5652                 }
5653         }
5654 }
5655 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5656         fn clone(&self) -> Self {
5657                 if self.result_ok {
5658                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5659                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5660                         } }
5661                 } else {
5662                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5663                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5664                         } }
5665                 }
5666         }
5667 }
5668 #[no_mangle]
5669 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5670 /// but with all dynamically-allocated buffers duplicated in new buffers.
5671 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5672 #[repr(C)]
5673 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5674 /// This corresponds to std::vector in C++
5675 pub struct CVec_TxOutZ {
5676         /// The elements in the array.
5677         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5678         pub data: *mut crate::c_types::TxOut,
5679         /// The number of elements pointed to by `data`.
5680         pub datalen: usize
5681 }
5682 impl CVec_TxOutZ {
5683         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5684                 if self.datalen == 0 { return Vec::new(); }
5685                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5686                 self.data = core::ptr::null_mut();
5687                 self.datalen = 0;
5688                 ret
5689         }
5690         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5691                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5692         }
5693 }
5694 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5695         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5696                 let datalen = v.len();
5697                 let data = Box::into_raw(v.into_boxed_slice());
5698                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5699         }
5700 }
5701 #[no_mangle]
5702 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5703 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5704 impl Drop for CVec_TxOutZ {
5705         fn drop(&mut self) {
5706                 if self.datalen == 0 { return; }
5707                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5708         }
5709 }
5710 impl Clone for CVec_TxOutZ {
5711         fn clone(&self) -> Self {
5712                 let mut res = Vec::new();
5713                 if self.datalen == 0 { return Self::from(res); }
5714                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5715                 Self::from(res)
5716         }
5717 }
5718 #[repr(C)]
5719 /// The contents of CResult_TransactionNoneZ
5720 pub union CResult_TransactionNoneZPtr {
5721         /// A pointer to the contents in the success state.
5722         /// Reading from this pointer when `result_ok` is not set is undefined.
5723         pub result: *mut crate::c_types::Transaction,
5724         /// Note that this value is always NULL, as there are no contents in the Err variant
5725         pub err: *mut core::ffi::c_void,
5726 }
5727 #[repr(C)]
5728 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5729 /// containing a crate::c_types::Transaction on success and a () on failure.
5730 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5731 pub struct CResult_TransactionNoneZ {
5732         /// The contents of this CResult_TransactionNoneZ, accessible via either
5733         /// `err` or `result` depending on the state of `result_ok`.
5734         pub contents: CResult_TransactionNoneZPtr,
5735         /// Whether this CResult_TransactionNoneZ represents a success state.
5736         pub result_ok: bool,
5737 }
5738 #[no_mangle]
5739 /// Creates a new CResult_TransactionNoneZ in the success state.
5740 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5741         CResult_TransactionNoneZ {
5742                 contents: CResult_TransactionNoneZPtr {
5743                         result: Box::into_raw(Box::new(o)),
5744                 },
5745                 result_ok: true,
5746         }
5747 }
5748 #[no_mangle]
5749 /// Creates a new CResult_TransactionNoneZ in the error state.
5750 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5751         CResult_TransactionNoneZ {
5752                 contents: CResult_TransactionNoneZPtr {
5753                         err: core::ptr::null_mut(),
5754                 },
5755                 result_ok: false,
5756         }
5757 }
5758 /// Checks if the given object is currently in the success state
5759 #[no_mangle]
5760 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5761         o.result_ok
5762 }
5763 #[no_mangle]
5764 /// Frees any resources used by the CResult_TransactionNoneZ.
5765 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5766 impl Drop for CResult_TransactionNoneZ {
5767         fn drop(&mut self) {
5768                 if self.result_ok {
5769                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5770                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5771                         }
5772                 } else {
5773                 }
5774         }
5775 }
5776 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5777         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5778                 let contents = if o.result_ok {
5779                         let result = unsafe { o.contents.result };
5780                         unsafe { o.contents.result = core::ptr::null_mut() };
5781                         CResult_TransactionNoneZPtr { result }
5782                 } else {
5783                         let _ = unsafe { Box::from_raw(o.contents.err) };
5784                         o.contents.err = core::ptr::null_mut();
5785                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5786                 };
5787                 Self {
5788                         contents,
5789                         result_ok: o.result_ok,
5790                 }
5791         }
5792 }
5793 impl Clone for CResult_TransactionNoneZ {
5794         fn clone(&self) -> Self {
5795                 if self.result_ok {
5796                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5797                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5798                         } }
5799                 } else {
5800                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5801                                 err: core::ptr::null_mut()
5802                         } }
5803                 }
5804         }
5805 }
5806 #[no_mangle]
5807 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5808 /// but with all dynamically-allocated buffers duplicated in new buffers.
5809 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5810 #[repr(C)]
5811 /// A tuple of 2 elements. See the individual fields for the types contained.
5812 pub struct C2Tuple_BlockHashChannelMonitorZ {
5813         /// The element at position 0
5814         pub a: crate::c_types::ThirtyTwoBytes,
5815         /// The element at position 1
5816         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5817 }
5818 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5819         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5820                 Self {
5821                         a: tup.0,
5822                         b: tup.1,
5823                 }
5824         }
5825 }
5826 impl C2Tuple_BlockHashChannelMonitorZ {
5827         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5828                 (self.a, self.b)
5829         }
5830 }
5831 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5832 #[no_mangle]
5833 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5834         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5835 }
5836
5837 #[no_mangle]
5838 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5839 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5840 #[repr(C)]
5841 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5842 /// This corresponds to std::vector in C++
5843 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5844         /// The elements in the array.
5845         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5846         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5847         /// The number of elements pointed to by `data`.
5848         pub datalen: usize
5849 }
5850 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5851         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5852                 if self.datalen == 0 { return Vec::new(); }
5853                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5854                 self.data = core::ptr::null_mut();
5855                 self.datalen = 0;
5856                 ret
5857         }
5858         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5859                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5860         }
5861 }
5862 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5863         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5864                 let datalen = v.len();
5865                 let data = Box::into_raw(v.into_boxed_slice());
5866                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5867         }
5868 }
5869 #[no_mangle]
5870 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5871 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5872 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5873         fn drop(&mut self) {
5874                 if self.datalen == 0 { return; }
5875                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5876         }
5877 }
5878 #[repr(C)]
5879 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5880 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5881         /// A pointer to the contents in the success state.
5882         /// Reading from this pointer when `result_ok` is not set is undefined.
5883         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5884         /// A pointer to the contents in the error state.
5885         /// Reading from this pointer when `result_ok` is set is undefined.
5886         pub err: *mut crate::c_types::IOError,
5887 }
5888 #[repr(C)]
5889 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5890 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5891 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5892 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5893         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5894         /// `err` or `result` depending on the state of `result_ok`.
5895         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5896         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5897         pub result_ok: bool,
5898 }
5899 #[no_mangle]
5900 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5901 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5902         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5903                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5904                         result: Box::into_raw(Box::new(o)),
5905                 },
5906                 result_ok: true,
5907         }
5908 }
5909 #[no_mangle]
5910 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5911 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5912         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5913                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5914                         err: Box::into_raw(Box::new(e)),
5915                 },
5916                 result_ok: false,
5917         }
5918 }
5919 /// Checks if the given object is currently in the success state
5920 #[no_mangle]
5921 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5922         o.result_ok
5923 }
5924 #[no_mangle]
5925 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5926 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5927 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5928         fn drop(&mut self) {
5929                 if self.result_ok {
5930                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5931                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5932                         }
5933                 } else {
5934                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5935                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5936                         }
5937                 }
5938         }
5939 }
5940 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5941         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5942                 let contents = if o.result_ok {
5943                         let result = unsafe { o.contents.result };
5944                         unsafe { o.contents.result = core::ptr::null_mut() };
5945                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5946                 } else {
5947                         let err = unsafe { o.contents.err };
5948                         unsafe { o.contents.err = core::ptr::null_mut(); }
5949                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5950                 };
5951                 Self {
5952                         contents,
5953                         result_ok: o.result_ok,
5954                 }
5955         }
5956 }
5957 #[repr(C)]
5958 #[derive(Clone)]
5959 /// An enum which can either contain a u16 or not
5960 pub enum COption_u16Z {
5961         /// When we're in this state, this COption_u16Z contains a u16
5962         Some(u16),
5963         /// When we're in this state, this COption_u16Z contains nothing
5964         None
5965 }
5966 impl COption_u16Z {
5967         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5968                 if let Self::None = self { false } else { true }
5969         }
5970         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5971                 !self.is_some()
5972         }
5973         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5974                 if let Self::Some(v) = self { v } else { unreachable!() }
5975         }
5976 }
5977 #[no_mangle]
5978 /// Constructs a new COption_u16Z containing a u16
5979 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5980         COption_u16Z::Some(o)
5981 }
5982 #[no_mangle]
5983 /// Constructs a new COption_u16Z containing nothing
5984 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5985         COption_u16Z::None
5986 }
5987 #[no_mangle]
5988 /// Frees any resources associated with the u16, if we are in the Some state
5989 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5990 #[no_mangle]
5991 /// Creates a new COption_u16Z which has the same data as `orig`
5992 /// but with all dynamically-allocated buffers duplicated in new buffers.
5993 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5994 #[repr(C)]
5995 /// The contents of CResult_NoneAPIErrorZ
5996 pub union CResult_NoneAPIErrorZPtr {
5997         /// Note that this value is always NULL, as there are no contents in the OK variant
5998         pub result: *mut core::ffi::c_void,
5999         /// A pointer to the contents in the error state.
6000         /// Reading from this pointer when `result_ok` is set is undefined.
6001         pub err: *mut crate::lightning::util::errors::APIError,
6002 }
6003 #[repr(C)]
6004 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6005 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
6006 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6007 pub struct CResult_NoneAPIErrorZ {
6008         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
6009         /// `err` or `result` depending on the state of `result_ok`.
6010         pub contents: CResult_NoneAPIErrorZPtr,
6011         /// Whether this CResult_NoneAPIErrorZ represents a success state.
6012         pub result_ok: bool,
6013 }
6014 #[no_mangle]
6015 /// Creates a new CResult_NoneAPIErrorZ in the success state.
6016 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
6017         CResult_NoneAPIErrorZ {
6018                 contents: CResult_NoneAPIErrorZPtr {
6019                         result: core::ptr::null_mut(),
6020                 },
6021                 result_ok: true,
6022         }
6023 }
6024 #[no_mangle]
6025 /// Creates a new CResult_NoneAPIErrorZ in the error state.
6026 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
6027         CResult_NoneAPIErrorZ {
6028                 contents: CResult_NoneAPIErrorZPtr {
6029                         err: Box::into_raw(Box::new(e)),
6030                 },
6031                 result_ok: false,
6032         }
6033 }
6034 /// Checks if the given object is currently in the success state
6035 #[no_mangle]
6036 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
6037         o.result_ok
6038 }
6039 #[no_mangle]
6040 /// Frees any resources used by the CResult_NoneAPIErrorZ.
6041 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
6042 impl Drop for CResult_NoneAPIErrorZ {
6043         fn drop(&mut self) {
6044                 if self.result_ok {
6045                 } else {
6046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6048                         }
6049                 }
6050         }
6051 }
6052 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6053         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6054                 let contents = if o.result_ok {
6055                         let _ = unsafe { Box::from_raw(o.contents.result) };
6056                         o.contents.result = core::ptr::null_mut();
6057                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6058                 } else {
6059                         let err = unsafe { o.contents.err };
6060                         unsafe { o.contents.err = core::ptr::null_mut(); }
6061                         CResult_NoneAPIErrorZPtr { err }
6062                 };
6063                 Self {
6064                         contents,
6065                         result_ok: o.result_ok,
6066                 }
6067         }
6068 }
6069 impl Clone for CResult_NoneAPIErrorZ {
6070         fn clone(&self) -> Self {
6071                 if self.result_ok {
6072                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6073                                 result: core::ptr::null_mut()
6074                         } }
6075                 } else {
6076                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6077                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6078                         } }
6079                 }
6080         }
6081 }
6082 #[no_mangle]
6083 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6084 /// but with all dynamically-allocated buffers duplicated in new buffers.
6085 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6086 #[repr(C)]
6087 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6088 /// This corresponds to std::vector in C++
6089 pub struct CVec_CResult_NoneAPIErrorZZ {
6090         /// The elements in the array.
6091         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6092         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6093         /// The number of elements pointed to by `data`.
6094         pub datalen: usize
6095 }
6096 impl CVec_CResult_NoneAPIErrorZZ {
6097         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6098                 if self.datalen == 0 { return Vec::new(); }
6099                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6100                 self.data = core::ptr::null_mut();
6101                 self.datalen = 0;
6102                 ret
6103         }
6104         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6105                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6106         }
6107 }
6108 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6109         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6110                 let datalen = v.len();
6111                 let data = Box::into_raw(v.into_boxed_slice());
6112                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6113         }
6114 }
6115 #[no_mangle]
6116 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6117 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6118 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6119         fn drop(&mut self) {
6120                 if self.datalen == 0 { return; }
6121                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6122         }
6123 }
6124 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6125         fn clone(&self) -> Self {
6126                 let mut res = Vec::new();
6127                 if self.datalen == 0 { return Self::from(res); }
6128                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6129                 Self::from(res)
6130         }
6131 }
6132 #[repr(C)]
6133 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6134 /// This corresponds to std::vector in C++
6135 pub struct CVec_APIErrorZ {
6136         /// The elements in the array.
6137         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6138         pub data: *mut crate::lightning::util::errors::APIError,
6139         /// The number of elements pointed to by `data`.
6140         pub datalen: usize
6141 }
6142 impl CVec_APIErrorZ {
6143         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6144                 if self.datalen == 0 { return Vec::new(); }
6145                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6146                 self.data = core::ptr::null_mut();
6147                 self.datalen = 0;
6148                 ret
6149         }
6150         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6151                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6152         }
6153 }
6154 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6155         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6156                 let datalen = v.len();
6157                 let data = Box::into_raw(v.into_boxed_slice());
6158                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6159         }
6160 }
6161 #[no_mangle]
6162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6163 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6164 impl Drop for CVec_APIErrorZ {
6165         fn drop(&mut self) {
6166                 if self.datalen == 0 { return; }
6167                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6168         }
6169 }
6170 impl Clone for CVec_APIErrorZ {
6171         fn clone(&self) -> Self {
6172                 let mut res = Vec::new();
6173                 if self.datalen == 0 { return Self::from(res); }
6174                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6175                 Self::from(res)
6176         }
6177 }
6178 #[repr(C)]
6179 /// The contents of CResult__u832APIErrorZ
6180 pub union CResult__u832APIErrorZPtr {
6181         /// A pointer to the contents in the success state.
6182         /// Reading from this pointer when `result_ok` is not set is undefined.
6183         pub result: *mut crate::c_types::ThirtyTwoBytes,
6184         /// A pointer to the contents in the error state.
6185         /// Reading from this pointer when `result_ok` is set is undefined.
6186         pub err: *mut crate::lightning::util::errors::APIError,
6187 }
6188 #[repr(C)]
6189 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6190 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6191 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6192 pub struct CResult__u832APIErrorZ {
6193         /// The contents of this CResult__u832APIErrorZ, accessible via either
6194         /// `err` or `result` depending on the state of `result_ok`.
6195         pub contents: CResult__u832APIErrorZPtr,
6196         /// Whether this CResult__u832APIErrorZ represents a success state.
6197         pub result_ok: bool,
6198 }
6199 #[no_mangle]
6200 /// Creates a new CResult__u832APIErrorZ in the success state.
6201 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6202         CResult__u832APIErrorZ {
6203                 contents: CResult__u832APIErrorZPtr {
6204                         result: Box::into_raw(Box::new(o)),
6205                 },
6206                 result_ok: true,
6207         }
6208 }
6209 #[no_mangle]
6210 /// Creates a new CResult__u832APIErrorZ in the error state.
6211 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6212         CResult__u832APIErrorZ {
6213                 contents: CResult__u832APIErrorZPtr {
6214                         err: Box::into_raw(Box::new(e)),
6215                 },
6216                 result_ok: false,
6217         }
6218 }
6219 /// Checks if the given object is currently in the success state
6220 #[no_mangle]
6221 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6222         o.result_ok
6223 }
6224 #[no_mangle]
6225 /// Frees any resources used by the CResult__u832APIErrorZ.
6226 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6227 impl Drop for CResult__u832APIErrorZ {
6228         fn drop(&mut self) {
6229                 if self.result_ok {
6230                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6231                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6232                         }
6233                 } else {
6234                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6235                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6236                         }
6237                 }
6238         }
6239 }
6240 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6241         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6242                 let contents = if o.result_ok {
6243                         let result = unsafe { o.contents.result };
6244                         unsafe { o.contents.result = core::ptr::null_mut() };
6245                         CResult__u832APIErrorZPtr { result }
6246                 } else {
6247                         let err = unsafe { o.contents.err };
6248                         unsafe { o.contents.err = core::ptr::null_mut(); }
6249                         CResult__u832APIErrorZPtr { err }
6250                 };
6251                 Self {
6252                         contents,
6253                         result_ok: o.result_ok,
6254                 }
6255         }
6256 }
6257 impl Clone for CResult__u832APIErrorZ {
6258         fn clone(&self) -> Self {
6259                 if self.result_ok {
6260                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6261                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6262                         } }
6263                 } else {
6264                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6265                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6266                         } }
6267                 }
6268         }
6269 }
6270 #[no_mangle]
6271 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6272 /// but with all dynamically-allocated buffers duplicated in new buffers.
6273 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6274 #[repr(C)]
6275 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6276 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6277         /// A pointer to the contents in the success state.
6278         /// Reading from this pointer when `result_ok` is not set is undefined.
6279         pub result: *mut crate::c_types::ThirtyTwoBytes,
6280         /// A pointer to the contents in the error state.
6281         /// Reading from this pointer when `result_ok` is set is undefined.
6282         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6283 }
6284 #[repr(C)]
6285 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6286 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6287 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6288 pub struct CResult_PaymentIdPaymentSendFailureZ {
6289         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6290         /// `err` or `result` depending on the state of `result_ok`.
6291         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6292         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6293         pub result_ok: bool,
6294 }
6295 #[no_mangle]
6296 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6297 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6298         CResult_PaymentIdPaymentSendFailureZ {
6299                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6300                         result: Box::into_raw(Box::new(o)),
6301                 },
6302                 result_ok: true,
6303         }
6304 }
6305 #[no_mangle]
6306 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6307 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6308         CResult_PaymentIdPaymentSendFailureZ {
6309                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310                         err: Box::into_raw(Box::new(e)),
6311                 },
6312                 result_ok: false,
6313         }
6314 }
6315 /// Checks if the given object is currently in the success state
6316 #[no_mangle]
6317 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6318         o.result_ok
6319 }
6320 #[no_mangle]
6321 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6322 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6323 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6324         fn drop(&mut self) {
6325                 if self.result_ok {
6326                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6327                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6328                         }
6329                 } else {
6330                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6331                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6332                         }
6333                 }
6334         }
6335 }
6336 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6337         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6338                 let contents = if o.result_ok {
6339                         let result = unsafe { o.contents.result };
6340                         unsafe { o.contents.result = core::ptr::null_mut() };
6341                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6342                 } else {
6343                         let err = unsafe { o.contents.err };
6344                         unsafe { o.contents.err = core::ptr::null_mut(); }
6345                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6346                 };
6347                 Self {
6348                         contents,
6349                         result_ok: o.result_ok,
6350                 }
6351         }
6352 }
6353 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6354         fn clone(&self) -> Self {
6355                 if self.result_ok {
6356                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6357                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6358                         } }
6359                 } else {
6360                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6361                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6362                         } }
6363                 }
6364         }
6365 }
6366 #[no_mangle]
6367 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6368 /// but with all dynamically-allocated buffers duplicated in new buffers.
6369 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6370 #[repr(C)]
6371 /// The contents of CResult_NonePaymentSendFailureZ
6372 pub union CResult_NonePaymentSendFailureZPtr {
6373         /// Note that this value is always NULL, as there are no contents in the OK variant
6374         pub result: *mut core::ffi::c_void,
6375         /// A pointer to the contents in the error state.
6376         /// Reading from this pointer when `result_ok` is set is undefined.
6377         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6378 }
6379 #[repr(C)]
6380 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6381 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383 pub struct CResult_NonePaymentSendFailureZ {
6384         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6385         /// `err` or `result` depending on the state of `result_ok`.
6386         pub contents: CResult_NonePaymentSendFailureZPtr,
6387         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6388         pub result_ok: bool,
6389 }
6390 #[no_mangle]
6391 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6392 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6393         CResult_NonePaymentSendFailureZ {
6394                 contents: CResult_NonePaymentSendFailureZPtr {
6395                         result: core::ptr::null_mut(),
6396                 },
6397                 result_ok: true,
6398         }
6399 }
6400 #[no_mangle]
6401 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6402 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6403         CResult_NonePaymentSendFailureZ {
6404                 contents: CResult_NonePaymentSendFailureZPtr {
6405                         err: Box::into_raw(Box::new(e)),
6406                 },
6407                 result_ok: false,
6408         }
6409 }
6410 /// Checks if the given object is currently in the success state
6411 #[no_mangle]
6412 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6413         o.result_ok
6414 }
6415 #[no_mangle]
6416 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6417 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6418 impl Drop for CResult_NonePaymentSendFailureZ {
6419         fn drop(&mut self) {
6420                 if self.result_ok {
6421                 } else {
6422                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6423                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6424                         }
6425                 }
6426         }
6427 }
6428 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6429         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6430                 let contents = if o.result_ok {
6431                         let _ = unsafe { Box::from_raw(o.contents.result) };
6432                         o.contents.result = core::ptr::null_mut();
6433                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6434                 } else {
6435                         let err = unsafe { o.contents.err };
6436                         unsafe { o.contents.err = core::ptr::null_mut(); }
6437                         CResult_NonePaymentSendFailureZPtr { err }
6438                 };
6439                 Self {
6440                         contents,
6441                         result_ok: o.result_ok,
6442                 }
6443         }
6444 }
6445 impl Clone for CResult_NonePaymentSendFailureZ {
6446         fn clone(&self) -> Self {
6447                 if self.result_ok {
6448                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6449                                 result: core::ptr::null_mut()
6450                         } }
6451                 } else {
6452                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6453                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6454                         } }
6455                 }
6456         }
6457 }
6458 #[no_mangle]
6459 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6460 /// but with all dynamically-allocated buffers duplicated in new buffers.
6461 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6462 #[repr(C)]
6463 /// A tuple of 2 elements. See the individual fields for the types contained.
6464 pub struct C2Tuple_PaymentHashPaymentIdZ {
6465         /// The element at position 0
6466         pub a: crate::c_types::ThirtyTwoBytes,
6467         /// The element at position 1
6468         pub b: crate::c_types::ThirtyTwoBytes,
6469 }
6470 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6471         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6472                 Self {
6473                         a: tup.0,
6474                         b: tup.1,
6475                 }
6476         }
6477 }
6478 impl C2Tuple_PaymentHashPaymentIdZ {
6479         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6480                 (self.a, self.b)
6481         }
6482 }
6483 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6484         fn clone(&self) -> Self {
6485                 Self {
6486                         a: Clone::clone(&self.a),
6487                         b: Clone::clone(&self.b),
6488                 }
6489         }
6490 }
6491 #[no_mangle]
6492 /// Creates a new tuple which has the same data as `orig`
6493 /// but with all dynamically-allocated buffers duplicated in new buffers.
6494 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6495 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6496 #[no_mangle]
6497 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6498         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6499 }
6500
6501 #[no_mangle]
6502 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6503 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6504 #[repr(C)]
6505 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6506 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6507         /// A pointer to the contents in the success state.
6508         /// Reading from this pointer when `result_ok` is not set is undefined.
6509         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6510         /// A pointer to the contents in the error state.
6511         /// Reading from this pointer when `result_ok` is set is undefined.
6512         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6513 }
6514 #[repr(C)]
6515 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6516 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6517 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6518 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6519         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6520         /// `err` or `result` depending on the state of `result_ok`.
6521         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6522         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6523         pub result_ok: bool,
6524 }
6525 #[no_mangle]
6526 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6527 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6528         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6529                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6530                         result: Box::into_raw(Box::new(o)),
6531                 },
6532                 result_ok: true,
6533         }
6534 }
6535 #[no_mangle]
6536 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6537 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6538         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6539                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540                         err: Box::into_raw(Box::new(e)),
6541                 },
6542                 result_ok: false,
6543         }
6544 }
6545 /// Checks if the given object is currently in the success state
6546 #[no_mangle]
6547 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6548         o.result_ok
6549 }
6550 #[no_mangle]
6551 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6552 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6553 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6554         fn drop(&mut self) {
6555                 if self.result_ok {
6556                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6557                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6558                         }
6559                 } else {
6560                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6561                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6562                         }
6563                 }
6564         }
6565 }
6566 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6567         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6568                 let contents = if o.result_ok {
6569                         let result = unsafe { o.contents.result };
6570                         unsafe { o.contents.result = core::ptr::null_mut() };
6571                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6572                 } else {
6573                         let err = unsafe { o.contents.err };
6574                         unsafe { o.contents.err = core::ptr::null_mut(); }
6575                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6576                 };
6577                 Self {
6578                         contents,
6579                         result_ok: o.result_ok,
6580                 }
6581         }
6582 }
6583 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6584         fn clone(&self) -> Self {
6585                 if self.result_ok {
6586                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6587                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6588                         } }
6589                 } else {
6590                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6591                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6592                         } }
6593                 }
6594         }
6595 }
6596 #[no_mangle]
6597 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6598 /// but with all dynamically-allocated buffers duplicated in new buffers.
6599 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6600 #[repr(C)]
6601 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6602 /// This corresponds to std::vector in C++
6603 pub struct CVec_NetAddressZ {
6604         /// The elements in the array.
6605         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6606         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6607         /// The number of elements pointed to by `data`.
6608         pub datalen: usize
6609 }
6610 impl CVec_NetAddressZ {
6611         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6612                 if self.datalen == 0 { return Vec::new(); }
6613                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6614                 self.data = core::ptr::null_mut();
6615                 self.datalen = 0;
6616                 ret
6617         }
6618         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6619                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6620         }
6621 }
6622 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6623         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6624                 let datalen = v.len();
6625                 let data = Box::into_raw(v.into_boxed_slice());
6626                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6627         }
6628 }
6629 #[no_mangle]
6630 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6631 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6632 impl Drop for CVec_NetAddressZ {
6633         fn drop(&mut self) {
6634                 if self.datalen == 0 { return; }
6635                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6636         }
6637 }
6638 impl Clone for CVec_NetAddressZ {
6639         fn clone(&self) -> Self {
6640                 let mut res = Vec::new();
6641                 if self.datalen == 0 { return Self::from(res); }
6642                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6643                 Self::from(res)
6644         }
6645 }
6646 #[repr(C)]
6647 /// A tuple of 2 elements. See the individual fields for the types contained.
6648 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6649         /// The element at position 0
6650         pub a: crate::c_types::ThirtyTwoBytes,
6651         /// The element at position 1
6652         pub b: crate::c_types::ThirtyTwoBytes,
6653 }
6654 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6655         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6656                 Self {
6657                         a: tup.0,
6658                         b: tup.1,
6659                 }
6660         }
6661 }
6662 impl C2Tuple_PaymentHashPaymentSecretZ {
6663         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6664                 (self.a, self.b)
6665         }
6666 }
6667 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6668         fn clone(&self) -> Self {
6669                 Self {
6670                         a: Clone::clone(&self.a),
6671                         b: Clone::clone(&self.b),
6672                 }
6673         }
6674 }
6675 #[no_mangle]
6676 /// Creates a new tuple which has the same data as `orig`
6677 /// but with all dynamically-allocated buffers duplicated in new buffers.
6678 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6679 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6680 #[no_mangle]
6681 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6682         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6683 }
6684
6685 #[no_mangle]
6686 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6687 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6688 #[repr(C)]
6689 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6690 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6691         /// A pointer to the contents in the success state.
6692         /// Reading from this pointer when `result_ok` is not set is undefined.
6693         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6694         /// Note that this value is always NULL, as there are no contents in the Err variant
6695         pub err: *mut core::ffi::c_void,
6696 }
6697 #[repr(C)]
6698 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6699 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6700 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6701 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6702         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6703         /// `err` or `result` depending on the state of `result_ok`.
6704         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6705         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6706         pub result_ok: bool,
6707 }
6708 #[no_mangle]
6709 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6710 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6711         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6712                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6713                         result: Box::into_raw(Box::new(o)),
6714                 },
6715                 result_ok: true,
6716         }
6717 }
6718 #[no_mangle]
6719 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6720 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6721         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6722                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6723                         err: core::ptr::null_mut(),
6724                 },
6725                 result_ok: false,
6726         }
6727 }
6728 /// Checks if the given object is currently in the success state
6729 #[no_mangle]
6730 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6731         o.result_ok
6732 }
6733 #[no_mangle]
6734 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6735 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6736 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6737         fn drop(&mut self) {
6738                 if self.result_ok {
6739                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6740                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6741                         }
6742                 } else {
6743                 }
6744         }
6745 }
6746 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6747         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6748                 let contents = if o.result_ok {
6749                         let result = unsafe { o.contents.result };
6750                         unsafe { o.contents.result = core::ptr::null_mut() };
6751                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6752                 } else {
6753                         let _ = unsafe { Box::from_raw(o.contents.err) };
6754                         o.contents.err = core::ptr::null_mut();
6755                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6756                 };
6757                 Self {
6758                         contents,
6759                         result_ok: o.result_ok,
6760                 }
6761         }
6762 }
6763 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6764         fn clone(&self) -> Self {
6765                 if self.result_ok {
6766                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6767                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6768                         } }
6769                 } else {
6770                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6771                                 err: core::ptr::null_mut()
6772                         } }
6773                 }
6774         }
6775 }
6776 #[no_mangle]
6777 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6778 /// but with all dynamically-allocated buffers duplicated in new buffers.
6779 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6780 #[repr(C)]
6781 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6782 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6783         /// A pointer to the contents in the success state.
6784         /// Reading from this pointer when `result_ok` is not set is undefined.
6785         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6786         /// A pointer to the contents in the error state.
6787         /// Reading from this pointer when `result_ok` is set is undefined.
6788         pub err: *mut crate::lightning::util::errors::APIError,
6789 }
6790 #[repr(C)]
6791 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6792 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6793 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6794 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6795         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6796         /// `err` or `result` depending on the state of `result_ok`.
6797         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6798         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6799         pub result_ok: bool,
6800 }
6801 #[no_mangle]
6802 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6803 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6804         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6805                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6806                         result: Box::into_raw(Box::new(o)),
6807                 },
6808                 result_ok: true,
6809         }
6810 }
6811 #[no_mangle]
6812 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6813 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6814         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6815                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6816                         err: Box::into_raw(Box::new(e)),
6817                 },
6818                 result_ok: false,
6819         }
6820 }
6821 /// Checks if the given object is currently in the success state
6822 #[no_mangle]
6823 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6824         o.result_ok
6825 }
6826 #[no_mangle]
6827 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6828 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6829 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6830         fn drop(&mut self) {
6831                 if self.result_ok {
6832                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6833                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6834                         }
6835                 } else {
6836                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6837                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6838                         }
6839                 }
6840         }
6841 }
6842 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6843         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6844                 let contents = if o.result_ok {
6845                         let result = unsafe { o.contents.result };
6846                         unsafe { o.contents.result = core::ptr::null_mut() };
6847                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6848                 } else {
6849                         let err = unsafe { o.contents.err };
6850                         unsafe { o.contents.err = core::ptr::null_mut(); }
6851                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6852                 };
6853                 Self {
6854                         contents,
6855                         result_ok: o.result_ok,
6856                 }
6857         }
6858 }
6859 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6860         fn clone(&self) -> Self {
6861                 if self.result_ok {
6862                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6863                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6864                         } }
6865                 } else {
6866                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6867                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6868                         } }
6869                 }
6870         }
6871 }
6872 #[no_mangle]
6873 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6874 /// but with all dynamically-allocated buffers duplicated in new buffers.
6875 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6876 #[repr(C)]
6877 /// The contents of CResult_PaymentSecretNoneZ
6878 pub union CResult_PaymentSecretNoneZPtr {
6879         /// A pointer to the contents in the success state.
6880         /// Reading from this pointer when `result_ok` is not set is undefined.
6881         pub result: *mut crate::c_types::ThirtyTwoBytes,
6882         /// Note that this value is always NULL, as there are no contents in the Err variant
6883         pub err: *mut core::ffi::c_void,
6884 }
6885 #[repr(C)]
6886 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6887 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6888 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6889 pub struct CResult_PaymentSecretNoneZ {
6890         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6891         /// `err` or `result` depending on the state of `result_ok`.
6892         pub contents: CResult_PaymentSecretNoneZPtr,
6893         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6894         pub result_ok: bool,
6895 }
6896 #[no_mangle]
6897 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6898 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6899         CResult_PaymentSecretNoneZ {
6900                 contents: CResult_PaymentSecretNoneZPtr {
6901                         result: Box::into_raw(Box::new(o)),
6902                 },
6903                 result_ok: true,
6904         }
6905 }
6906 #[no_mangle]
6907 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6908 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6909         CResult_PaymentSecretNoneZ {
6910                 contents: CResult_PaymentSecretNoneZPtr {
6911                         err: core::ptr::null_mut(),
6912                 },
6913                 result_ok: false,
6914         }
6915 }
6916 /// Checks if the given object is currently in the success state
6917 #[no_mangle]
6918 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6919         o.result_ok
6920 }
6921 #[no_mangle]
6922 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6923 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6924 impl Drop for CResult_PaymentSecretNoneZ {
6925         fn drop(&mut self) {
6926                 if self.result_ok {
6927                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6928                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6929                         }
6930                 } else {
6931                 }
6932         }
6933 }
6934 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6935         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6936                 let contents = if o.result_ok {
6937                         let result = unsafe { o.contents.result };
6938                         unsafe { o.contents.result = core::ptr::null_mut() };
6939                         CResult_PaymentSecretNoneZPtr { result }
6940                 } else {
6941                         let _ = unsafe { Box::from_raw(o.contents.err) };
6942                         o.contents.err = core::ptr::null_mut();
6943                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6944                 };
6945                 Self {
6946                         contents,
6947                         result_ok: o.result_ok,
6948                 }
6949         }
6950 }
6951 impl Clone for CResult_PaymentSecretNoneZ {
6952         fn clone(&self) -> Self {
6953                 if self.result_ok {
6954                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6955                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6956                         } }
6957                 } else {
6958                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6959                                 err: core::ptr::null_mut()
6960                         } }
6961                 }
6962         }
6963 }
6964 #[no_mangle]
6965 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6966 /// but with all dynamically-allocated buffers duplicated in new buffers.
6967 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6968 #[repr(C)]
6969 /// The contents of CResult_PaymentSecretAPIErrorZ
6970 pub union CResult_PaymentSecretAPIErrorZPtr {
6971         /// A pointer to the contents in the success state.
6972         /// Reading from this pointer when `result_ok` is not set is undefined.
6973         pub result: *mut crate::c_types::ThirtyTwoBytes,
6974         /// A pointer to the contents in the error state.
6975         /// Reading from this pointer when `result_ok` is set is undefined.
6976         pub err: *mut crate::lightning::util::errors::APIError,
6977 }
6978 #[repr(C)]
6979 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6980 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6981 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6982 pub struct CResult_PaymentSecretAPIErrorZ {
6983         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6984         /// `err` or `result` depending on the state of `result_ok`.
6985         pub contents: CResult_PaymentSecretAPIErrorZPtr,
6986         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6987         pub result_ok: bool,
6988 }
6989 #[no_mangle]
6990 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6991 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6992         CResult_PaymentSecretAPIErrorZ {
6993                 contents: CResult_PaymentSecretAPIErrorZPtr {
6994                         result: Box::into_raw(Box::new(o)),
6995                 },
6996                 result_ok: true,
6997         }
6998 }
6999 #[no_mangle]
7000 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
7001 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
7002         CResult_PaymentSecretAPIErrorZ {
7003                 contents: CResult_PaymentSecretAPIErrorZPtr {
7004                         err: Box::into_raw(Box::new(e)),
7005                 },
7006                 result_ok: false,
7007         }
7008 }
7009 /// Checks if the given object is currently in the success state
7010 #[no_mangle]
7011 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
7012         o.result_ok
7013 }
7014 #[no_mangle]
7015 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
7016 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
7017 impl Drop for CResult_PaymentSecretAPIErrorZ {
7018         fn drop(&mut self) {
7019                 if self.result_ok {
7020                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7021                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7022                         }
7023                 } else {
7024                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7025                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7026                         }
7027                 }
7028         }
7029 }
7030 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
7031         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7032                 let contents = if o.result_ok {
7033                         let result = unsafe { o.contents.result };
7034                         unsafe { o.contents.result = core::ptr::null_mut() };
7035                         CResult_PaymentSecretAPIErrorZPtr { result }
7036                 } else {
7037                         let err = unsafe { o.contents.err };
7038                         unsafe { o.contents.err = core::ptr::null_mut(); }
7039                         CResult_PaymentSecretAPIErrorZPtr { err }
7040                 };
7041                 Self {
7042                         contents,
7043                         result_ok: o.result_ok,
7044                 }
7045         }
7046 }
7047 impl Clone for CResult_PaymentSecretAPIErrorZ {
7048         fn clone(&self) -> Self {
7049                 if self.result_ok {
7050                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7051                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7052                         } }
7053                 } else {
7054                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7055                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7056                         } }
7057                 }
7058         }
7059 }
7060 #[no_mangle]
7061 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7062 /// but with all dynamically-allocated buffers duplicated in new buffers.
7063 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7064 #[repr(C)]
7065 /// The contents of CResult_PaymentPreimageAPIErrorZ
7066 pub union CResult_PaymentPreimageAPIErrorZPtr {
7067         /// A pointer to the contents in the success state.
7068         /// Reading from this pointer when `result_ok` is not set is undefined.
7069         pub result: *mut crate::c_types::ThirtyTwoBytes,
7070         /// A pointer to the contents in the error state.
7071         /// Reading from this pointer when `result_ok` is set is undefined.
7072         pub err: *mut crate::lightning::util::errors::APIError,
7073 }
7074 #[repr(C)]
7075 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7076 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7077 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7078 pub struct CResult_PaymentPreimageAPIErrorZ {
7079         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7080         /// `err` or `result` depending on the state of `result_ok`.
7081         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7082         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7083         pub result_ok: bool,
7084 }
7085 #[no_mangle]
7086 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7087 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7088         CResult_PaymentPreimageAPIErrorZ {
7089                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7090                         result: Box::into_raw(Box::new(o)),
7091                 },
7092                 result_ok: true,
7093         }
7094 }
7095 #[no_mangle]
7096 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7097 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7098         CResult_PaymentPreimageAPIErrorZ {
7099                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7100                         err: Box::into_raw(Box::new(e)),
7101                 },
7102                 result_ok: false,
7103         }
7104 }
7105 /// Checks if the given object is currently in the success state
7106 #[no_mangle]
7107 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7108         o.result_ok
7109 }
7110 #[no_mangle]
7111 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7112 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7113 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7114         fn drop(&mut self) {
7115                 if self.result_ok {
7116                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7117                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7118                         }
7119                 } else {
7120                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7121                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7122                         }
7123                 }
7124         }
7125 }
7126 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7127         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7128                 let contents = if o.result_ok {
7129                         let result = unsafe { o.contents.result };
7130                         unsafe { o.contents.result = core::ptr::null_mut() };
7131                         CResult_PaymentPreimageAPIErrorZPtr { result }
7132                 } else {
7133                         let err = unsafe { o.contents.err };
7134                         unsafe { o.contents.err = core::ptr::null_mut(); }
7135                         CResult_PaymentPreimageAPIErrorZPtr { err }
7136                 };
7137                 Self {
7138                         contents,
7139                         result_ok: o.result_ok,
7140                 }
7141         }
7142 }
7143 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7144         fn clone(&self) -> Self {
7145                 if self.result_ok {
7146                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7147                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7148                         } }
7149                 } else {
7150                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7151                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7152                         } }
7153                 }
7154         }
7155 }
7156 #[no_mangle]
7157 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7158 /// but with all dynamically-allocated buffers duplicated in new buffers.
7159 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7160 #[repr(C)]
7161 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7162 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7163         /// A pointer to the contents in the success state.
7164         /// Reading from this pointer when `result_ok` is not set is undefined.
7165         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7166         /// A pointer to the contents in the error state.
7167         /// Reading from this pointer when `result_ok` is set is undefined.
7168         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7169 }
7170 #[repr(C)]
7171 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7172 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7173 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7174 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7175         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7176         /// `err` or `result` depending on the state of `result_ok`.
7177         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7178         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7179         pub result_ok: bool,
7180 }
7181 #[no_mangle]
7182 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7183 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7184         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7185                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7186                         result: Box::into_raw(Box::new(o)),
7187                 },
7188                 result_ok: true,
7189         }
7190 }
7191 #[no_mangle]
7192 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7193 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7194         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7195                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196                         err: Box::into_raw(Box::new(e)),
7197                 },
7198                 result_ok: false,
7199         }
7200 }
7201 /// Checks if the given object is currently in the success state
7202 #[no_mangle]
7203 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7204         o.result_ok
7205 }
7206 #[no_mangle]
7207 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7208 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7209 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7210         fn drop(&mut self) {
7211                 if self.result_ok {
7212                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7213                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7214                         }
7215                 } else {
7216                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7217                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7218                         }
7219                 }
7220         }
7221 }
7222 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7223         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7224                 let contents = if o.result_ok {
7225                         let result = unsafe { o.contents.result };
7226                         unsafe { o.contents.result = core::ptr::null_mut() };
7227                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7228                 } else {
7229                         let err = unsafe { o.contents.err };
7230                         unsafe { o.contents.err = core::ptr::null_mut(); }
7231                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7232                 };
7233                 Self {
7234                         contents,
7235                         result_ok: o.result_ok,
7236                 }
7237         }
7238 }
7239 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7240         fn clone(&self) -> Self {
7241                 if self.result_ok {
7242                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7243                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7244                         } }
7245                 } else {
7246                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7247                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7248                         } }
7249                 }
7250         }
7251 }
7252 #[no_mangle]
7253 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7254 /// but with all dynamically-allocated buffers duplicated in new buffers.
7255 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7256 #[repr(C)]
7257 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7258 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7259         /// A pointer to the contents in the success state.
7260         /// Reading from this pointer when `result_ok` is not set is undefined.
7261         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7262         /// A pointer to the contents in the error state.
7263         /// Reading from this pointer when `result_ok` is set is undefined.
7264         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7265 }
7266 #[repr(C)]
7267 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7268 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7269 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7270 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7271         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7272         /// `err` or `result` depending on the state of `result_ok`.
7273         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7274         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7275         pub result_ok: bool,
7276 }
7277 #[no_mangle]
7278 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7279 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7280         CResult_ChannelCounterpartyDecodeErrorZ {
7281                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7282                         result: Box::into_raw(Box::new(o)),
7283                 },
7284                 result_ok: true,
7285         }
7286 }
7287 #[no_mangle]
7288 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7289 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7290         CResult_ChannelCounterpartyDecodeErrorZ {
7291                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292                         err: Box::into_raw(Box::new(e)),
7293                 },
7294                 result_ok: false,
7295         }
7296 }
7297 /// Checks if the given object is currently in the success state
7298 #[no_mangle]
7299 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7300         o.result_ok
7301 }
7302 #[no_mangle]
7303 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7304 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7305 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7306         fn drop(&mut self) {
7307                 if self.result_ok {
7308                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7309                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7310                         }
7311                 } else {
7312                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7313                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7314                         }
7315                 }
7316         }
7317 }
7318 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7319         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7320                 let contents = if o.result_ok {
7321                         let result = unsafe { o.contents.result };
7322                         unsafe { o.contents.result = core::ptr::null_mut() };
7323                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7324                 } else {
7325                         let err = unsafe { o.contents.err };
7326                         unsafe { o.contents.err = core::ptr::null_mut(); }
7327                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7328                 };
7329                 Self {
7330                         contents,
7331                         result_ok: o.result_ok,
7332                 }
7333         }
7334 }
7335 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7336         fn clone(&self) -> Self {
7337                 if self.result_ok {
7338                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7339                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7340                         } }
7341                 } else {
7342                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7343                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7344                         } }
7345                 }
7346         }
7347 }
7348 #[no_mangle]
7349 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7350 /// but with all dynamically-allocated buffers duplicated in new buffers.
7351 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7352 #[repr(C)]
7353 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7354 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7355         /// A pointer to the contents in the success state.
7356         /// Reading from this pointer when `result_ok` is not set is undefined.
7357         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7358         /// A pointer to the contents in the error state.
7359         /// Reading from this pointer when `result_ok` is set is undefined.
7360         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7361 }
7362 #[repr(C)]
7363 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7364 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7365 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7366 pub struct CResult_ChannelDetailsDecodeErrorZ {
7367         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7368         /// `err` or `result` depending on the state of `result_ok`.
7369         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7370         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7371         pub result_ok: bool,
7372 }
7373 #[no_mangle]
7374 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7375 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7376         CResult_ChannelDetailsDecodeErrorZ {
7377                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7378                         result: Box::into_raw(Box::new(o)),
7379                 },
7380                 result_ok: true,
7381         }
7382 }
7383 #[no_mangle]
7384 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7385 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7386         CResult_ChannelDetailsDecodeErrorZ {
7387                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388                         err: Box::into_raw(Box::new(e)),
7389                 },
7390                 result_ok: false,
7391         }
7392 }
7393 /// Checks if the given object is currently in the success state
7394 #[no_mangle]
7395 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7396         o.result_ok
7397 }
7398 #[no_mangle]
7399 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7400 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7401 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7402         fn drop(&mut self) {
7403                 if self.result_ok {
7404                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7405                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7406                         }
7407                 } else {
7408                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7409                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7410                         }
7411                 }
7412         }
7413 }
7414 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7415         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7416                 let contents = if o.result_ok {
7417                         let result = unsafe { o.contents.result };
7418                         unsafe { o.contents.result = core::ptr::null_mut() };
7419                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7420                 } else {
7421                         let err = unsafe { o.contents.err };
7422                         unsafe { o.contents.err = core::ptr::null_mut(); }
7423                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7424                 };
7425                 Self {
7426                         contents,
7427                         result_ok: o.result_ok,
7428                 }
7429         }
7430 }
7431 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7432         fn clone(&self) -> Self {
7433                 if self.result_ok {
7434                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7435                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7436                         } }
7437                 } else {
7438                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7439                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7440                         } }
7441                 }
7442         }
7443 }
7444 #[no_mangle]
7445 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7446 /// but with all dynamically-allocated buffers duplicated in new buffers.
7447 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7448 #[repr(C)]
7449 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7450 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7451         /// A pointer to the contents in the success state.
7452         /// Reading from this pointer when `result_ok` is not set is undefined.
7453         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7454         /// A pointer to the contents in the error state.
7455         /// Reading from this pointer when `result_ok` is set is undefined.
7456         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7457 }
7458 #[repr(C)]
7459 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7460 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7461 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7462 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7463         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7464         /// `err` or `result` depending on the state of `result_ok`.
7465         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7466         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7467         pub result_ok: bool,
7468 }
7469 #[no_mangle]
7470 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7471 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7472         CResult_PhantomRouteHintsDecodeErrorZ {
7473                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7474                         result: Box::into_raw(Box::new(o)),
7475                 },
7476                 result_ok: true,
7477         }
7478 }
7479 #[no_mangle]
7480 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7481 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7482         CResult_PhantomRouteHintsDecodeErrorZ {
7483                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7484                         err: Box::into_raw(Box::new(e)),
7485                 },
7486                 result_ok: false,
7487         }
7488 }
7489 /// Checks if the given object is currently in the success state
7490 #[no_mangle]
7491 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7492         o.result_ok
7493 }
7494 #[no_mangle]
7495 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7496 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7497 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7498         fn drop(&mut self) {
7499                 if self.result_ok {
7500                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7501                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7502                         }
7503                 } else {
7504                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7505                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7506                         }
7507                 }
7508         }
7509 }
7510 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7511         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7512                 let contents = if o.result_ok {
7513                         let result = unsafe { o.contents.result };
7514                         unsafe { o.contents.result = core::ptr::null_mut() };
7515                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7516                 } else {
7517                         let err = unsafe { o.contents.err };
7518                         unsafe { o.contents.err = core::ptr::null_mut(); }
7519                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7520                 };
7521                 Self {
7522                         contents,
7523                         result_ok: o.result_ok,
7524                 }
7525         }
7526 }
7527 impl Clone for CResult_PhantomRouteHintsDecodeErrorZ {
7528         fn clone(&self) -> Self {
7529                 if self.result_ok {
7530                         Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7531                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PhantomRouteHints>::clone(unsafe { &*self.contents.result })))
7532                         } }
7533                 } else {
7534                         Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7535                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7536                         } }
7537                 }
7538         }
7539 }
7540 #[no_mangle]
7541 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
7542 /// but with all dynamically-allocated buffers duplicated in new buffers.
7543 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) }
7544 #[repr(C)]
7545 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7546 /// This corresponds to std::vector in C++
7547 pub struct CVec_ChannelMonitorZ {
7548         /// The elements in the array.
7549         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7550         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7551         /// The number of elements pointed to by `data`.
7552         pub datalen: usize
7553 }
7554 impl CVec_ChannelMonitorZ {
7555         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7556                 if self.datalen == 0 { return Vec::new(); }
7557                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7558                 self.data = core::ptr::null_mut();
7559                 self.datalen = 0;
7560                 ret
7561         }
7562         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7563                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7564         }
7565 }
7566 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7567         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7568                 let datalen = v.len();
7569                 let data = Box::into_raw(v.into_boxed_slice());
7570                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7571         }
7572 }
7573 #[no_mangle]
7574 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7575 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7576 impl Drop for CVec_ChannelMonitorZ {
7577         fn drop(&mut self) {
7578                 if self.datalen == 0 { return; }
7579                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7580         }
7581 }
7582 #[repr(C)]
7583 /// A tuple of 2 elements. See the individual fields for the types contained.
7584 pub struct C2Tuple_BlockHashChannelManagerZ {
7585         /// The element at position 0
7586         pub a: crate::c_types::ThirtyTwoBytes,
7587         /// The element at position 1
7588         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7589 }
7590 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7591         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7592                 Self {
7593                         a: tup.0,
7594                         b: tup.1,
7595                 }
7596         }
7597 }
7598 impl C2Tuple_BlockHashChannelManagerZ {
7599         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7600                 (self.a, self.b)
7601         }
7602 }
7603 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7604 #[no_mangle]
7605 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7606         C2Tuple_BlockHashChannelManagerZ { a, b, }
7607 }
7608
7609 #[no_mangle]
7610 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7611 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7612 #[repr(C)]
7613 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7614 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7615         /// A pointer to the contents in the success state.
7616         /// Reading from this pointer when `result_ok` is not set is undefined.
7617         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7618         /// A pointer to the contents in the error state.
7619         /// Reading from this pointer when `result_ok` is set is undefined.
7620         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7621 }
7622 #[repr(C)]
7623 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7624 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7625 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7626 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7627         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7628         /// `err` or `result` depending on the state of `result_ok`.
7629         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7630         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7631         pub result_ok: bool,
7632 }
7633 #[no_mangle]
7634 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7635 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7636         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7637                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7638                         result: Box::into_raw(Box::new(o)),
7639                 },
7640                 result_ok: true,
7641         }
7642 }
7643 #[no_mangle]
7644 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7645 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7646         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7647                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7648                         err: Box::into_raw(Box::new(e)),
7649                 },
7650                 result_ok: false,
7651         }
7652 }
7653 /// Checks if the given object is currently in the success state
7654 #[no_mangle]
7655 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7656         o.result_ok
7657 }
7658 #[no_mangle]
7659 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7660 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7661 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7662         fn drop(&mut self) {
7663                 if self.result_ok {
7664                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7665                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7666                         }
7667                 } else {
7668                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7669                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7670                         }
7671                 }
7672         }
7673 }
7674 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7675         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7676                 let contents = if o.result_ok {
7677                         let result = unsafe { o.contents.result };
7678                         unsafe { o.contents.result = core::ptr::null_mut() };
7679                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7680                 } else {
7681                         let err = unsafe { o.contents.err };
7682                         unsafe { o.contents.err = core::ptr::null_mut(); }
7683                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7684                 };
7685                 Self {
7686                         contents,
7687                         result_ok: o.result_ok,
7688                 }
7689         }
7690 }
7691 #[repr(C)]
7692 /// The contents of CResult_ChannelConfigDecodeErrorZ
7693 pub union CResult_ChannelConfigDecodeErrorZPtr {
7694         /// A pointer to the contents in the success state.
7695         /// Reading from this pointer when `result_ok` is not set is undefined.
7696         pub result: *mut crate::lightning::util::config::ChannelConfig,
7697         /// A pointer to the contents in the error state.
7698         /// Reading from this pointer when `result_ok` is set is undefined.
7699         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7700 }
7701 #[repr(C)]
7702 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7703 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7704 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7705 pub struct CResult_ChannelConfigDecodeErrorZ {
7706         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7707         /// `err` or `result` depending on the state of `result_ok`.
7708         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7709         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7710         pub result_ok: bool,
7711 }
7712 #[no_mangle]
7713 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7714 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7715         CResult_ChannelConfigDecodeErrorZ {
7716                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7717                         result: Box::into_raw(Box::new(o)),
7718                 },
7719                 result_ok: true,
7720         }
7721 }
7722 #[no_mangle]
7723 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7724 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7725         CResult_ChannelConfigDecodeErrorZ {
7726                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7727                         err: Box::into_raw(Box::new(e)),
7728                 },
7729                 result_ok: false,
7730         }
7731 }
7732 /// Checks if the given object is currently in the success state
7733 #[no_mangle]
7734 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7735         o.result_ok
7736 }
7737 #[no_mangle]
7738 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7739 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7740 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7741         fn drop(&mut self) {
7742                 if self.result_ok {
7743                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7744                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7745                         }
7746                 } else {
7747                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7748                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7749                         }
7750                 }
7751         }
7752 }
7753 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7754         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7755                 let contents = if o.result_ok {
7756                         let result = unsafe { o.contents.result };
7757                         unsafe { o.contents.result = core::ptr::null_mut() };
7758                         CResult_ChannelConfigDecodeErrorZPtr { result }
7759                 } else {
7760                         let err = unsafe { o.contents.err };
7761                         unsafe { o.contents.err = core::ptr::null_mut(); }
7762                         CResult_ChannelConfigDecodeErrorZPtr { err }
7763                 };
7764                 Self {
7765                         contents,
7766                         result_ok: o.result_ok,
7767                 }
7768         }
7769 }
7770 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7771         fn clone(&self) -> Self {
7772                 if self.result_ok {
7773                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7774                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7775                         } }
7776                 } else {
7777                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7778                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7779                         } }
7780                 }
7781         }
7782 }
7783 #[no_mangle]
7784 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7785 /// but with all dynamically-allocated buffers duplicated in new buffers.
7786 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7787 #[repr(C)]
7788 /// The contents of CResult_OutPointDecodeErrorZ
7789 pub union CResult_OutPointDecodeErrorZPtr {
7790         /// A pointer to the contents in the success state.
7791         /// Reading from this pointer when `result_ok` is not set is undefined.
7792         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7793         /// A pointer to the contents in the error state.
7794         /// Reading from this pointer when `result_ok` is set is undefined.
7795         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7796 }
7797 #[repr(C)]
7798 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7799 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7800 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7801 pub struct CResult_OutPointDecodeErrorZ {
7802         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7803         /// `err` or `result` depending on the state of `result_ok`.
7804         pub contents: CResult_OutPointDecodeErrorZPtr,
7805         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7806         pub result_ok: bool,
7807 }
7808 #[no_mangle]
7809 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7810 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7811         CResult_OutPointDecodeErrorZ {
7812                 contents: CResult_OutPointDecodeErrorZPtr {
7813                         result: Box::into_raw(Box::new(o)),
7814                 },
7815                 result_ok: true,
7816         }
7817 }
7818 #[no_mangle]
7819 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7820 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7821         CResult_OutPointDecodeErrorZ {
7822                 contents: CResult_OutPointDecodeErrorZPtr {
7823                         err: Box::into_raw(Box::new(e)),
7824                 },
7825                 result_ok: false,
7826         }
7827 }
7828 /// Checks if the given object is currently in the success state
7829 #[no_mangle]
7830 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7831         o.result_ok
7832 }
7833 #[no_mangle]
7834 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7835 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7836 impl Drop for CResult_OutPointDecodeErrorZ {
7837         fn drop(&mut self) {
7838                 if self.result_ok {
7839                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7840                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7841                         }
7842                 } else {
7843                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7844                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7845                         }
7846                 }
7847         }
7848 }
7849 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7850         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7851                 let contents = if o.result_ok {
7852                         let result = unsafe { o.contents.result };
7853                         unsafe { o.contents.result = core::ptr::null_mut() };
7854                         CResult_OutPointDecodeErrorZPtr { result }
7855                 } else {
7856                         let err = unsafe { o.contents.err };
7857                         unsafe { o.contents.err = core::ptr::null_mut(); }
7858                         CResult_OutPointDecodeErrorZPtr { err }
7859                 };
7860                 Self {
7861                         contents,
7862                         result_ok: o.result_ok,
7863                 }
7864         }
7865 }
7866 impl Clone for CResult_OutPointDecodeErrorZ {
7867         fn clone(&self) -> Self {
7868                 if self.result_ok {
7869                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7870                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7871                         } }
7872                 } else {
7873                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7874                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7875                         } }
7876                 }
7877         }
7878 }
7879 #[no_mangle]
7880 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7881 /// but with all dynamically-allocated buffers duplicated in new buffers.
7882 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7883 #[repr(C)]
7884 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7885 pub enum COption_TypeZ {
7886         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7887         Some(crate::lightning::ln::wire::Type),
7888         /// When we're in this state, this COption_TypeZ contains nothing
7889         None
7890 }
7891 impl COption_TypeZ {
7892         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7893                 if let Self::None = self { false } else { true }
7894         }
7895         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7896                 !self.is_some()
7897         }
7898         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7899                 if let Self::Some(v) = self { v } else { unreachable!() }
7900         }
7901 }
7902 #[no_mangle]
7903 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7904 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7905         COption_TypeZ::Some(o)
7906 }
7907 #[no_mangle]
7908 /// Constructs a new COption_TypeZ containing nothing
7909 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7910         COption_TypeZ::None
7911 }
7912 #[no_mangle]
7913 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7914 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7915 #[repr(C)]
7916 /// The contents of CResult_COption_TypeZDecodeErrorZ
7917 pub union CResult_COption_TypeZDecodeErrorZPtr {
7918         /// A pointer to the contents in the success state.
7919         /// Reading from this pointer when `result_ok` is not set is undefined.
7920         pub result: *mut crate::c_types::derived::COption_TypeZ,
7921         /// A pointer to the contents in the error state.
7922         /// Reading from this pointer when `result_ok` is set is undefined.
7923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7924 }
7925 #[repr(C)]
7926 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7927 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7929 pub struct CResult_COption_TypeZDecodeErrorZ {
7930         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7931         /// `err` or `result` depending on the state of `result_ok`.
7932         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7933         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7934         pub result_ok: bool,
7935 }
7936 #[no_mangle]
7937 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7938 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7939         CResult_COption_TypeZDecodeErrorZ {
7940                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7941                         result: Box::into_raw(Box::new(o)),
7942                 },
7943                 result_ok: true,
7944         }
7945 }
7946 #[no_mangle]
7947 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7948 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7949         CResult_COption_TypeZDecodeErrorZ {
7950                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7951                         err: Box::into_raw(Box::new(e)),
7952                 },
7953                 result_ok: false,
7954         }
7955 }
7956 /// Checks if the given object is currently in the success state
7957 #[no_mangle]
7958 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7959         o.result_ok
7960 }
7961 #[no_mangle]
7962 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7963 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7964 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7965         fn drop(&mut self) {
7966                 if self.result_ok {
7967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7969                         }
7970                 } else {
7971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7973                         }
7974                 }
7975         }
7976 }
7977 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7978         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7979                 let contents = if o.result_ok {
7980                         let result = unsafe { o.contents.result };
7981                         unsafe { o.contents.result = core::ptr::null_mut() };
7982                         CResult_COption_TypeZDecodeErrorZPtr { result }
7983                 } else {
7984                         let err = unsafe { o.contents.err };
7985                         unsafe { o.contents.err = core::ptr::null_mut(); }
7986                         CResult_COption_TypeZDecodeErrorZPtr { err }
7987                 };
7988                 Self {
7989                         contents,
7990                         result_ok: o.result_ok,
7991                 }
7992         }
7993 }
7994 #[repr(C)]
7995 /// The contents of CResult_PaymentIdPaymentErrorZ
7996 pub union CResult_PaymentIdPaymentErrorZPtr {
7997         /// A pointer to the contents in the success state.
7998         /// Reading from this pointer when `result_ok` is not set is undefined.
7999         pub result: *mut crate::c_types::ThirtyTwoBytes,
8000         /// A pointer to the contents in the error state.
8001         /// Reading from this pointer when `result_ok` is set is undefined.
8002         pub err: *mut crate::lightning_invoice::payment::PaymentError,
8003 }
8004 #[repr(C)]
8005 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8006 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8007 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8008 pub struct CResult_PaymentIdPaymentErrorZ {
8009         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8010         /// `err` or `result` depending on the state of `result_ok`.
8011         pub contents: CResult_PaymentIdPaymentErrorZPtr,
8012         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8013         pub result_ok: bool,
8014 }
8015 #[no_mangle]
8016 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
8017 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
8018         CResult_PaymentIdPaymentErrorZ {
8019                 contents: CResult_PaymentIdPaymentErrorZPtr {
8020                         result: Box::into_raw(Box::new(o)),
8021                 },
8022                 result_ok: true,
8023         }
8024 }
8025 #[no_mangle]
8026 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
8027 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
8028         CResult_PaymentIdPaymentErrorZ {
8029                 contents: CResult_PaymentIdPaymentErrorZPtr {
8030                         err: Box::into_raw(Box::new(e)),
8031                 },
8032                 result_ok: false,
8033         }
8034 }
8035 /// Checks if the given object is currently in the success state
8036 #[no_mangle]
8037 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
8038         o.result_ok
8039 }
8040 #[no_mangle]
8041 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
8042 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
8043 impl Drop for CResult_PaymentIdPaymentErrorZ {
8044         fn drop(&mut self) {
8045                 if self.result_ok {
8046                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8047                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8048                         }
8049                 } else {
8050                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8051                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8052                         }
8053                 }
8054         }
8055 }
8056 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
8057         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
8058                 let contents = if o.result_ok {
8059                         let result = unsafe { o.contents.result };
8060                         unsafe { o.contents.result = core::ptr::null_mut() };
8061                         CResult_PaymentIdPaymentErrorZPtr { result }
8062                 } else {
8063                         let err = unsafe { o.contents.err };
8064                         unsafe { o.contents.err = core::ptr::null_mut(); }
8065                         CResult_PaymentIdPaymentErrorZPtr { err }
8066                 };
8067                 Self {
8068                         contents,
8069                         result_ok: o.result_ok,
8070                 }
8071         }
8072 }
8073 impl Clone for CResult_PaymentIdPaymentErrorZ {
8074         fn clone(&self) -> Self {
8075                 if self.result_ok {
8076                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8077                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8078                         } }
8079                 } else {
8080                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8081                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8082                         } }
8083                 }
8084         }
8085 }
8086 #[no_mangle]
8087 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8088 /// but with all dynamically-allocated buffers duplicated in new buffers.
8089 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8090 #[repr(C)]
8091 /// The contents of CResult_SiPrefixNoneZ
8092 pub union CResult_SiPrefixNoneZPtr {
8093         /// A pointer to the contents in the success state.
8094         /// Reading from this pointer when `result_ok` is not set is undefined.
8095         pub result: *mut crate::lightning_invoice::SiPrefix,
8096         /// Note that this value is always NULL, as there are no contents in the Err variant
8097         pub err: *mut core::ffi::c_void,
8098 }
8099 #[repr(C)]
8100 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8101 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8102 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8103 pub struct CResult_SiPrefixNoneZ {
8104         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8105         /// `err` or `result` depending on the state of `result_ok`.
8106         pub contents: CResult_SiPrefixNoneZPtr,
8107         /// Whether this CResult_SiPrefixNoneZ represents a success state.
8108         pub result_ok: bool,
8109 }
8110 #[no_mangle]
8111 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8112 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8113         CResult_SiPrefixNoneZ {
8114                 contents: CResult_SiPrefixNoneZPtr {
8115                         result: Box::into_raw(Box::new(o)),
8116                 },
8117                 result_ok: true,
8118         }
8119 }
8120 #[no_mangle]
8121 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8122 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8123         CResult_SiPrefixNoneZ {
8124                 contents: CResult_SiPrefixNoneZPtr {
8125                         err: core::ptr::null_mut(),
8126                 },
8127                 result_ok: false,
8128         }
8129 }
8130 /// Checks if the given object is currently in the success state
8131 #[no_mangle]
8132 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8133         o.result_ok
8134 }
8135 #[no_mangle]
8136 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8137 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8138 impl Drop for CResult_SiPrefixNoneZ {
8139         fn drop(&mut self) {
8140                 if self.result_ok {
8141                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8142                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8143                         }
8144                 } else {
8145                 }
8146         }
8147 }
8148 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8149         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8150                 let contents = if o.result_ok {
8151                         let result = unsafe { o.contents.result };
8152                         unsafe { o.contents.result = core::ptr::null_mut() };
8153                         CResult_SiPrefixNoneZPtr { result }
8154                 } else {
8155                         let _ = unsafe { Box::from_raw(o.contents.err) };
8156                         o.contents.err = core::ptr::null_mut();
8157                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8158                 };
8159                 Self {
8160                         contents,
8161                         result_ok: o.result_ok,
8162                 }
8163         }
8164 }
8165 impl Clone for CResult_SiPrefixNoneZ {
8166         fn clone(&self) -> Self {
8167                 if self.result_ok {
8168                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8169                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8170                         } }
8171                 } else {
8172                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8173                                 err: core::ptr::null_mut()
8174                         } }
8175                 }
8176         }
8177 }
8178 #[no_mangle]
8179 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8180 /// but with all dynamically-allocated buffers duplicated in new buffers.
8181 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8182 #[repr(C)]
8183 /// The contents of CResult_InvoiceNoneZ
8184 pub union CResult_InvoiceNoneZPtr {
8185         /// A pointer to the contents in the success state.
8186         /// Reading from this pointer when `result_ok` is not set is undefined.
8187         pub result: *mut crate::lightning_invoice::Invoice,
8188         /// Note that this value is always NULL, as there are no contents in the Err variant
8189         pub err: *mut core::ffi::c_void,
8190 }
8191 #[repr(C)]
8192 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8193 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8194 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8195 pub struct CResult_InvoiceNoneZ {
8196         /// The contents of this CResult_InvoiceNoneZ, accessible via either
8197         /// `err` or `result` depending on the state of `result_ok`.
8198         pub contents: CResult_InvoiceNoneZPtr,
8199         /// Whether this CResult_InvoiceNoneZ represents a success state.
8200         pub result_ok: bool,
8201 }
8202 #[no_mangle]
8203 /// Creates a new CResult_InvoiceNoneZ in the success state.
8204 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8205         CResult_InvoiceNoneZ {
8206                 contents: CResult_InvoiceNoneZPtr {
8207                         result: Box::into_raw(Box::new(o)),
8208                 },
8209                 result_ok: true,
8210         }
8211 }
8212 #[no_mangle]
8213 /// Creates a new CResult_InvoiceNoneZ in the error state.
8214 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8215         CResult_InvoiceNoneZ {
8216                 contents: CResult_InvoiceNoneZPtr {
8217                         err: core::ptr::null_mut(),
8218                 },
8219                 result_ok: false,
8220         }
8221 }
8222 /// Checks if the given object is currently in the success state
8223 #[no_mangle]
8224 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8225         o.result_ok
8226 }
8227 #[no_mangle]
8228 /// Frees any resources used by the CResult_InvoiceNoneZ.
8229 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8230 impl Drop for CResult_InvoiceNoneZ {
8231         fn drop(&mut self) {
8232                 if self.result_ok {
8233                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8234                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8235                         }
8236                 } else {
8237                 }
8238         }
8239 }
8240 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8241         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8242                 let contents = if o.result_ok {
8243                         let result = unsafe { o.contents.result };
8244                         unsafe { o.contents.result = core::ptr::null_mut() };
8245                         CResult_InvoiceNoneZPtr { result }
8246                 } else {
8247                         let _ = unsafe { Box::from_raw(o.contents.err) };
8248                         o.contents.err = core::ptr::null_mut();
8249                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8250                 };
8251                 Self {
8252                         contents,
8253                         result_ok: o.result_ok,
8254                 }
8255         }
8256 }
8257 impl Clone for CResult_InvoiceNoneZ {
8258         fn clone(&self) -> Self {
8259                 if self.result_ok {
8260                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8261                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8262                         } }
8263                 } else {
8264                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8265                                 err: core::ptr::null_mut()
8266                         } }
8267                 }
8268         }
8269 }
8270 #[no_mangle]
8271 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8272 /// but with all dynamically-allocated buffers duplicated in new buffers.
8273 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8274 #[repr(C)]
8275 /// The contents of CResult_SignedRawInvoiceNoneZ
8276 pub union CResult_SignedRawInvoiceNoneZPtr {
8277         /// A pointer to the contents in the success state.
8278         /// Reading from this pointer when `result_ok` is not set is undefined.
8279         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8280         /// Note that this value is always NULL, as there are no contents in the Err variant
8281         pub err: *mut core::ffi::c_void,
8282 }
8283 #[repr(C)]
8284 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8285 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8287 pub struct CResult_SignedRawInvoiceNoneZ {
8288         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8289         /// `err` or `result` depending on the state of `result_ok`.
8290         pub contents: CResult_SignedRawInvoiceNoneZPtr,
8291         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8292         pub result_ok: bool,
8293 }
8294 #[no_mangle]
8295 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8296 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8297         CResult_SignedRawInvoiceNoneZ {
8298                 contents: CResult_SignedRawInvoiceNoneZPtr {
8299                         result: Box::into_raw(Box::new(o)),
8300                 },
8301                 result_ok: true,
8302         }
8303 }
8304 #[no_mangle]
8305 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8306 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8307         CResult_SignedRawInvoiceNoneZ {
8308                 contents: CResult_SignedRawInvoiceNoneZPtr {
8309                         err: core::ptr::null_mut(),
8310                 },
8311                 result_ok: false,
8312         }
8313 }
8314 /// Checks if the given object is currently in the success state
8315 #[no_mangle]
8316 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8317         o.result_ok
8318 }
8319 #[no_mangle]
8320 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8321 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8322 impl Drop for CResult_SignedRawInvoiceNoneZ {
8323         fn drop(&mut self) {
8324                 if self.result_ok {
8325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8327                         }
8328                 } else {
8329                 }
8330         }
8331 }
8332 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8334                 let contents = if o.result_ok {
8335                         let result = unsafe { o.contents.result };
8336                         unsafe { o.contents.result = core::ptr::null_mut() };
8337                         CResult_SignedRawInvoiceNoneZPtr { result }
8338                 } else {
8339                         let _ = unsafe { Box::from_raw(o.contents.err) };
8340                         o.contents.err = core::ptr::null_mut();
8341                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8342                 };
8343                 Self {
8344                         contents,
8345                         result_ok: o.result_ok,
8346                 }
8347         }
8348 }
8349 impl Clone for CResult_SignedRawInvoiceNoneZ {
8350         fn clone(&self) -> Self {
8351                 if self.result_ok {
8352                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8353                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8354                         } }
8355                 } else {
8356                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8357                                 err: core::ptr::null_mut()
8358                         } }
8359                 }
8360         }
8361 }
8362 #[no_mangle]
8363 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8364 /// but with all dynamically-allocated buffers duplicated in new buffers.
8365 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8366 #[repr(C)]
8367 /// A tuple of 3 elements. See the individual fields for the types contained.
8368 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8369         /// The element at position 0
8370         pub a: crate::lightning_invoice::RawInvoice,
8371         /// The element at position 1
8372         pub b: crate::c_types::ThirtyTwoBytes,
8373         /// The element at position 2
8374         pub c: crate::lightning_invoice::InvoiceSignature,
8375 }
8376 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8377         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8378                 Self {
8379                         a: tup.0,
8380                         b: tup.1,
8381                         c: tup.2,
8382                 }
8383         }
8384 }
8385 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8386         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8387                 (self.a, self.b, self.c)
8388         }
8389 }
8390 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8391         fn clone(&self) -> Self {
8392                 Self {
8393                         a: Clone::clone(&self.a),
8394                         b: Clone::clone(&self.b),
8395                         c: Clone::clone(&self.c),
8396                 }
8397         }
8398 }
8399 #[no_mangle]
8400 /// Creates a new tuple which has the same data as `orig`
8401 /// but with all dynamically-allocated buffers duplicated in new buffers.
8402 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8403 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8404 #[no_mangle]
8405 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 {
8406         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8407 }
8408
8409 #[no_mangle]
8410 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8411 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8412 #[repr(C)]
8413 /// The contents of CResult_PayeePubKeyErrorZ
8414 pub union CResult_PayeePubKeyErrorZPtr {
8415         /// A pointer to the contents in the success state.
8416         /// Reading from this pointer when `result_ok` is not set is undefined.
8417         pub result: *mut crate::lightning_invoice::PayeePubKey,
8418         /// A pointer to the contents in the error state.
8419         /// Reading from this pointer when `result_ok` is set is undefined.
8420         pub err: *mut crate::c_types::Secp256k1Error,
8421 }
8422 #[repr(C)]
8423 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8424 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8425 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8426 pub struct CResult_PayeePubKeyErrorZ {
8427         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8428         /// `err` or `result` depending on the state of `result_ok`.
8429         pub contents: CResult_PayeePubKeyErrorZPtr,
8430         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8431         pub result_ok: bool,
8432 }
8433 #[no_mangle]
8434 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8435 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8436         CResult_PayeePubKeyErrorZ {
8437                 contents: CResult_PayeePubKeyErrorZPtr {
8438                         result: Box::into_raw(Box::new(o)),
8439                 },
8440                 result_ok: true,
8441         }
8442 }
8443 #[no_mangle]
8444 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8445 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8446         CResult_PayeePubKeyErrorZ {
8447                 contents: CResult_PayeePubKeyErrorZPtr {
8448                         err: Box::into_raw(Box::new(e)),
8449                 },
8450                 result_ok: false,
8451         }
8452 }
8453 /// Checks if the given object is currently in the success state
8454 #[no_mangle]
8455 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8456         o.result_ok
8457 }
8458 #[no_mangle]
8459 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8460 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8461 impl Drop for CResult_PayeePubKeyErrorZ {
8462         fn drop(&mut self) {
8463                 if self.result_ok {
8464                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8465                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8466                         }
8467                 } else {
8468                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8469                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8470                         }
8471                 }
8472         }
8473 }
8474 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8475         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8476                 let contents = if o.result_ok {
8477                         let result = unsafe { o.contents.result };
8478                         unsafe { o.contents.result = core::ptr::null_mut() };
8479                         CResult_PayeePubKeyErrorZPtr { result }
8480                 } else {
8481                         let err = unsafe { o.contents.err };
8482                         unsafe { o.contents.err = core::ptr::null_mut(); }
8483                         CResult_PayeePubKeyErrorZPtr { err }
8484                 };
8485                 Self {
8486                         contents,
8487                         result_ok: o.result_ok,
8488                 }
8489         }
8490 }
8491 impl Clone for CResult_PayeePubKeyErrorZ {
8492         fn clone(&self) -> Self {
8493                 if self.result_ok {
8494                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8495                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8496                         } }
8497                 } else {
8498                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8499                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8500                         } }
8501                 }
8502         }
8503 }
8504 #[no_mangle]
8505 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8506 /// but with all dynamically-allocated buffers duplicated in new buffers.
8507 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8508 #[repr(C)]
8509 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8510 /// This corresponds to std::vector in C++
8511 pub struct CVec_PrivateRouteZ {
8512         /// The elements in the array.
8513         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8514         pub data: *mut crate::lightning_invoice::PrivateRoute,
8515         /// The number of elements pointed to by `data`.
8516         pub datalen: usize
8517 }
8518 impl CVec_PrivateRouteZ {
8519         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8520                 if self.datalen == 0 { return Vec::new(); }
8521                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8522                 self.data = core::ptr::null_mut();
8523                 self.datalen = 0;
8524                 ret
8525         }
8526         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8527                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8528         }
8529 }
8530 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8531         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8532                 let datalen = v.len();
8533                 let data = Box::into_raw(v.into_boxed_slice());
8534                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8535         }
8536 }
8537 #[no_mangle]
8538 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8539 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8540 impl Drop for CVec_PrivateRouteZ {
8541         fn drop(&mut self) {
8542                 if self.datalen == 0 { return; }
8543                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8544         }
8545 }
8546 impl Clone for CVec_PrivateRouteZ {
8547         fn clone(&self) -> Self {
8548                 let mut res = Vec::new();
8549                 if self.datalen == 0 { return Self::from(res); }
8550                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8551                 Self::from(res)
8552         }
8553 }
8554 #[repr(C)]
8555 /// The contents of CResult_PositiveTimestampCreationErrorZ
8556 pub union CResult_PositiveTimestampCreationErrorZPtr {
8557         /// A pointer to the contents in the success state.
8558         /// Reading from this pointer when `result_ok` is not set is undefined.
8559         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8560         /// A pointer to the contents in the error state.
8561         /// Reading from this pointer when `result_ok` is set is undefined.
8562         pub err: *mut crate::lightning_invoice::CreationError,
8563 }
8564 #[repr(C)]
8565 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8566 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8567 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8568 pub struct CResult_PositiveTimestampCreationErrorZ {
8569         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8570         /// `err` or `result` depending on the state of `result_ok`.
8571         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8572         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8573         pub result_ok: bool,
8574 }
8575 #[no_mangle]
8576 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8577 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8578         CResult_PositiveTimestampCreationErrorZ {
8579                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8580                         result: Box::into_raw(Box::new(o)),
8581                 },
8582                 result_ok: true,
8583         }
8584 }
8585 #[no_mangle]
8586 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8587 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8588         CResult_PositiveTimestampCreationErrorZ {
8589                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8590                         err: Box::into_raw(Box::new(e)),
8591                 },
8592                 result_ok: false,
8593         }
8594 }
8595 /// Checks if the given object is currently in the success state
8596 #[no_mangle]
8597 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8598         o.result_ok
8599 }
8600 #[no_mangle]
8601 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8602 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8603 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8604         fn drop(&mut self) {
8605                 if self.result_ok {
8606                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8607                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8608                         }
8609                 } else {
8610                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8611                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8612                         }
8613                 }
8614         }
8615 }
8616 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8617         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8618                 let contents = if o.result_ok {
8619                         let result = unsafe { o.contents.result };
8620                         unsafe { o.contents.result = core::ptr::null_mut() };
8621                         CResult_PositiveTimestampCreationErrorZPtr { result }
8622                 } else {
8623                         let err = unsafe { o.contents.err };
8624                         unsafe { o.contents.err = core::ptr::null_mut(); }
8625                         CResult_PositiveTimestampCreationErrorZPtr { err }
8626                 };
8627                 Self {
8628                         contents,
8629                         result_ok: o.result_ok,
8630                 }
8631         }
8632 }
8633 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8634         fn clone(&self) -> Self {
8635                 if self.result_ok {
8636                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8637                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8638                         } }
8639                 } else {
8640                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8641                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8642                         } }
8643                 }
8644         }
8645 }
8646 #[no_mangle]
8647 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8648 /// but with all dynamically-allocated buffers duplicated in new buffers.
8649 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8650 #[repr(C)]
8651 /// The contents of CResult_NoneSemanticErrorZ
8652 pub union CResult_NoneSemanticErrorZPtr {
8653         /// Note that this value is always NULL, as there are no contents in the OK variant
8654         pub result: *mut core::ffi::c_void,
8655         /// A pointer to the contents in the error state.
8656         /// Reading from this pointer when `result_ok` is set is undefined.
8657         pub err: *mut crate::lightning_invoice::SemanticError,
8658 }
8659 #[repr(C)]
8660 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8661 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8662 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8663 pub struct CResult_NoneSemanticErrorZ {
8664         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8665         /// `err` or `result` depending on the state of `result_ok`.
8666         pub contents: CResult_NoneSemanticErrorZPtr,
8667         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8668         pub result_ok: bool,
8669 }
8670 #[no_mangle]
8671 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8672 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8673         CResult_NoneSemanticErrorZ {
8674                 contents: CResult_NoneSemanticErrorZPtr {
8675                         result: core::ptr::null_mut(),
8676                 },
8677                 result_ok: true,
8678         }
8679 }
8680 #[no_mangle]
8681 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8682 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8683         CResult_NoneSemanticErrorZ {
8684                 contents: CResult_NoneSemanticErrorZPtr {
8685                         err: Box::into_raw(Box::new(e)),
8686                 },
8687                 result_ok: false,
8688         }
8689 }
8690 /// Checks if the given object is currently in the success state
8691 #[no_mangle]
8692 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8693         o.result_ok
8694 }
8695 #[no_mangle]
8696 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8697 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8698 impl Drop for CResult_NoneSemanticErrorZ {
8699         fn drop(&mut self) {
8700                 if self.result_ok {
8701                 } else {
8702                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8703                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8704                         }
8705                 }
8706         }
8707 }
8708 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8709         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8710                 let contents = if o.result_ok {
8711                         let _ = unsafe { Box::from_raw(o.contents.result) };
8712                         o.contents.result = core::ptr::null_mut();
8713                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8714                 } else {
8715                         let err = unsafe { o.contents.err };
8716                         unsafe { o.contents.err = core::ptr::null_mut(); }
8717                         CResult_NoneSemanticErrorZPtr { err }
8718                 };
8719                 Self {
8720                         contents,
8721                         result_ok: o.result_ok,
8722                 }
8723         }
8724 }
8725 impl Clone for CResult_NoneSemanticErrorZ {
8726         fn clone(&self) -> Self {
8727                 if self.result_ok {
8728                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8729                                 result: core::ptr::null_mut()
8730                         } }
8731                 } else {
8732                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8733                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8734                         } }
8735                 }
8736         }
8737 }
8738 #[no_mangle]
8739 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8740 /// but with all dynamically-allocated buffers duplicated in new buffers.
8741 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8742 #[repr(C)]
8743 /// The contents of CResult_InvoiceSemanticErrorZ
8744 pub union CResult_InvoiceSemanticErrorZPtr {
8745         /// A pointer to the contents in the success state.
8746         /// Reading from this pointer when `result_ok` is not set is undefined.
8747         pub result: *mut crate::lightning_invoice::Invoice,
8748         /// A pointer to the contents in the error state.
8749         /// Reading from this pointer when `result_ok` is set is undefined.
8750         pub err: *mut crate::lightning_invoice::SemanticError,
8751 }
8752 #[repr(C)]
8753 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8754 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8755 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8756 pub struct CResult_InvoiceSemanticErrorZ {
8757         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8758         /// `err` or `result` depending on the state of `result_ok`.
8759         pub contents: CResult_InvoiceSemanticErrorZPtr,
8760         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8761         pub result_ok: bool,
8762 }
8763 #[no_mangle]
8764 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8765 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8766         CResult_InvoiceSemanticErrorZ {
8767                 contents: CResult_InvoiceSemanticErrorZPtr {
8768                         result: Box::into_raw(Box::new(o)),
8769                 },
8770                 result_ok: true,
8771         }
8772 }
8773 #[no_mangle]
8774 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8775 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8776         CResult_InvoiceSemanticErrorZ {
8777                 contents: CResult_InvoiceSemanticErrorZPtr {
8778                         err: Box::into_raw(Box::new(e)),
8779                 },
8780                 result_ok: false,
8781         }
8782 }
8783 /// Checks if the given object is currently in the success state
8784 #[no_mangle]
8785 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8786         o.result_ok
8787 }
8788 #[no_mangle]
8789 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8790 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8791 impl Drop for CResult_InvoiceSemanticErrorZ {
8792         fn drop(&mut self) {
8793                 if self.result_ok {
8794                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8795                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8796                         }
8797                 } else {
8798                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8799                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8800                         }
8801                 }
8802         }
8803 }
8804 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8805         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8806                 let contents = if o.result_ok {
8807                         let result = unsafe { o.contents.result };
8808                         unsafe { o.contents.result = core::ptr::null_mut() };
8809                         CResult_InvoiceSemanticErrorZPtr { result }
8810                 } else {
8811                         let err = unsafe { o.contents.err };
8812                         unsafe { o.contents.err = core::ptr::null_mut(); }
8813                         CResult_InvoiceSemanticErrorZPtr { err }
8814                 };
8815                 Self {
8816                         contents,
8817                         result_ok: o.result_ok,
8818                 }
8819         }
8820 }
8821 impl Clone for CResult_InvoiceSemanticErrorZ {
8822         fn clone(&self) -> Self {
8823                 if self.result_ok {
8824                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8825                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8826                         } }
8827                 } else {
8828                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8829                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8830                         } }
8831                 }
8832         }
8833 }
8834 #[no_mangle]
8835 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8836 /// but with all dynamically-allocated buffers duplicated in new buffers.
8837 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8838 #[repr(C)]
8839 /// The contents of CResult_DescriptionCreationErrorZ
8840 pub union CResult_DescriptionCreationErrorZPtr {
8841         /// A pointer to the contents in the success state.
8842         /// Reading from this pointer when `result_ok` is not set is undefined.
8843         pub result: *mut crate::lightning_invoice::Description,
8844         /// A pointer to the contents in the error state.
8845         /// Reading from this pointer when `result_ok` is set is undefined.
8846         pub err: *mut crate::lightning_invoice::CreationError,
8847 }
8848 #[repr(C)]
8849 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8850 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8851 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8852 pub struct CResult_DescriptionCreationErrorZ {
8853         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8854         /// `err` or `result` depending on the state of `result_ok`.
8855         pub contents: CResult_DescriptionCreationErrorZPtr,
8856         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8857         pub result_ok: bool,
8858 }
8859 #[no_mangle]
8860 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8861 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8862         CResult_DescriptionCreationErrorZ {
8863                 contents: CResult_DescriptionCreationErrorZPtr {
8864                         result: Box::into_raw(Box::new(o)),
8865                 },
8866                 result_ok: true,
8867         }
8868 }
8869 #[no_mangle]
8870 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8871 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8872         CResult_DescriptionCreationErrorZ {
8873                 contents: CResult_DescriptionCreationErrorZPtr {
8874                         err: Box::into_raw(Box::new(e)),
8875                 },
8876                 result_ok: false,
8877         }
8878 }
8879 /// Checks if the given object is currently in the success state
8880 #[no_mangle]
8881 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8882         o.result_ok
8883 }
8884 #[no_mangle]
8885 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8886 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8887 impl Drop for CResult_DescriptionCreationErrorZ {
8888         fn drop(&mut self) {
8889                 if self.result_ok {
8890                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8891                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8892                         }
8893                 } else {
8894                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8895                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8896                         }
8897                 }
8898         }
8899 }
8900 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8901         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8902                 let contents = if o.result_ok {
8903                         let result = unsafe { o.contents.result };
8904                         unsafe { o.contents.result = core::ptr::null_mut() };
8905                         CResult_DescriptionCreationErrorZPtr { result }
8906                 } else {
8907                         let err = unsafe { o.contents.err };
8908                         unsafe { o.contents.err = core::ptr::null_mut(); }
8909                         CResult_DescriptionCreationErrorZPtr { err }
8910                 };
8911                 Self {
8912                         contents,
8913                         result_ok: o.result_ok,
8914                 }
8915         }
8916 }
8917 impl Clone for CResult_DescriptionCreationErrorZ {
8918         fn clone(&self) -> Self {
8919                 if self.result_ok {
8920                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8921                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8922                         } }
8923                 } else {
8924                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8925                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8926                         } }
8927                 }
8928         }
8929 }
8930 #[no_mangle]
8931 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8932 /// but with all dynamically-allocated buffers duplicated in new buffers.
8933 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8934 #[repr(C)]
8935 /// The contents of CResult_PrivateRouteCreationErrorZ
8936 pub union CResult_PrivateRouteCreationErrorZPtr {
8937         /// A pointer to the contents in the success state.
8938         /// Reading from this pointer when `result_ok` is not set is undefined.
8939         pub result: *mut crate::lightning_invoice::PrivateRoute,
8940         /// A pointer to the contents in the error state.
8941         /// Reading from this pointer when `result_ok` is set is undefined.
8942         pub err: *mut crate::lightning_invoice::CreationError,
8943 }
8944 #[repr(C)]
8945 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8946 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8947 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8948 pub struct CResult_PrivateRouteCreationErrorZ {
8949         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8950         /// `err` or `result` depending on the state of `result_ok`.
8951         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8952         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8953         pub result_ok: bool,
8954 }
8955 #[no_mangle]
8956 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8957 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8958         CResult_PrivateRouteCreationErrorZ {
8959                 contents: CResult_PrivateRouteCreationErrorZPtr {
8960                         result: Box::into_raw(Box::new(o)),
8961                 },
8962                 result_ok: true,
8963         }
8964 }
8965 #[no_mangle]
8966 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8967 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8968         CResult_PrivateRouteCreationErrorZ {
8969                 contents: CResult_PrivateRouteCreationErrorZPtr {
8970                         err: Box::into_raw(Box::new(e)),
8971                 },
8972                 result_ok: false,
8973         }
8974 }
8975 /// Checks if the given object is currently in the success state
8976 #[no_mangle]
8977 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8978         o.result_ok
8979 }
8980 #[no_mangle]
8981 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8982 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8983 impl Drop for CResult_PrivateRouteCreationErrorZ {
8984         fn drop(&mut self) {
8985                 if self.result_ok {
8986                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8987                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8988                         }
8989                 } else {
8990                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8991                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8992                         }
8993                 }
8994         }
8995 }
8996 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8997         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8998                 let contents = if o.result_ok {
8999                         let result = unsafe { o.contents.result };
9000                         unsafe { o.contents.result = core::ptr::null_mut() };
9001                         CResult_PrivateRouteCreationErrorZPtr { result }
9002                 } else {
9003                         let err = unsafe { o.contents.err };
9004                         unsafe { o.contents.err = core::ptr::null_mut(); }
9005                         CResult_PrivateRouteCreationErrorZPtr { err }
9006                 };
9007                 Self {
9008                         contents,
9009                         result_ok: o.result_ok,
9010                 }
9011         }
9012 }
9013 impl Clone for CResult_PrivateRouteCreationErrorZ {
9014         fn clone(&self) -> Self {
9015                 if self.result_ok {
9016                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
9017                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
9018                         } }
9019                 } else {
9020                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
9021                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
9022                         } }
9023                 }
9024         }
9025 }
9026 #[no_mangle]
9027 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
9028 /// but with all dynamically-allocated buffers duplicated in new buffers.
9029 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
9030 #[repr(C)]
9031 /// The contents of CResult_StringErrorZ
9032 pub union CResult_StringErrorZPtr {
9033         /// A pointer to the contents in the success state.
9034         /// Reading from this pointer when `result_ok` is not set is undefined.
9035         pub result: *mut crate::c_types::Str,
9036         /// A pointer to the contents in the error state.
9037         /// Reading from this pointer when `result_ok` is set is undefined.
9038         pub err: *mut crate::c_types::Secp256k1Error,
9039 }
9040 #[repr(C)]
9041 /// A CResult_StringErrorZ represents the result of a fallible operation,
9042 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
9043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9044 pub struct CResult_StringErrorZ {
9045         /// The contents of this CResult_StringErrorZ, accessible via either
9046         /// `err` or `result` depending on the state of `result_ok`.
9047         pub contents: CResult_StringErrorZPtr,
9048         /// Whether this CResult_StringErrorZ represents a success state.
9049         pub result_ok: bool,
9050 }
9051 #[no_mangle]
9052 /// Creates a new CResult_StringErrorZ in the success state.
9053 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
9054         CResult_StringErrorZ {
9055                 contents: CResult_StringErrorZPtr {
9056                         result: Box::into_raw(Box::new(o)),
9057                 },
9058                 result_ok: true,
9059         }
9060 }
9061 #[no_mangle]
9062 /// Creates a new CResult_StringErrorZ in the error state.
9063 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
9064         CResult_StringErrorZ {
9065                 contents: CResult_StringErrorZPtr {
9066                         err: Box::into_raw(Box::new(e)),
9067                 },
9068                 result_ok: false,
9069         }
9070 }
9071 /// Checks if the given object is currently in the success state
9072 #[no_mangle]
9073 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9074         o.result_ok
9075 }
9076 #[no_mangle]
9077 /// Frees any resources used by the CResult_StringErrorZ.
9078 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9079 impl Drop for CResult_StringErrorZ {
9080         fn drop(&mut self) {
9081                 if self.result_ok {
9082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9084                         }
9085                 } else {
9086                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9087                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9088                         }
9089                 }
9090         }
9091 }
9092 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9093         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9094                 let contents = if o.result_ok {
9095                         let result = unsafe { o.contents.result };
9096                         unsafe { o.contents.result = core::ptr::null_mut() };
9097                         CResult_StringErrorZPtr { result }
9098                 } else {
9099                         let err = unsafe { o.contents.err };
9100                         unsafe { o.contents.err = core::ptr::null_mut(); }
9101                         CResult_StringErrorZPtr { err }
9102                 };
9103                 Self {
9104                         contents,
9105                         result_ok: o.result_ok,
9106                 }
9107         }
9108 }
9109 #[repr(C)]
9110 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9111 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9112         /// A pointer to the contents in the success state.
9113         /// Reading from this pointer when `result_ok` is not set is undefined.
9114         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9115         /// A pointer to the contents in the error state.
9116         /// Reading from this pointer when `result_ok` is set is undefined.
9117         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9118 }
9119 #[repr(C)]
9120 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9121 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9123 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9124         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9125         /// `err` or `result` depending on the state of `result_ok`.
9126         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9127         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9128         pub result_ok: bool,
9129 }
9130 #[no_mangle]
9131 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9132 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9133         CResult_ChannelMonitorUpdateDecodeErrorZ {
9134                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9135                         result: Box::into_raw(Box::new(o)),
9136                 },
9137                 result_ok: true,
9138         }
9139 }
9140 #[no_mangle]
9141 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9142 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9143         CResult_ChannelMonitorUpdateDecodeErrorZ {
9144                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9145                         err: Box::into_raw(Box::new(e)),
9146                 },
9147                 result_ok: false,
9148         }
9149 }
9150 /// Checks if the given object is currently in the success state
9151 #[no_mangle]
9152 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9153         o.result_ok
9154 }
9155 #[no_mangle]
9156 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9157 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9158 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9159         fn drop(&mut self) {
9160                 if self.result_ok {
9161                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9162                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9163                         }
9164                 } else {
9165                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9166                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9167                         }
9168                 }
9169         }
9170 }
9171 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9172         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9173                 let contents = if o.result_ok {
9174                         let result = unsafe { o.contents.result };
9175                         unsafe { o.contents.result = core::ptr::null_mut() };
9176                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9177                 } else {
9178                         let err = unsafe { o.contents.err };
9179                         unsafe { o.contents.err = core::ptr::null_mut(); }
9180                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9181                 };
9182                 Self {
9183                         contents,
9184                         result_ok: o.result_ok,
9185                 }
9186         }
9187 }
9188 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9189         fn clone(&self) -> Self {
9190                 if self.result_ok {
9191                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9192                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9193                         } }
9194                 } else {
9195                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9196                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9197                         } }
9198                 }
9199         }
9200 }
9201 #[no_mangle]
9202 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9203 /// but with all dynamically-allocated buffers duplicated in new buffers.
9204 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9205 #[repr(C)]
9206 #[derive(Clone)]
9207 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9208 pub enum COption_MonitorEventZ {
9209         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9210         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9211         /// When we're in this state, this COption_MonitorEventZ contains nothing
9212         None
9213 }
9214 impl COption_MonitorEventZ {
9215         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9216                 if let Self::None = self { false } else { true }
9217         }
9218         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9219                 !self.is_some()
9220         }
9221         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9222                 if let Self::Some(v) = self { v } else { unreachable!() }
9223         }
9224 }
9225 #[no_mangle]
9226 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9227 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9228         COption_MonitorEventZ::Some(o)
9229 }
9230 #[no_mangle]
9231 /// Constructs a new COption_MonitorEventZ containing nothing
9232 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9233         COption_MonitorEventZ::None
9234 }
9235 #[no_mangle]
9236 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9237 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9238 #[no_mangle]
9239 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9240 /// but with all dynamically-allocated buffers duplicated in new buffers.
9241 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9242 #[repr(C)]
9243 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9244 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9245         /// A pointer to the contents in the success state.
9246         /// Reading from this pointer when `result_ok` is not set is undefined.
9247         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9248         /// A pointer to the contents in the error state.
9249         /// Reading from this pointer when `result_ok` is set is undefined.
9250         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9251 }
9252 #[repr(C)]
9253 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9254 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9255 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9256 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9257         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9258         /// `err` or `result` depending on the state of `result_ok`.
9259         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9260         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9261         pub result_ok: bool,
9262 }
9263 #[no_mangle]
9264 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9265 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9266         CResult_COption_MonitorEventZDecodeErrorZ {
9267                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9268                         result: Box::into_raw(Box::new(o)),
9269                 },
9270                 result_ok: true,
9271         }
9272 }
9273 #[no_mangle]
9274 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9275 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9276         CResult_COption_MonitorEventZDecodeErrorZ {
9277                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9278                         err: Box::into_raw(Box::new(e)),
9279                 },
9280                 result_ok: false,
9281         }
9282 }
9283 /// Checks if the given object is currently in the success state
9284 #[no_mangle]
9285 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9286         o.result_ok
9287 }
9288 #[no_mangle]
9289 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9290 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9291 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9292         fn drop(&mut self) {
9293                 if self.result_ok {
9294                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9295                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9296                         }
9297                 } else {
9298                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9299                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9300                         }
9301                 }
9302         }
9303 }
9304 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9305         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9306                 let contents = if o.result_ok {
9307                         let result = unsafe { o.contents.result };
9308                         unsafe { o.contents.result = core::ptr::null_mut() };
9309                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9310                 } else {
9311                         let err = unsafe { o.contents.err };
9312                         unsafe { o.contents.err = core::ptr::null_mut(); }
9313                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9314                 };
9315                 Self {
9316                         contents,
9317                         result_ok: o.result_ok,
9318                 }
9319         }
9320 }
9321 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9322         fn clone(&self) -> Self {
9323                 if self.result_ok {
9324                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9325                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9326                         } }
9327                 } else {
9328                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9329                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9330                         } }
9331                 }
9332         }
9333 }
9334 #[no_mangle]
9335 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9336 /// but with all dynamically-allocated buffers duplicated in new buffers.
9337 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9338 #[repr(C)]
9339 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9340 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9341         /// A pointer to the contents in the success state.
9342         /// Reading from this pointer when `result_ok` is not set is undefined.
9343         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9344         /// A pointer to the contents in the error state.
9345         /// Reading from this pointer when `result_ok` is set is undefined.
9346         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9347 }
9348 #[repr(C)]
9349 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9350 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9352 pub struct CResult_HTLCUpdateDecodeErrorZ {
9353         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9354         /// `err` or `result` depending on the state of `result_ok`.
9355         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9356         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9357         pub result_ok: bool,
9358 }
9359 #[no_mangle]
9360 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9361 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9362         CResult_HTLCUpdateDecodeErrorZ {
9363                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9364                         result: Box::into_raw(Box::new(o)),
9365                 },
9366                 result_ok: true,
9367         }
9368 }
9369 #[no_mangle]
9370 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9371 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9372         CResult_HTLCUpdateDecodeErrorZ {
9373                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9374                         err: Box::into_raw(Box::new(e)),
9375                 },
9376                 result_ok: false,
9377         }
9378 }
9379 /// Checks if the given object is currently in the success state
9380 #[no_mangle]
9381 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9382         o.result_ok
9383 }
9384 #[no_mangle]
9385 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9386 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9387 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9388         fn drop(&mut self) {
9389                 if self.result_ok {
9390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9392                         }
9393                 } else {
9394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9396                         }
9397                 }
9398         }
9399 }
9400 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9402                 let contents = if o.result_ok {
9403                         let result = unsafe { o.contents.result };
9404                         unsafe { o.contents.result = core::ptr::null_mut() };
9405                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9406                 } else {
9407                         let err = unsafe { o.contents.err };
9408                         unsafe { o.contents.err = core::ptr::null_mut(); }
9409                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9410                 };
9411                 Self {
9412                         contents,
9413                         result_ok: o.result_ok,
9414                 }
9415         }
9416 }
9417 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9418         fn clone(&self) -> Self {
9419                 if self.result_ok {
9420                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9421                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9422                         } }
9423                 } else {
9424                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9425                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9426                         } }
9427                 }
9428         }
9429 }
9430 #[no_mangle]
9431 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9432 /// but with all dynamically-allocated buffers duplicated in new buffers.
9433 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9434 #[repr(C)]
9435 /// A tuple of 2 elements. See the individual fields for the types contained.
9436 pub struct C2Tuple_OutPointScriptZ {
9437         /// The element at position 0
9438         pub a: crate::lightning::chain::transaction::OutPoint,
9439         /// The element at position 1
9440         pub b: crate::c_types::derived::CVec_u8Z,
9441 }
9442 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9443         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9444                 Self {
9445                         a: tup.0,
9446                         b: tup.1,
9447                 }
9448         }
9449 }
9450 impl C2Tuple_OutPointScriptZ {
9451         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9452                 (self.a, self.b)
9453         }
9454 }
9455 impl Clone for C2Tuple_OutPointScriptZ {
9456         fn clone(&self) -> Self {
9457                 Self {
9458                         a: Clone::clone(&self.a),
9459                         b: Clone::clone(&self.b),
9460                 }
9461         }
9462 }
9463 #[no_mangle]
9464 /// Creates a new tuple which has the same data as `orig`
9465 /// but with all dynamically-allocated buffers duplicated in new buffers.
9466 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9467 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9468 #[no_mangle]
9469 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9470         C2Tuple_OutPointScriptZ { a, b, }
9471 }
9472
9473 #[no_mangle]
9474 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9475 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9476 #[repr(C)]
9477 /// A tuple of 2 elements. See the individual fields for the types contained.
9478 pub struct C2Tuple_u32ScriptZ {
9479         /// The element at position 0
9480         pub a: u32,
9481         /// The element at position 1
9482         pub b: crate::c_types::derived::CVec_u8Z,
9483 }
9484 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9485         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9486                 Self {
9487                         a: tup.0,
9488                         b: tup.1,
9489                 }
9490         }
9491 }
9492 impl C2Tuple_u32ScriptZ {
9493         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9494                 (self.a, self.b)
9495         }
9496 }
9497 impl Clone for C2Tuple_u32ScriptZ {
9498         fn clone(&self) -> Self {
9499                 Self {
9500                         a: Clone::clone(&self.a),
9501                         b: Clone::clone(&self.b),
9502                 }
9503         }
9504 }
9505 #[no_mangle]
9506 /// Creates a new tuple which has the same data as `orig`
9507 /// but with all dynamically-allocated buffers duplicated in new buffers.
9508 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9509 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9510 #[no_mangle]
9511 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9512         C2Tuple_u32ScriptZ { a, b, }
9513 }
9514
9515 #[no_mangle]
9516 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9517 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9518 #[repr(C)]
9519 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9520 /// This corresponds to std::vector in C++
9521 pub struct CVec_C2Tuple_u32ScriptZZ {
9522         /// The elements in the array.
9523         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9524         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9525         /// The number of elements pointed to by `data`.
9526         pub datalen: usize
9527 }
9528 impl CVec_C2Tuple_u32ScriptZZ {
9529         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9530                 if self.datalen == 0 { return Vec::new(); }
9531                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9532                 self.data = core::ptr::null_mut();
9533                 self.datalen = 0;
9534                 ret
9535         }
9536         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9537                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9538         }
9539 }
9540 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9541         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9542                 let datalen = v.len();
9543                 let data = Box::into_raw(v.into_boxed_slice());
9544                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9545         }
9546 }
9547 #[no_mangle]
9548 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9549 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9550 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9551         fn drop(&mut self) {
9552                 if self.datalen == 0 { return; }
9553                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9554         }
9555 }
9556 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9557         fn clone(&self) -> Self {
9558                 let mut res = Vec::new();
9559                 if self.datalen == 0 { return Self::from(res); }
9560                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9561                 Self::from(res)
9562         }
9563 }
9564 #[repr(C)]
9565 /// A tuple of 2 elements. See the individual fields for the types contained.
9566 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9567         /// The element at position 0
9568         pub a: crate::c_types::ThirtyTwoBytes,
9569         /// The element at position 1
9570         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9571 }
9572 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9573         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9574                 Self {
9575                         a: tup.0,
9576                         b: tup.1,
9577                 }
9578         }
9579 }
9580 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9581         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9582                 (self.a, self.b)
9583         }
9584 }
9585 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9586         fn clone(&self) -> Self {
9587                 Self {
9588                         a: Clone::clone(&self.a),
9589                         b: Clone::clone(&self.b),
9590                 }
9591         }
9592 }
9593 #[no_mangle]
9594 /// Creates a new tuple which has the same data as `orig`
9595 /// but with all dynamically-allocated buffers duplicated in new buffers.
9596 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9597 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9598 #[no_mangle]
9599 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 {
9600         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9601 }
9602
9603 #[no_mangle]
9604 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9605 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9606 #[repr(C)]
9607 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9608 /// This corresponds to std::vector in C++
9609 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9610         /// The elements in the array.
9611         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9612         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9613         /// The number of elements pointed to by `data`.
9614         pub datalen: usize
9615 }
9616 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9617         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9618                 if self.datalen == 0 { return Vec::new(); }
9619                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9620                 self.data = core::ptr::null_mut();
9621                 self.datalen = 0;
9622                 ret
9623         }
9624         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9625                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9626         }
9627 }
9628 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9629         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9630                 let datalen = v.len();
9631                 let data = Box::into_raw(v.into_boxed_slice());
9632                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9633         }
9634 }
9635 #[no_mangle]
9636 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9637 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9638 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9639         fn drop(&mut self) {
9640                 if self.datalen == 0 { return; }
9641                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9642         }
9643 }
9644 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9645         fn clone(&self) -> Self {
9646                 let mut res = Vec::new();
9647                 if self.datalen == 0 { return Self::from(res); }
9648                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9649                 Self::from(res)
9650         }
9651 }
9652 #[repr(C)]
9653 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9654 /// This corresponds to std::vector in C++
9655 pub struct CVec_EventZ {
9656         /// The elements in the array.
9657         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9658         pub data: *mut crate::lightning::util::events::Event,
9659         /// The number of elements pointed to by `data`.
9660         pub datalen: usize
9661 }
9662 impl CVec_EventZ {
9663         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9664                 if self.datalen == 0 { return Vec::new(); }
9665                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9666                 self.data = core::ptr::null_mut();
9667                 self.datalen = 0;
9668                 ret
9669         }
9670         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9671                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9672         }
9673 }
9674 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9675         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9676                 let datalen = v.len();
9677                 let data = Box::into_raw(v.into_boxed_slice());
9678                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9679         }
9680 }
9681 #[no_mangle]
9682 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9683 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9684 impl Drop for CVec_EventZ {
9685         fn drop(&mut self) {
9686                 if self.datalen == 0 { return; }
9687                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9688         }
9689 }
9690 impl Clone for CVec_EventZ {
9691         fn clone(&self) -> Self {
9692                 let mut res = Vec::new();
9693                 if self.datalen == 0 { return Self::from(res); }
9694                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9695                 Self::from(res)
9696         }
9697 }
9698 #[repr(C)]
9699 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9700 /// This corresponds to std::vector in C++
9701 pub struct CVec_TransactionZ {
9702         /// The elements in the array.
9703         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9704         pub data: *mut crate::c_types::Transaction,
9705         /// The number of elements pointed to by `data`.
9706         pub datalen: usize
9707 }
9708 impl CVec_TransactionZ {
9709         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9710                 if self.datalen == 0 { return Vec::new(); }
9711                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9712                 self.data = core::ptr::null_mut();
9713                 self.datalen = 0;
9714                 ret
9715         }
9716         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9717                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9718         }
9719 }
9720 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9721         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9722                 let datalen = v.len();
9723                 let data = Box::into_raw(v.into_boxed_slice());
9724                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9725         }
9726 }
9727 #[no_mangle]
9728 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9729 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9730 impl Drop for CVec_TransactionZ {
9731         fn drop(&mut self) {
9732                 if self.datalen == 0 { return; }
9733                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9734         }
9735 }
9736 impl Clone for CVec_TransactionZ {
9737         fn clone(&self) -> Self {
9738                 let mut res = Vec::new();
9739                 if self.datalen == 0 { return Self::from(res); }
9740                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9741                 Self::from(res)
9742         }
9743 }
9744 #[repr(C)]
9745 /// A tuple of 2 elements. See the individual fields for the types contained.
9746 pub struct C2Tuple_u32TxOutZ {
9747         /// The element at position 0
9748         pub a: u32,
9749         /// The element at position 1
9750         pub b: crate::c_types::TxOut,
9751 }
9752 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9753         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9754                 Self {
9755                         a: tup.0,
9756                         b: tup.1,
9757                 }
9758         }
9759 }
9760 impl C2Tuple_u32TxOutZ {
9761         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9762                 (self.a, self.b)
9763         }
9764 }
9765 impl Clone for C2Tuple_u32TxOutZ {
9766         fn clone(&self) -> Self {
9767                 Self {
9768                         a: Clone::clone(&self.a),
9769                         b: Clone::clone(&self.b),
9770                 }
9771         }
9772 }
9773 #[no_mangle]
9774 /// Creates a new tuple which has the same data as `orig`
9775 /// but with all dynamically-allocated buffers duplicated in new buffers.
9776 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9777 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9778 #[no_mangle]
9779 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9780         C2Tuple_u32TxOutZ { a, b, }
9781 }
9782
9783 #[no_mangle]
9784 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9785 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9786 #[repr(C)]
9787 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9788 /// This corresponds to std::vector in C++
9789 pub struct CVec_C2Tuple_u32TxOutZZ {
9790         /// The elements in the array.
9791         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9792         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9793         /// The number of elements pointed to by `data`.
9794         pub datalen: usize
9795 }
9796 impl CVec_C2Tuple_u32TxOutZZ {
9797         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9798                 if self.datalen == 0 { return Vec::new(); }
9799                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9800                 self.data = core::ptr::null_mut();
9801                 self.datalen = 0;
9802                 ret
9803         }
9804         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9805                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9806         }
9807 }
9808 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9809         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9810                 let datalen = v.len();
9811                 let data = Box::into_raw(v.into_boxed_slice());
9812                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9813         }
9814 }
9815 #[no_mangle]
9816 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9817 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9818 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9819         fn drop(&mut self) {
9820                 if self.datalen == 0 { return; }
9821                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9822         }
9823 }
9824 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9825         fn clone(&self) -> Self {
9826                 let mut res = Vec::new();
9827                 if self.datalen == 0 { return Self::from(res); }
9828                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9829                 Self::from(res)
9830         }
9831 }
9832 #[repr(C)]
9833 /// A tuple of 2 elements. See the individual fields for the types contained.
9834 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9835         /// The element at position 0
9836         pub a: crate::c_types::ThirtyTwoBytes,
9837         /// The element at position 1
9838         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9839 }
9840 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9841         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9842                 Self {
9843                         a: tup.0,
9844                         b: tup.1,
9845                 }
9846         }
9847 }
9848 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9849         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9850                 (self.a, self.b)
9851         }
9852 }
9853 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9854         fn clone(&self) -> Self {
9855                 Self {
9856                         a: Clone::clone(&self.a),
9857                         b: Clone::clone(&self.b),
9858                 }
9859         }
9860 }
9861 #[no_mangle]
9862 /// Creates a new tuple which has the same data as `orig`
9863 /// but with all dynamically-allocated buffers duplicated in new buffers.
9864 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9865 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9866 #[no_mangle]
9867 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 {
9868         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9869 }
9870
9871 #[no_mangle]
9872 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9873 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9874 #[repr(C)]
9875 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9876 /// This corresponds to std::vector in C++
9877 pub struct CVec_TransactionOutputsZ {
9878         /// The elements in the array.
9879         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9880         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9881         /// The number of elements pointed to by `data`.
9882         pub datalen: usize
9883 }
9884 impl CVec_TransactionOutputsZ {
9885         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9886                 if self.datalen == 0 { return Vec::new(); }
9887                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9888                 self.data = core::ptr::null_mut();
9889                 self.datalen = 0;
9890                 ret
9891         }
9892         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9893                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9894         }
9895 }
9896 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9897         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9898                 let datalen = v.len();
9899                 let data = Box::into_raw(v.into_boxed_slice());
9900                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9901         }
9902 }
9903 #[no_mangle]
9904 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9905 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9906 impl Drop for CVec_TransactionOutputsZ {
9907         fn drop(&mut self) {
9908                 if self.datalen == 0 { return; }
9909                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9910         }
9911 }
9912 impl Clone for CVec_TransactionOutputsZ {
9913         fn clone(&self) -> Self {
9914                 let mut res = Vec::new();
9915                 if self.datalen == 0 { return Self::from(res); }
9916                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9917                 Self::from(res)
9918         }
9919 }
9920 #[repr(C)]
9921 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9922 /// This corresponds to std::vector in C++
9923 pub struct CVec_BalanceZ {
9924         /// The elements in the array.
9925         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9926         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9927         /// The number of elements pointed to by `data`.
9928         pub datalen: usize
9929 }
9930 impl CVec_BalanceZ {
9931         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9932                 if self.datalen == 0 { return Vec::new(); }
9933                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9934                 self.data = core::ptr::null_mut();
9935                 self.datalen = 0;
9936                 ret
9937         }
9938         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9939                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9940         }
9941 }
9942 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9943         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9944                 let datalen = v.len();
9945                 let data = Box::into_raw(v.into_boxed_slice());
9946                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9947         }
9948 }
9949 #[no_mangle]
9950 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9951 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9952 impl Drop for CVec_BalanceZ {
9953         fn drop(&mut self) {
9954                 if self.datalen == 0 { return; }
9955                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9956         }
9957 }
9958 impl Clone for CVec_BalanceZ {
9959         fn clone(&self) -> Self {
9960                 let mut res = Vec::new();
9961                 if self.datalen == 0 { return Self::from(res); }
9962                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9963                 Self::from(res)
9964         }
9965 }
9966 #[repr(C)]
9967 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9968 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9969         /// A pointer to the contents in the success state.
9970         /// Reading from this pointer when `result_ok` is not set is undefined.
9971         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9972         /// A pointer to the contents in the error state.
9973         /// Reading from this pointer when `result_ok` is set is undefined.
9974         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9975 }
9976 #[repr(C)]
9977 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9978 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9979 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9980 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9981         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9982         /// `err` or `result` depending on the state of `result_ok`.
9983         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9984         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9985         pub result_ok: bool,
9986 }
9987 #[no_mangle]
9988 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9989 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9990         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9991                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9992                         result: Box::into_raw(Box::new(o)),
9993                 },
9994                 result_ok: true,
9995         }
9996 }
9997 #[no_mangle]
9998 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9999 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10000         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10001                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
10002                         err: Box::into_raw(Box::new(e)),
10003                 },
10004                 result_ok: false,
10005         }
10006 }
10007 /// Checks if the given object is currently in the success state
10008 #[no_mangle]
10009 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
10010         o.result_ok
10011 }
10012 #[no_mangle]
10013 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10014 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
10015 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10016         fn drop(&mut self) {
10017                 if self.result_ok {
10018                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10019                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10020                         }
10021                 } else {
10022                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10023                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10024                         }
10025                 }
10026         }
10027 }
10028 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
10029         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10030                 let contents = if o.result_ok {
10031                         let result = unsafe { o.contents.result };
10032                         unsafe { o.contents.result = core::ptr::null_mut() };
10033                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
10034                 } else {
10035                         let err = unsafe { o.contents.err };
10036                         unsafe { o.contents.err = core::ptr::null_mut(); }
10037                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
10038                 };
10039                 Self {
10040                         contents,
10041                         result_ok: o.result_ok,
10042                 }
10043         }
10044 }
10045 #[repr(C)]
10046 /// The contents of CResult_NoneLightningErrorZ
10047 pub union CResult_NoneLightningErrorZPtr {
10048         /// Note that this value is always NULL, as there are no contents in the OK variant
10049         pub result: *mut core::ffi::c_void,
10050         /// A pointer to the contents in the error state.
10051         /// Reading from this pointer when `result_ok` is set is undefined.
10052         pub err: *mut crate::lightning::ln::msgs::LightningError,
10053 }
10054 #[repr(C)]
10055 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
10056 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
10057 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10058 pub struct CResult_NoneLightningErrorZ {
10059         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
10060         /// `err` or `result` depending on the state of `result_ok`.
10061         pub contents: CResult_NoneLightningErrorZPtr,
10062         /// Whether this CResult_NoneLightningErrorZ represents a success state.
10063         pub result_ok: bool,
10064 }
10065 #[no_mangle]
10066 /// Creates a new CResult_NoneLightningErrorZ in the success state.
10067 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10068         CResult_NoneLightningErrorZ {
10069                 contents: CResult_NoneLightningErrorZPtr {
10070                         result: core::ptr::null_mut(),
10071                 },
10072                 result_ok: true,
10073         }
10074 }
10075 #[no_mangle]
10076 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10077 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10078         CResult_NoneLightningErrorZ {
10079                 contents: CResult_NoneLightningErrorZPtr {
10080                         err: Box::into_raw(Box::new(e)),
10081                 },
10082                 result_ok: false,
10083         }
10084 }
10085 /// Checks if the given object is currently in the success state
10086 #[no_mangle]
10087 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10088         o.result_ok
10089 }
10090 #[no_mangle]
10091 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10092 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10093 impl Drop for CResult_NoneLightningErrorZ {
10094         fn drop(&mut self) {
10095                 if self.result_ok {
10096                 } else {
10097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10099                         }
10100                 }
10101         }
10102 }
10103 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10104         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10105                 let contents = if o.result_ok {
10106                         let _ = unsafe { Box::from_raw(o.contents.result) };
10107                         o.contents.result = core::ptr::null_mut();
10108                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10109                 } else {
10110                         let err = unsafe { o.contents.err };
10111                         unsafe { o.contents.err = core::ptr::null_mut(); }
10112                         CResult_NoneLightningErrorZPtr { err }
10113                 };
10114                 Self {
10115                         contents,
10116                         result_ok: o.result_ok,
10117                 }
10118         }
10119 }
10120 impl Clone for CResult_NoneLightningErrorZ {
10121         fn clone(&self) -> Self {
10122                 if self.result_ok {
10123                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10124                                 result: core::ptr::null_mut()
10125                         } }
10126                 } else {
10127                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10129                         } }
10130                 }
10131         }
10132 }
10133 #[no_mangle]
10134 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10135 /// but with all dynamically-allocated buffers duplicated in new buffers.
10136 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10137 #[repr(C)]
10138 /// A tuple of 2 elements. See the individual fields for the types contained.
10139 pub struct C2Tuple_PublicKeyTypeZ {
10140         /// The element at position 0
10141         pub a: crate::c_types::PublicKey,
10142         /// The element at position 1
10143         pub b: crate::lightning::ln::wire::Type,
10144 }
10145 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10146         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10147                 Self {
10148                         a: tup.0,
10149                         b: tup.1,
10150                 }
10151         }
10152 }
10153 impl C2Tuple_PublicKeyTypeZ {
10154         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10155                 (self.a, self.b)
10156         }
10157 }
10158 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10159 #[no_mangle]
10160 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10161         C2Tuple_PublicKeyTypeZ { a, b, }
10162 }
10163
10164 #[no_mangle]
10165 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10166 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10167 #[repr(C)]
10168 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10169 /// This corresponds to std::vector in C++
10170 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10171         /// The elements in the array.
10172         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10173         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10174         /// The number of elements pointed to by `data`.
10175         pub datalen: usize
10176 }
10177 impl CVec_C2Tuple_PublicKeyTypeZZ {
10178         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10179                 if self.datalen == 0 { return Vec::new(); }
10180                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10181                 self.data = core::ptr::null_mut();
10182                 self.datalen = 0;
10183                 ret
10184         }
10185         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10186                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10187         }
10188 }
10189 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10190         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10191                 let datalen = v.len();
10192                 let data = Box::into_raw(v.into_boxed_slice());
10193                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10194         }
10195 }
10196 #[no_mangle]
10197 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10198 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10199 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10200         fn drop(&mut self) {
10201                 if self.datalen == 0 { return; }
10202                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10203         }
10204 }
10205 #[repr(C)]
10206 /// The contents of CResult_boolLightningErrorZ
10207 pub union CResult_boolLightningErrorZPtr {
10208         /// A pointer to the contents in the success state.
10209         /// Reading from this pointer when `result_ok` is not set is undefined.
10210         pub result: *mut bool,
10211         /// A pointer to the contents in the error state.
10212         /// Reading from this pointer when `result_ok` is set is undefined.
10213         pub err: *mut crate::lightning::ln::msgs::LightningError,
10214 }
10215 #[repr(C)]
10216 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10217 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10219 pub struct CResult_boolLightningErrorZ {
10220         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10221         /// `err` or `result` depending on the state of `result_ok`.
10222         pub contents: CResult_boolLightningErrorZPtr,
10223         /// Whether this CResult_boolLightningErrorZ represents a success state.
10224         pub result_ok: bool,
10225 }
10226 #[no_mangle]
10227 /// Creates a new CResult_boolLightningErrorZ in the success state.
10228 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10229         CResult_boolLightningErrorZ {
10230                 contents: CResult_boolLightningErrorZPtr {
10231                         result: Box::into_raw(Box::new(o)),
10232                 },
10233                 result_ok: true,
10234         }
10235 }
10236 #[no_mangle]
10237 /// Creates a new CResult_boolLightningErrorZ in the error state.
10238 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10239         CResult_boolLightningErrorZ {
10240                 contents: CResult_boolLightningErrorZPtr {
10241                         err: Box::into_raw(Box::new(e)),
10242                 },
10243                 result_ok: false,
10244         }
10245 }
10246 /// Checks if the given object is currently in the success state
10247 #[no_mangle]
10248 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10249         o.result_ok
10250 }
10251 #[no_mangle]
10252 /// Frees any resources used by the CResult_boolLightningErrorZ.
10253 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10254 impl Drop for CResult_boolLightningErrorZ {
10255         fn drop(&mut self) {
10256                 if self.result_ok {
10257                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10258                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10259                         }
10260                 } else {
10261                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10262                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10263                         }
10264                 }
10265         }
10266 }
10267 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10268         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10269                 let contents = if o.result_ok {
10270                         let result = unsafe { o.contents.result };
10271                         unsafe { o.contents.result = core::ptr::null_mut() };
10272                         CResult_boolLightningErrorZPtr { result }
10273                 } else {
10274                         let err = unsafe { o.contents.err };
10275                         unsafe { o.contents.err = core::ptr::null_mut(); }
10276                         CResult_boolLightningErrorZPtr { err }
10277                 };
10278                 Self {
10279                         contents,
10280                         result_ok: o.result_ok,
10281                 }
10282         }
10283 }
10284 impl Clone for CResult_boolLightningErrorZ {
10285         fn clone(&self) -> Self {
10286                 if self.result_ok {
10287                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10288                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10289                         } }
10290                 } else {
10291                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10292                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10293                         } }
10294                 }
10295         }
10296 }
10297 #[no_mangle]
10298 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10299 /// but with all dynamically-allocated buffers duplicated in new buffers.
10300 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10301 #[repr(C)]
10302 /// A tuple of 3 elements. See the individual fields for the types contained.
10303 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10304         /// The element at position 0
10305         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10306         /// The element at position 1
10307         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10308         /// The element at position 2
10309         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10310 }
10311 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10312         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10313                 Self {
10314                         a: tup.0,
10315                         b: tup.1,
10316                         c: tup.2,
10317                 }
10318         }
10319 }
10320 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10321         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10322                 (self.a, self.b, self.c)
10323         }
10324 }
10325 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10326         fn clone(&self) -> Self {
10327                 Self {
10328                         a: Clone::clone(&self.a),
10329                         b: Clone::clone(&self.b),
10330                         c: Clone::clone(&self.c),
10331                 }
10332         }
10333 }
10334 #[no_mangle]
10335 /// Creates a new tuple which has the same data as `orig`
10336 /// but with all dynamically-allocated buffers duplicated in new buffers.
10337 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10338 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10339 #[no_mangle]
10340 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 {
10341         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10342 }
10343
10344 #[no_mangle]
10345 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10346 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10347 #[repr(C)]
10348 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10349 /// This corresponds to std::vector in C++
10350 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10351         /// The elements in the array.
10352         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10353         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10354         /// The number of elements pointed to by `data`.
10355         pub datalen: usize
10356 }
10357 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10358         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10359                 if self.datalen == 0 { return Vec::new(); }
10360                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10361                 self.data = core::ptr::null_mut();
10362                 self.datalen = 0;
10363                 ret
10364         }
10365         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10366                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10367         }
10368 }
10369 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10370         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10371                 let datalen = v.len();
10372                 let data = Box::into_raw(v.into_boxed_slice());
10373                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10374         }
10375 }
10376 #[no_mangle]
10377 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10378 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10379 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10380         fn drop(&mut self) {
10381                 if self.datalen == 0 { return; }
10382                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10383         }
10384 }
10385 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10386         fn clone(&self) -> Self {
10387                 let mut res = Vec::new();
10388                 if self.datalen == 0 { return Self::from(res); }
10389                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10390                 Self::from(res)
10391         }
10392 }
10393 #[repr(C)]
10394 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10395 /// This corresponds to std::vector in C++
10396 pub struct CVec_NodeAnnouncementZ {
10397         /// The elements in the array.
10398         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10399         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10400         /// The number of elements pointed to by `data`.
10401         pub datalen: usize
10402 }
10403 impl CVec_NodeAnnouncementZ {
10404         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10405                 if self.datalen == 0 { return Vec::new(); }
10406                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10407                 self.data = core::ptr::null_mut();
10408                 self.datalen = 0;
10409                 ret
10410         }
10411         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10412                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10413         }
10414 }
10415 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10416         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10417                 let datalen = v.len();
10418                 let data = Box::into_raw(v.into_boxed_slice());
10419                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10420         }
10421 }
10422 #[no_mangle]
10423 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10424 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10425 impl Drop for CVec_NodeAnnouncementZ {
10426         fn drop(&mut self) {
10427                 if self.datalen == 0 { return; }
10428                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10429         }
10430 }
10431 impl Clone for CVec_NodeAnnouncementZ {
10432         fn clone(&self) -> Self {
10433                 let mut res = Vec::new();
10434                 if self.datalen == 0 { return Self::from(res); }
10435                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10436                 Self::from(res)
10437         }
10438 }
10439 #[repr(C)]
10440 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10441 /// This corresponds to std::vector in C++
10442 pub struct CVec_PublicKeyZ {
10443         /// The elements in the array.
10444         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10445         pub data: *mut crate::c_types::PublicKey,
10446         /// The number of elements pointed to by `data`.
10447         pub datalen: usize
10448 }
10449 impl CVec_PublicKeyZ {
10450         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10451                 if self.datalen == 0 { return Vec::new(); }
10452                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10453                 self.data = core::ptr::null_mut();
10454                 self.datalen = 0;
10455                 ret
10456         }
10457         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10458                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10459         }
10460 }
10461 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10462         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10463                 let datalen = v.len();
10464                 let data = Box::into_raw(v.into_boxed_slice());
10465                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10466         }
10467 }
10468 #[no_mangle]
10469 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10470 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10471 impl Drop for CVec_PublicKeyZ {
10472         fn drop(&mut self) {
10473                 if self.datalen == 0 { return; }
10474                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10475         }
10476 }
10477 impl Clone for CVec_PublicKeyZ {
10478         fn clone(&self) -> Self {
10479                 let mut res = Vec::new();
10480                 if self.datalen == 0 { return Self::from(res); }
10481                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10482                 Self::from(res)
10483         }
10484 }
10485 #[repr(C)]
10486 #[derive(Clone)]
10487 /// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
10488 pub enum COption_NetAddressZ {
10489         /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
10490         Some(crate::lightning::ln::msgs::NetAddress),
10491         /// When we're in this state, this COption_NetAddressZ contains nothing
10492         None
10493 }
10494 impl COption_NetAddressZ {
10495         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10496                 if let Self::None = self { false } else { true }
10497         }
10498         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10499                 !self.is_some()
10500         }
10501         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress {
10502                 if let Self::Some(v) = self { v } else { unreachable!() }
10503         }
10504 }
10505 #[no_mangle]
10506 /// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
10507 pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ {
10508         COption_NetAddressZ::Some(o)
10509 }
10510 #[no_mangle]
10511 /// Constructs a new COption_NetAddressZ containing nothing
10512 pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ {
10513         COption_NetAddressZ::None
10514 }
10515 #[no_mangle]
10516 /// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
10517 pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { }
10518 #[no_mangle]
10519 /// Creates a new COption_NetAddressZ which has the same data as `orig`
10520 /// but with all dynamically-allocated buffers duplicated in new buffers.
10521 pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) }
10522 #[repr(C)]
10523 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10524 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10525         /// A pointer to the contents in the success state.
10526         /// Reading from this pointer when `result_ok` is not set is undefined.
10527         pub result: *mut crate::c_types::derived::CVec_u8Z,
10528         /// A pointer to the contents in the error state.
10529         /// Reading from this pointer when `result_ok` is set is undefined.
10530         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10531 }
10532 #[repr(C)]
10533 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10534 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10535 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10536 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10537         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10538         /// `err` or `result` depending on the state of `result_ok`.
10539         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10540         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10541         pub result_ok: bool,
10542 }
10543 #[no_mangle]
10544 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10545 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10546         CResult_CVec_u8ZPeerHandleErrorZ {
10547                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10548                         result: Box::into_raw(Box::new(o)),
10549                 },
10550                 result_ok: true,
10551         }
10552 }
10553 #[no_mangle]
10554 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10555 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10556         CResult_CVec_u8ZPeerHandleErrorZ {
10557                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10558                         err: Box::into_raw(Box::new(e)),
10559                 },
10560                 result_ok: false,
10561         }
10562 }
10563 /// Checks if the given object is currently in the success state
10564 #[no_mangle]
10565 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10566         o.result_ok
10567 }
10568 #[no_mangle]
10569 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10570 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10571 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10572         fn drop(&mut self) {
10573                 if self.result_ok {
10574                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10575                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10576                         }
10577                 } else {
10578                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10579                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10580                         }
10581                 }
10582         }
10583 }
10584 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10585         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10586                 let contents = if o.result_ok {
10587                         let result = unsafe { o.contents.result };
10588                         unsafe { o.contents.result = core::ptr::null_mut() };
10589                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10590                 } else {
10591                         let err = unsafe { o.contents.err };
10592                         unsafe { o.contents.err = core::ptr::null_mut(); }
10593                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10594                 };
10595                 Self {
10596                         contents,
10597                         result_ok: o.result_ok,
10598                 }
10599         }
10600 }
10601 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10602         fn clone(&self) -> Self {
10603                 if self.result_ok {
10604                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10605                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10606                         } }
10607                 } else {
10608                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10609                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10610                         } }
10611                 }
10612         }
10613 }
10614 #[no_mangle]
10615 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10616 /// but with all dynamically-allocated buffers duplicated in new buffers.
10617 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10618 #[repr(C)]
10619 /// The contents of CResult_NonePeerHandleErrorZ
10620 pub union CResult_NonePeerHandleErrorZPtr {
10621         /// Note that this value is always NULL, as there are no contents in the OK variant
10622         pub result: *mut core::ffi::c_void,
10623         /// A pointer to the contents in the error state.
10624         /// Reading from this pointer when `result_ok` is set is undefined.
10625         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10626 }
10627 #[repr(C)]
10628 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10629 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10630 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10631 pub struct CResult_NonePeerHandleErrorZ {
10632         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10633         /// `err` or `result` depending on the state of `result_ok`.
10634         pub contents: CResult_NonePeerHandleErrorZPtr,
10635         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10636         pub result_ok: bool,
10637 }
10638 #[no_mangle]
10639 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10640 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10641         CResult_NonePeerHandleErrorZ {
10642                 contents: CResult_NonePeerHandleErrorZPtr {
10643                         result: core::ptr::null_mut(),
10644                 },
10645                 result_ok: true,
10646         }
10647 }
10648 #[no_mangle]
10649 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10650 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10651         CResult_NonePeerHandleErrorZ {
10652                 contents: CResult_NonePeerHandleErrorZPtr {
10653                         err: Box::into_raw(Box::new(e)),
10654                 },
10655                 result_ok: false,
10656         }
10657 }
10658 /// Checks if the given object is currently in the success state
10659 #[no_mangle]
10660 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10661         o.result_ok
10662 }
10663 #[no_mangle]
10664 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10665 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10666 impl Drop for CResult_NonePeerHandleErrorZ {
10667         fn drop(&mut self) {
10668                 if self.result_ok {
10669                 } else {
10670                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10671                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10672                         }
10673                 }
10674         }
10675 }
10676 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10677         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10678                 let contents = if o.result_ok {
10679                         let _ = unsafe { Box::from_raw(o.contents.result) };
10680                         o.contents.result = core::ptr::null_mut();
10681                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10682                 } else {
10683                         let err = unsafe { o.contents.err };
10684                         unsafe { o.contents.err = core::ptr::null_mut(); }
10685                         CResult_NonePeerHandleErrorZPtr { err }
10686                 };
10687                 Self {
10688                         contents,
10689                         result_ok: o.result_ok,
10690                 }
10691         }
10692 }
10693 impl Clone for CResult_NonePeerHandleErrorZ {
10694         fn clone(&self) -> Self {
10695                 if self.result_ok {
10696                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10697                                 result: core::ptr::null_mut()
10698                         } }
10699                 } else {
10700                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10701                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10702                         } }
10703                 }
10704         }
10705 }
10706 #[no_mangle]
10707 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10708 /// but with all dynamically-allocated buffers duplicated in new buffers.
10709 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10710 #[repr(C)]
10711 /// The contents of CResult_boolPeerHandleErrorZ
10712 pub union CResult_boolPeerHandleErrorZPtr {
10713         /// A pointer to the contents in the success state.
10714         /// Reading from this pointer when `result_ok` is not set is undefined.
10715         pub result: *mut bool,
10716         /// A pointer to the contents in the error state.
10717         /// Reading from this pointer when `result_ok` is set is undefined.
10718         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10719 }
10720 #[repr(C)]
10721 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10722 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10723 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10724 pub struct CResult_boolPeerHandleErrorZ {
10725         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10726         /// `err` or `result` depending on the state of `result_ok`.
10727         pub contents: CResult_boolPeerHandleErrorZPtr,
10728         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10729         pub result_ok: bool,
10730 }
10731 #[no_mangle]
10732 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10733 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10734         CResult_boolPeerHandleErrorZ {
10735                 contents: CResult_boolPeerHandleErrorZPtr {
10736                         result: Box::into_raw(Box::new(o)),
10737                 },
10738                 result_ok: true,
10739         }
10740 }
10741 #[no_mangle]
10742 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10743 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10744         CResult_boolPeerHandleErrorZ {
10745                 contents: CResult_boolPeerHandleErrorZPtr {
10746                         err: Box::into_raw(Box::new(e)),
10747                 },
10748                 result_ok: false,
10749         }
10750 }
10751 /// Checks if the given object is currently in the success state
10752 #[no_mangle]
10753 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10754         o.result_ok
10755 }
10756 #[no_mangle]
10757 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10758 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10759 impl Drop for CResult_boolPeerHandleErrorZ {
10760         fn drop(&mut self) {
10761                 if self.result_ok {
10762                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10763                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10764                         }
10765                 } else {
10766                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10767                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10768                         }
10769                 }
10770         }
10771 }
10772 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10773         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10774                 let contents = if o.result_ok {
10775                         let result = unsafe { o.contents.result };
10776                         unsafe { o.contents.result = core::ptr::null_mut() };
10777                         CResult_boolPeerHandleErrorZPtr { result }
10778                 } else {
10779                         let err = unsafe { o.contents.err };
10780                         unsafe { o.contents.err = core::ptr::null_mut(); }
10781                         CResult_boolPeerHandleErrorZPtr { err }
10782                 };
10783                 Self {
10784                         contents,
10785                         result_ok: o.result_ok,
10786                 }
10787         }
10788 }
10789 impl Clone for CResult_boolPeerHandleErrorZ {
10790         fn clone(&self) -> Self {
10791                 if self.result_ok {
10792                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10793                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10794                         } }
10795                 } else {
10796                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10797                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10798                         } }
10799                 }
10800         }
10801 }
10802 #[no_mangle]
10803 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10804 /// but with all dynamically-allocated buffers duplicated in new buffers.
10805 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10806 #[repr(C)]
10807 /// The contents of CResult_NodeIdDecodeErrorZ
10808 pub union CResult_NodeIdDecodeErrorZPtr {
10809         /// A pointer to the contents in the success state.
10810         /// Reading from this pointer when `result_ok` is not set is undefined.
10811         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10812         /// A pointer to the contents in the error state.
10813         /// Reading from this pointer when `result_ok` is set is undefined.
10814         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10815 }
10816 #[repr(C)]
10817 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10818 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10819 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10820 pub struct CResult_NodeIdDecodeErrorZ {
10821         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10822         /// `err` or `result` depending on the state of `result_ok`.
10823         pub contents: CResult_NodeIdDecodeErrorZPtr,
10824         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10825         pub result_ok: bool,
10826 }
10827 #[no_mangle]
10828 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10829 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10830         CResult_NodeIdDecodeErrorZ {
10831                 contents: CResult_NodeIdDecodeErrorZPtr {
10832                         result: Box::into_raw(Box::new(o)),
10833                 },
10834                 result_ok: true,
10835         }
10836 }
10837 #[no_mangle]
10838 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10839 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10840         CResult_NodeIdDecodeErrorZ {
10841                 contents: CResult_NodeIdDecodeErrorZPtr {
10842                         err: Box::into_raw(Box::new(e)),
10843                 },
10844                 result_ok: false,
10845         }
10846 }
10847 /// Checks if the given object is currently in the success state
10848 #[no_mangle]
10849 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10850         o.result_ok
10851 }
10852 #[no_mangle]
10853 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10854 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10855 impl Drop for CResult_NodeIdDecodeErrorZ {
10856         fn drop(&mut self) {
10857                 if self.result_ok {
10858                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10859                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10860                         }
10861                 } else {
10862                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10863                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10864                         }
10865                 }
10866         }
10867 }
10868 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10869         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10870                 let contents = if o.result_ok {
10871                         let result = unsafe { o.contents.result };
10872                         unsafe { o.contents.result = core::ptr::null_mut() };
10873                         CResult_NodeIdDecodeErrorZPtr { result }
10874                 } else {
10875                         let err = unsafe { o.contents.err };
10876                         unsafe { o.contents.err = core::ptr::null_mut(); }
10877                         CResult_NodeIdDecodeErrorZPtr { err }
10878                 };
10879                 Self {
10880                         contents,
10881                         result_ok: o.result_ok,
10882                 }
10883         }
10884 }
10885 impl Clone for CResult_NodeIdDecodeErrorZ {
10886         fn clone(&self) -> Self {
10887                 if self.result_ok {
10888                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10889                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10890                         } }
10891                 } else {
10892                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10893                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10894                         } }
10895                 }
10896         }
10897 }
10898 #[no_mangle]
10899 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10900 /// but with all dynamically-allocated buffers duplicated in new buffers.
10901 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10902 #[repr(C)]
10903 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10904 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10905         /// A pointer to the contents in the success state.
10906         /// Reading from this pointer when `result_ok` is not set is undefined.
10907         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10908         /// A pointer to the contents in the error state.
10909         /// Reading from this pointer when `result_ok` is set is undefined.
10910         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10911 }
10912 #[repr(C)]
10913 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10914 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10915 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10916 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10917         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10918         /// `err` or `result` depending on the state of `result_ok`.
10919         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10920         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10921         pub result_ok: bool,
10922 }
10923 #[no_mangle]
10924 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10925 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10926         CResult_COption_NetworkUpdateZDecodeErrorZ {
10927                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10928                         result: Box::into_raw(Box::new(o)),
10929                 },
10930                 result_ok: true,
10931         }
10932 }
10933 #[no_mangle]
10934 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10935 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10936         CResult_COption_NetworkUpdateZDecodeErrorZ {
10937                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10938                         err: Box::into_raw(Box::new(e)),
10939                 },
10940                 result_ok: false,
10941         }
10942 }
10943 /// Checks if the given object is currently in the success state
10944 #[no_mangle]
10945 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10946         o.result_ok
10947 }
10948 #[no_mangle]
10949 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10950 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10951 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10952         fn drop(&mut self) {
10953                 if self.result_ok {
10954                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10955                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10956                         }
10957                 } else {
10958                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10959                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10960                         }
10961                 }
10962         }
10963 }
10964 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10965         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10966                 let contents = if o.result_ok {
10967                         let result = unsafe { o.contents.result };
10968                         unsafe { o.contents.result = core::ptr::null_mut() };
10969                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10970                 } else {
10971                         let err = unsafe { o.contents.err };
10972                         unsafe { o.contents.err = core::ptr::null_mut(); }
10973                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10974                 };
10975                 Self {
10976                         contents,
10977                         result_ok: o.result_ok,
10978                 }
10979         }
10980 }
10981 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10982         fn clone(&self) -> Self {
10983                 if self.result_ok {
10984                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10985                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10986                         } }
10987                 } else {
10988                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10989                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10990                         } }
10991                 }
10992         }
10993 }
10994 #[no_mangle]
10995 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10996 /// but with all dynamically-allocated buffers duplicated in new buffers.
10997 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10998 #[repr(C)]
10999 /// An enum which can either contain a crate::lightning::chain::Access or not
11000 pub enum COption_AccessZ {
11001         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
11002         Some(crate::lightning::chain::Access),
11003         /// When we're in this state, this COption_AccessZ contains nothing
11004         None
11005 }
11006 impl COption_AccessZ {
11007         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11008                 if let Self::None = self { false } else { true }
11009         }
11010         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11011                 !self.is_some()
11012         }
11013         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
11014                 if let Self::Some(v) = self { v } else { unreachable!() }
11015         }
11016 }
11017 #[no_mangle]
11018 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
11019 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
11020         COption_AccessZ::Some(o)
11021 }
11022 #[no_mangle]
11023 /// Constructs a new COption_AccessZ containing nothing
11024 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
11025         COption_AccessZ::None
11026 }
11027 #[no_mangle]
11028 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
11029 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
11030 #[repr(C)]
11031 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
11032 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
11033         /// A pointer to the contents in the success state.
11034         /// Reading from this pointer when `result_ok` is not set is undefined.
11035         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
11036         /// A pointer to the contents in the error state.
11037         /// Reading from this pointer when `result_ok` is set is undefined.
11038         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11039 }
11040 #[repr(C)]
11041 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
11042 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11043 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11044 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
11045         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
11046         /// `err` or `result` depending on the state of `result_ok`.
11047         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
11048         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
11049         pub result_ok: bool,
11050 }
11051 #[no_mangle]
11052 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
11053 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11054         CResult_ChannelUpdateInfoDecodeErrorZ {
11055                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11056                         result: Box::into_raw(Box::new(o)),
11057                 },
11058                 result_ok: true,
11059         }
11060 }
11061 #[no_mangle]
11062 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
11063 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
11064         CResult_ChannelUpdateInfoDecodeErrorZ {
11065                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11066                         err: Box::into_raw(Box::new(e)),
11067                 },
11068                 result_ok: false,
11069         }
11070 }
11071 /// Checks if the given object is currently in the success state
11072 #[no_mangle]
11073 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
11074         o.result_ok
11075 }
11076 #[no_mangle]
11077 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
11078 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
11079 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
11080         fn drop(&mut self) {
11081                 if self.result_ok {
11082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11084                         }
11085                 } else {
11086                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11087                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11088                         }
11089                 }
11090         }
11091 }
11092 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
11093         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11094                 let contents = if o.result_ok {
11095                         let result = unsafe { o.contents.result };
11096                         unsafe { o.contents.result = core::ptr::null_mut() };
11097                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
11098                 } else {
11099                         let err = unsafe { o.contents.err };
11100                         unsafe { o.contents.err = core::ptr::null_mut(); }
11101                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
11102                 };
11103                 Self {
11104                         contents,
11105                         result_ok: o.result_ok,
11106                 }
11107         }
11108 }
11109 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11110         fn clone(&self) -> Self {
11111                 if self.result_ok {
11112                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11113                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11114                         } }
11115                 } else {
11116                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11117                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11118                         } }
11119                 }
11120         }
11121 }
11122 #[no_mangle]
11123 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11124 /// but with all dynamically-allocated buffers duplicated in new buffers.
11125 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11126 #[repr(C)]
11127 /// The contents of CResult_ChannelInfoDecodeErrorZ
11128 pub union CResult_ChannelInfoDecodeErrorZPtr {
11129         /// A pointer to the contents in the success state.
11130         /// Reading from this pointer when `result_ok` is not set is undefined.
11131         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11132         /// A pointer to the contents in the error state.
11133         /// Reading from this pointer when `result_ok` is set is undefined.
11134         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11135 }
11136 #[repr(C)]
11137 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11138 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11139 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11140 pub struct CResult_ChannelInfoDecodeErrorZ {
11141         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11142         /// `err` or `result` depending on the state of `result_ok`.
11143         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11144         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11145         pub result_ok: bool,
11146 }
11147 #[no_mangle]
11148 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11149 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11150         CResult_ChannelInfoDecodeErrorZ {
11151                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11152                         result: Box::into_raw(Box::new(o)),
11153                 },
11154                 result_ok: true,
11155         }
11156 }
11157 #[no_mangle]
11158 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11159 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11160         CResult_ChannelInfoDecodeErrorZ {
11161                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11162                         err: Box::into_raw(Box::new(e)),
11163                 },
11164                 result_ok: false,
11165         }
11166 }
11167 /// Checks if the given object is currently in the success state
11168 #[no_mangle]
11169 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11170         o.result_ok
11171 }
11172 #[no_mangle]
11173 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11174 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11175 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11176         fn drop(&mut self) {
11177                 if self.result_ok {
11178                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11179                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11180                         }
11181                 } else {
11182                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11183                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11184                         }
11185                 }
11186         }
11187 }
11188 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11189         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11190                 let contents = if o.result_ok {
11191                         let result = unsafe { o.contents.result };
11192                         unsafe { o.contents.result = core::ptr::null_mut() };
11193                         CResult_ChannelInfoDecodeErrorZPtr { result }
11194                 } else {
11195                         let err = unsafe { o.contents.err };
11196                         unsafe { o.contents.err = core::ptr::null_mut(); }
11197                         CResult_ChannelInfoDecodeErrorZPtr { err }
11198                 };
11199                 Self {
11200                         contents,
11201                         result_ok: o.result_ok,
11202                 }
11203         }
11204 }
11205 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11206         fn clone(&self) -> Self {
11207                 if self.result_ok {
11208                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11209                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11210                         } }
11211                 } else {
11212                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11213                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11214                         } }
11215                 }
11216         }
11217 }
11218 #[no_mangle]
11219 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11220 /// but with all dynamically-allocated buffers duplicated in new buffers.
11221 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11222 #[repr(C)]
11223 /// The contents of CResult_RoutingFeesDecodeErrorZ
11224 pub union CResult_RoutingFeesDecodeErrorZPtr {
11225         /// A pointer to the contents in the success state.
11226         /// Reading from this pointer when `result_ok` is not set is undefined.
11227         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11228         /// A pointer to the contents in the error state.
11229         /// Reading from this pointer when `result_ok` is set is undefined.
11230         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11231 }
11232 #[repr(C)]
11233 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11234 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11235 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11236 pub struct CResult_RoutingFeesDecodeErrorZ {
11237         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11238         /// `err` or `result` depending on the state of `result_ok`.
11239         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11240         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11241         pub result_ok: bool,
11242 }
11243 #[no_mangle]
11244 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11245 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11246         CResult_RoutingFeesDecodeErrorZ {
11247                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11248                         result: Box::into_raw(Box::new(o)),
11249                 },
11250                 result_ok: true,
11251         }
11252 }
11253 #[no_mangle]
11254 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11255 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11256         CResult_RoutingFeesDecodeErrorZ {
11257                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11258                         err: Box::into_raw(Box::new(e)),
11259                 },
11260                 result_ok: false,
11261         }
11262 }
11263 /// Checks if the given object is currently in the success state
11264 #[no_mangle]
11265 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11266         o.result_ok
11267 }
11268 #[no_mangle]
11269 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11270 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11271 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11272         fn drop(&mut self) {
11273                 if self.result_ok {
11274                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11275                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11276                         }
11277                 } else {
11278                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11279                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11280                         }
11281                 }
11282         }
11283 }
11284 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11285         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11286                 let contents = if o.result_ok {
11287                         let result = unsafe { o.contents.result };
11288                         unsafe { o.contents.result = core::ptr::null_mut() };
11289                         CResult_RoutingFeesDecodeErrorZPtr { result }
11290                 } else {
11291                         let err = unsafe { o.contents.err };
11292                         unsafe { o.contents.err = core::ptr::null_mut(); }
11293                         CResult_RoutingFeesDecodeErrorZPtr { err }
11294                 };
11295                 Self {
11296                         contents,
11297                         result_ok: o.result_ok,
11298                 }
11299         }
11300 }
11301 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11302         fn clone(&self) -> Self {
11303                 if self.result_ok {
11304                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11305                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11306                         } }
11307                 } else {
11308                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11309                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11310                         } }
11311                 }
11312         }
11313 }
11314 #[no_mangle]
11315 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11316 /// but with all dynamically-allocated buffers duplicated in new buffers.
11317 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11318 #[repr(C)]
11319 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11320 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11321         /// A pointer to the contents in the success state.
11322         /// Reading from this pointer when `result_ok` is not set is undefined.
11323         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11324         /// A pointer to the contents in the error state.
11325         /// Reading from this pointer when `result_ok` is set is undefined.
11326         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11327 }
11328 #[repr(C)]
11329 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11330 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11332 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11333         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11334         /// `err` or `result` depending on the state of `result_ok`.
11335         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11336         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11337         pub result_ok: bool,
11338 }
11339 #[no_mangle]
11340 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11341 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11342         CResult_NodeAnnouncementInfoDecodeErrorZ {
11343                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11344                         result: Box::into_raw(Box::new(o)),
11345                 },
11346                 result_ok: true,
11347         }
11348 }
11349 #[no_mangle]
11350 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11351 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11352         CResult_NodeAnnouncementInfoDecodeErrorZ {
11353                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11354                         err: Box::into_raw(Box::new(e)),
11355                 },
11356                 result_ok: false,
11357         }
11358 }
11359 /// Checks if the given object is currently in the success state
11360 #[no_mangle]
11361 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11362         o.result_ok
11363 }
11364 #[no_mangle]
11365 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11366 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11367 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11368         fn drop(&mut self) {
11369                 if self.result_ok {
11370                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11371                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11372                         }
11373                 } else {
11374                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11375                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11376                         }
11377                 }
11378         }
11379 }
11380 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11381         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11382                 let contents = if o.result_ok {
11383                         let result = unsafe { o.contents.result };
11384                         unsafe { o.contents.result = core::ptr::null_mut() };
11385                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11386                 } else {
11387                         let err = unsafe { o.contents.err };
11388                         unsafe { o.contents.err = core::ptr::null_mut(); }
11389                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11390                 };
11391                 Self {
11392                         contents,
11393                         result_ok: o.result_ok,
11394                 }
11395         }
11396 }
11397 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11398         fn clone(&self) -> Self {
11399                 if self.result_ok {
11400                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11401                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11402                         } }
11403                 } else {
11404                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11405                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11406                         } }
11407                 }
11408         }
11409 }
11410 #[no_mangle]
11411 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11412 /// but with all dynamically-allocated buffers duplicated in new buffers.
11413 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11414 #[repr(C)]
11415 /// A dynamically-allocated array of u64s of arbitrary size.
11416 /// This corresponds to std::vector in C++
11417 pub struct CVec_u64Z {
11418         /// The elements in the array.
11419         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11420         pub data: *mut u64,
11421         /// The number of elements pointed to by `data`.
11422         pub datalen: usize
11423 }
11424 impl CVec_u64Z {
11425         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11426                 if self.datalen == 0 { return Vec::new(); }
11427                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11428                 self.data = core::ptr::null_mut();
11429                 self.datalen = 0;
11430                 ret
11431         }
11432         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11433                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11434         }
11435 }
11436 impl From<Vec<u64>> for CVec_u64Z {
11437         fn from(v: Vec<u64>) -> Self {
11438                 let datalen = v.len();
11439                 let data = Box::into_raw(v.into_boxed_slice());
11440                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11441         }
11442 }
11443 #[no_mangle]
11444 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11445 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11446 impl Drop for CVec_u64Z {
11447         fn drop(&mut self) {
11448                 if self.datalen == 0 { return; }
11449                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11450         }
11451 }
11452 impl Clone for CVec_u64Z {
11453         fn clone(&self) -> Self {
11454                 let mut res = Vec::new();
11455                 if self.datalen == 0 { return Self::from(res); }
11456                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11457                 Self::from(res)
11458         }
11459 }
11460 #[repr(C)]
11461 /// The contents of CResult_NodeInfoDecodeErrorZ
11462 pub union CResult_NodeInfoDecodeErrorZPtr {
11463         /// A pointer to the contents in the success state.
11464         /// Reading from this pointer when `result_ok` is not set is undefined.
11465         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11466         /// A pointer to the contents in the error state.
11467         /// Reading from this pointer when `result_ok` is set is undefined.
11468         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11469 }
11470 #[repr(C)]
11471 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11472 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11473 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11474 pub struct CResult_NodeInfoDecodeErrorZ {
11475         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11476         /// `err` or `result` depending on the state of `result_ok`.
11477         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11478         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11479         pub result_ok: bool,
11480 }
11481 #[no_mangle]
11482 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11483 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11484         CResult_NodeInfoDecodeErrorZ {
11485                 contents: CResult_NodeInfoDecodeErrorZPtr {
11486                         result: Box::into_raw(Box::new(o)),
11487                 },
11488                 result_ok: true,
11489         }
11490 }
11491 #[no_mangle]
11492 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11493 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11494         CResult_NodeInfoDecodeErrorZ {
11495                 contents: CResult_NodeInfoDecodeErrorZPtr {
11496                         err: Box::into_raw(Box::new(e)),
11497                 },
11498                 result_ok: false,
11499         }
11500 }
11501 /// Checks if the given object is currently in the success state
11502 #[no_mangle]
11503 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11504         o.result_ok
11505 }
11506 #[no_mangle]
11507 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11508 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11509 impl Drop for CResult_NodeInfoDecodeErrorZ {
11510         fn drop(&mut self) {
11511                 if self.result_ok {
11512                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11513                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11514                         }
11515                 } else {
11516                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11517                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11518                         }
11519                 }
11520         }
11521 }
11522 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11523         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11524                 let contents = if o.result_ok {
11525                         let result = unsafe { o.contents.result };
11526                         unsafe { o.contents.result = core::ptr::null_mut() };
11527                         CResult_NodeInfoDecodeErrorZPtr { result }
11528                 } else {
11529                         let err = unsafe { o.contents.err };
11530                         unsafe { o.contents.err = core::ptr::null_mut(); }
11531                         CResult_NodeInfoDecodeErrorZPtr { err }
11532                 };
11533                 Self {
11534                         contents,
11535                         result_ok: o.result_ok,
11536                 }
11537         }
11538 }
11539 impl Clone for CResult_NodeInfoDecodeErrorZ {
11540         fn clone(&self) -> Self {
11541                 if self.result_ok {
11542                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11543                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11544                         } }
11545                 } else {
11546                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11547                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11548                         } }
11549                 }
11550         }
11551 }
11552 #[no_mangle]
11553 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11554 /// but with all dynamically-allocated buffers duplicated in new buffers.
11555 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11556 #[repr(C)]
11557 /// The contents of CResult_NetworkGraphDecodeErrorZ
11558 pub union CResult_NetworkGraphDecodeErrorZPtr {
11559         /// A pointer to the contents in the success state.
11560         /// Reading from this pointer when `result_ok` is not set is undefined.
11561         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11562         /// A pointer to the contents in the error state.
11563         /// Reading from this pointer when `result_ok` is set is undefined.
11564         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11565 }
11566 #[repr(C)]
11567 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11568 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11569 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11570 pub struct CResult_NetworkGraphDecodeErrorZ {
11571         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11572         /// `err` or `result` depending on the state of `result_ok`.
11573         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11574         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11575         pub result_ok: bool,
11576 }
11577 #[no_mangle]
11578 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11579 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11580         CResult_NetworkGraphDecodeErrorZ {
11581                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11582                         result: Box::into_raw(Box::new(o)),
11583                 },
11584                 result_ok: true,
11585         }
11586 }
11587 #[no_mangle]
11588 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11589 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11590         CResult_NetworkGraphDecodeErrorZ {
11591                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11592                         err: Box::into_raw(Box::new(e)),
11593                 },
11594                 result_ok: false,
11595         }
11596 }
11597 /// Checks if the given object is currently in the success state
11598 #[no_mangle]
11599 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11600         o.result_ok
11601 }
11602 #[no_mangle]
11603 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11604 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11605 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11606         fn drop(&mut self) {
11607                 if self.result_ok {
11608                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11609                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11610                         }
11611                 } else {
11612                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11613                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11614                         }
11615                 }
11616         }
11617 }
11618 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11619         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11620                 let contents = if o.result_ok {
11621                         let result = unsafe { o.contents.result };
11622                         unsafe { o.contents.result = core::ptr::null_mut() };
11623                         CResult_NetworkGraphDecodeErrorZPtr { result }
11624                 } else {
11625                         let err = unsafe { o.contents.err };
11626                         unsafe { o.contents.err = core::ptr::null_mut(); }
11627                         CResult_NetworkGraphDecodeErrorZPtr { err }
11628                 };
11629                 Self {
11630                         contents,
11631                         result_ok: o.result_ok,
11632                 }
11633         }
11634 }
11635 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11636         fn clone(&self) -> Self {
11637                 if self.result_ok {
11638                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11639                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11640                         } }
11641                 } else {
11642                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11643                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11644                         } }
11645                 }
11646         }
11647 }
11648 #[no_mangle]
11649 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11650 /// but with all dynamically-allocated buffers duplicated in new buffers.
11651 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11652 #[repr(C)]
11653 #[derive(Clone)]
11654 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11655 pub enum COption_CVec_NetAddressZZ {
11656         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11657         Some(crate::c_types::derived::CVec_NetAddressZ),
11658         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11659         None
11660 }
11661 impl COption_CVec_NetAddressZZ {
11662         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11663                 if let Self::None = self { false } else { true }
11664         }
11665         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11666                 !self.is_some()
11667         }
11668         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11669                 if let Self::Some(v) = self { v } else { unreachable!() }
11670         }
11671 }
11672 #[no_mangle]
11673 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11674 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11675         COption_CVec_NetAddressZZ::Some(o)
11676 }
11677 #[no_mangle]
11678 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11679 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11680         COption_CVec_NetAddressZZ::None
11681 }
11682 #[no_mangle]
11683 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11684 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11685 #[no_mangle]
11686 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11687 /// but with all dynamically-allocated buffers duplicated in new buffers.
11688 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11689 #[repr(C)]
11690 /// The contents of CResult_NetAddressDecodeErrorZ
11691 pub union CResult_NetAddressDecodeErrorZPtr {
11692         /// A pointer to the contents in the success state.
11693         /// Reading from this pointer when `result_ok` is not set is undefined.
11694         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11695         /// A pointer to the contents in the error state.
11696         /// Reading from this pointer when `result_ok` is set is undefined.
11697         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11698 }
11699 #[repr(C)]
11700 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11701 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11703 pub struct CResult_NetAddressDecodeErrorZ {
11704         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11705         /// `err` or `result` depending on the state of `result_ok`.
11706         pub contents: CResult_NetAddressDecodeErrorZPtr,
11707         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11708         pub result_ok: bool,
11709 }
11710 #[no_mangle]
11711 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11712 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11713         CResult_NetAddressDecodeErrorZ {
11714                 contents: CResult_NetAddressDecodeErrorZPtr {
11715                         result: Box::into_raw(Box::new(o)),
11716                 },
11717                 result_ok: true,
11718         }
11719 }
11720 #[no_mangle]
11721 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11722 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11723         CResult_NetAddressDecodeErrorZ {
11724                 contents: CResult_NetAddressDecodeErrorZPtr {
11725                         err: Box::into_raw(Box::new(e)),
11726                 },
11727                 result_ok: false,
11728         }
11729 }
11730 /// Checks if the given object is currently in the success state
11731 #[no_mangle]
11732 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11733         o.result_ok
11734 }
11735 #[no_mangle]
11736 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11737 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11738 impl Drop for CResult_NetAddressDecodeErrorZ {
11739         fn drop(&mut self) {
11740                 if self.result_ok {
11741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11743                         }
11744                 } else {
11745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11747                         }
11748                 }
11749         }
11750 }
11751 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11753                 let contents = if o.result_ok {
11754                         let result = unsafe { o.contents.result };
11755                         unsafe { o.contents.result = core::ptr::null_mut() };
11756                         CResult_NetAddressDecodeErrorZPtr { result }
11757                 } else {
11758                         let err = unsafe { o.contents.err };
11759                         unsafe { o.contents.err = core::ptr::null_mut(); }
11760                         CResult_NetAddressDecodeErrorZPtr { err }
11761                 };
11762                 Self {
11763                         contents,
11764                         result_ok: o.result_ok,
11765                 }
11766         }
11767 }
11768 impl Clone for CResult_NetAddressDecodeErrorZ {
11769         fn clone(&self) -> Self {
11770                 if self.result_ok {
11771                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11772                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11773                         } }
11774                 } else {
11775                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11776                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11777                         } }
11778                 }
11779         }
11780 }
11781 #[no_mangle]
11782 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11783 /// but with all dynamically-allocated buffers duplicated in new buffers.
11784 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11785 #[repr(C)]
11786 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11787 /// This corresponds to std::vector in C++
11788 pub struct CVec_UpdateAddHTLCZ {
11789         /// The elements in the array.
11790         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11791         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11792         /// The number of elements pointed to by `data`.
11793         pub datalen: usize
11794 }
11795 impl CVec_UpdateAddHTLCZ {
11796         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11797                 if self.datalen == 0 { return Vec::new(); }
11798                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11799                 self.data = core::ptr::null_mut();
11800                 self.datalen = 0;
11801                 ret
11802         }
11803         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11804                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11805         }
11806 }
11807 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11808         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11809                 let datalen = v.len();
11810                 let data = Box::into_raw(v.into_boxed_slice());
11811                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11812         }
11813 }
11814 #[no_mangle]
11815 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11816 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11817 impl Drop for CVec_UpdateAddHTLCZ {
11818         fn drop(&mut self) {
11819                 if self.datalen == 0 { return; }
11820                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11821         }
11822 }
11823 impl Clone for CVec_UpdateAddHTLCZ {
11824         fn clone(&self) -> Self {
11825                 let mut res = Vec::new();
11826                 if self.datalen == 0 { return Self::from(res); }
11827                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11828                 Self::from(res)
11829         }
11830 }
11831 #[repr(C)]
11832 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11833 /// This corresponds to std::vector in C++
11834 pub struct CVec_UpdateFulfillHTLCZ {
11835         /// The elements in the array.
11836         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11837         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11838         /// The number of elements pointed to by `data`.
11839         pub datalen: usize
11840 }
11841 impl CVec_UpdateFulfillHTLCZ {
11842         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11843                 if self.datalen == 0 { return Vec::new(); }
11844                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11845                 self.data = core::ptr::null_mut();
11846                 self.datalen = 0;
11847                 ret
11848         }
11849         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11850                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11851         }
11852 }
11853 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11854         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11855                 let datalen = v.len();
11856                 let data = Box::into_raw(v.into_boxed_slice());
11857                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11858         }
11859 }
11860 #[no_mangle]
11861 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11862 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11863 impl Drop for CVec_UpdateFulfillHTLCZ {
11864         fn drop(&mut self) {
11865                 if self.datalen == 0 { return; }
11866                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11867         }
11868 }
11869 impl Clone for CVec_UpdateFulfillHTLCZ {
11870         fn clone(&self) -> Self {
11871                 let mut res = Vec::new();
11872                 if self.datalen == 0 { return Self::from(res); }
11873                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11874                 Self::from(res)
11875         }
11876 }
11877 #[repr(C)]
11878 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11879 /// This corresponds to std::vector in C++
11880 pub struct CVec_UpdateFailHTLCZ {
11881         /// The elements in the array.
11882         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11883         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11884         /// The number of elements pointed to by `data`.
11885         pub datalen: usize
11886 }
11887 impl CVec_UpdateFailHTLCZ {
11888         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11889                 if self.datalen == 0 { return Vec::new(); }
11890                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11891                 self.data = core::ptr::null_mut();
11892                 self.datalen = 0;
11893                 ret
11894         }
11895         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11896                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11897         }
11898 }
11899 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11900         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11901                 let datalen = v.len();
11902                 let data = Box::into_raw(v.into_boxed_slice());
11903                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11904         }
11905 }
11906 #[no_mangle]
11907 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11908 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11909 impl Drop for CVec_UpdateFailHTLCZ {
11910         fn drop(&mut self) {
11911                 if self.datalen == 0 { return; }
11912                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11913         }
11914 }
11915 impl Clone for CVec_UpdateFailHTLCZ {
11916         fn clone(&self) -> Self {
11917                 let mut res = Vec::new();
11918                 if self.datalen == 0 { return Self::from(res); }
11919                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11920                 Self::from(res)
11921         }
11922 }
11923 #[repr(C)]
11924 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11925 /// This corresponds to std::vector in C++
11926 pub struct CVec_UpdateFailMalformedHTLCZ {
11927         /// The elements in the array.
11928         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11929         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11930         /// The number of elements pointed to by `data`.
11931         pub datalen: usize
11932 }
11933 impl CVec_UpdateFailMalformedHTLCZ {
11934         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11935                 if self.datalen == 0 { return Vec::new(); }
11936                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11937                 self.data = core::ptr::null_mut();
11938                 self.datalen = 0;
11939                 ret
11940         }
11941         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11942                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11943         }
11944 }
11945 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11946         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11947                 let datalen = v.len();
11948                 let data = Box::into_raw(v.into_boxed_slice());
11949                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11950         }
11951 }
11952 #[no_mangle]
11953 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11954 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11955 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11956         fn drop(&mut self) {
11957                 if self.datalen == 0 { return; }
11958                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11959         }
11960 }
11961 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11962         fn clone(&self) -> Self {
11963                 let mut res = Vec::new();
11964                 if self.datalen == 0 { return Self::from(res); }
11965                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11966                 Self::from(res)
11967         }
11968 }
11969 #[repr(C)]
11970 /// The contents of CResult_AcceptChannelDecodeErrorZ
11971 pub union CResult_AcceptChannelDecodeErrorZPtr {
11972         /// A pointer to the contents in the success state.
11973         /// Reading from this pointer when `result_ok` is not set is undefined.
11974         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11975         /// A pointer to the contents in the error state.
11976         /// Reading from this pointer when `result_ok` is set is undefined.
11977         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11978 }
11979 #[repr(C)]
11980 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11981 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11982 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11983 pub struct CResult_AcceptChannelDecodeErrorZ {
11984         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11985         /// `err` or `result` depending on the state of `result_ok`.
11986         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11987         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11988         pub result_ok: bool,
11989 }
11990 #[no_mangle]
11991 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11992 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11993         CResult_AcceptChannelDecodeErrorZ {
11994                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11995                         result: Box::into_raw(Box::new(o)),
11996                 },
11997                 result_ok: true,
11998         }
11999 }
12000 #[no_mangle]
12001 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
12002 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
12003         CResult_AcceptChannelDecodeErrorZ {
12004                 contents: CResult_AcceptChannelDecodeErrorZPtr {
12005                         err: Box::into_raw(Box::new(e)),
12006                 },
12007                 result_ok: false,
12008         }
12009 }
12010 /// Checks if the given object is currently in the success state
12011 #[no_mangle]
12012 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
12013         o.result_ok
12014 }
12015 #[no_mangle]
12016 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
12017 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
12018 impl Drop for CResult_AcceptChannelDecodeErrorZ {
12019         fn drop(&mut self) {
12020                 if self.result_ok {
12021                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12022                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12023                         }
12024                 } else {
12025                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12026                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12027                         }
12028                 }
12029         }
12030 }
12031 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
12032         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12033                 let contents = if o.result_ok {
12034                         let result = unsafe { o.contents.result };
12035                         unsafe { o.contents.result = core::ptr::null_mut() };
12036                         CResult_AcceptChannelDecodeErrorZPtr { result }
12037                 } else {
12038                         let err = unsafe { o.contents.err };
12039                         unsafe { o.contents.err = core::ptr::null_mut(); }
12040                         CResult_AcceptChannelDecodeErrorZPtr { err }
12041                 };
12042                 Self {
12043                         contents,
12044                         result_ok: o.result_ok,
12045                 }
12046         }
12047 }
12048 impl Clone for CResult_AcceptChannelDecodeErrorZ {
12049         fn clone(&self) -> Self {
12050                 if self.result_ok {
12051                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
12052                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
12053                         } }
12054                 } else {
12055                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
12056                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12057                         } }
12058                 }
12059         }
12060 }
12061 #[no_mangle]
12062 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
12063 /// but with all dynamically-allocated buffers duplicated in new buffers.
12064 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
12065 #[repr(C)]
12066 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
12067 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
12068         /// A pointer to the contents in the success state.
12069         /// Reading from this pointer when `result_ok` is not set is undefined.
12070         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
12071         /// A pointer to the contents in the error state.
12072         /// Reading from this pointer when `result_ok` is set is undefined.
12073         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12074 }
12075 #[repr(C)]
12076 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
12077 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
12078 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12079 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
12080         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
12081         /// `err` or `result` depending on the state of `result_ok`.
12082         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
12083         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
12084         pub result_ok: bool,
12085 }
12086 #[no_mangle]
12087 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
12088 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12089         CResult_AnnouncementSignaturesDecodeErrorZ {
12090                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12091                         result: Box::into_raw(Box::new(o)),
12092                 },
12093                 result_ok: true,
12094         }
12095 }
12096 #[no_mangle]
12097 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
12098 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
12099         CResult_AnnouncementSignaturesDecodeErrorZ {
12100                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12101                         err: Box::into_raw(Box::new(e)),
12102                 },
12103                 result_ok: false,
12104         }
12105 }
12106 /// Checks if the given object is currently in the success state
12107 #[no_mangle]
12108 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12109         o.result_ok
12110 }
12111 #[no_mangle]
12112 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12113 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12114 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12115         fn drop(&mut self) {
12116                 if self.result_ok {
12117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12119                         }
12120                 } else {
12121                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12122                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12123                         }
12124                 }
12125         }
12126 }
12127 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12128         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12129                 let contents = if o.result_ok {
12130                         let result = unsafe { o.contents.result };
12131                         unsafe { o.contents.result = core::ptr::null_mut() };
12132                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12133                 } else {
12134                         let err = unsafe { o.contents.err };
12135                         unsafe { o.contents.err = core::ptr::null_mut(); }
12136                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12137                 };
12138                 Self {
12139                         contents,
12140                         result_ok: o.result_ok,
12141                 }
12142         }
12143 }
12144 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12145         fn clone(&self) -> Self {
12146                 if self.result_ok {
12147                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12148                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12149                         } }
12150                 } else {
12151                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12152                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12153                         } }
12154                 }
12155         }
12156 }
12157 #[no_mangle]
12158 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12159 /// but with all dynamically-allocated buffers duplicated in new buffers.
12160 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12161 #[repr(C)]
12162 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12163 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12164         /// A pointer to the contents in the success state.
12165         /// Reading from this pointer when `result_ok` is not set is undefined.
12166         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12167         /// A pointer to the contents in the error state.
12168         /// Reading from this pointer when `result_ok` is set is undefined.
12169         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12170 }
12171 #[repr(C)]
12172 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12173 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12174 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12175 pub struct CResult_ChannelReestablishDecodeErrorZ {
12176         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12177         /// `err` or `result` depending on the state of `result_ok`.
12178         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12179         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12180         pub result_ok: bool,
12181 }
12182 #[no_mangle]
12183 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12184 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12185         CResult_ChannelReestablishDecodeErrorZ {
12186                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12187                         result: Box::into_raw(Box::new(o)),
12188                 },
12189                 result_ok: true,
12190         }
12191 }
12192 #[no_mangle]
12193 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12194 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12195         CResult_ChannelReestablishDecodeErrorZ {
12196                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12197                         err: Box::into_raw(Box::new(e)),
12198                 },
12199                 result_ok: false,
12200         }
12201 }
12202 /// Checks if the given object is currently in the success state
12203 #[no_mangle]
12204 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12205         o.result_ok
12206 }
12207 #[no_mangle]
12208 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12209 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12210 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12211         fn drop(&mut self) {
12212                 if self.result_ok {
12213                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12214                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12215                         }
12216                 } else {
12217                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12218                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12219                         }
12220                 }
12221         }
12222 }
12223 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12224         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12225                 let contents = if o.result_ok {
12226                         let result = unsafe { o.contents.result };
12227                         unsafe { o.contents.result = core::ptr::null_mut() };
12228                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12229                 } else {
12230                         let err = unsafe { o.contents.err };
12231                         unsafe { o.contents.err = core::ptr::null_mut(); }
12232                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12233                 };
12234                 Self {
12235                         contents,
12236                         result_ok: o.result_ok,
12237                 }
12238         }
12239 }
12240 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12241         fn clone(&self) -> Self {
12242                 if self.result_ok {
12243                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12244                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12245                         } }
12246                 } else {
12247                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12248                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12249                         } }
12250                 }
12251         }
12252 }
12253 #[no_mangle]
12254 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12255 /// but with all dynamically-allocated buffers duplicated in new buffers.
12256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12257 #[repr(C)]
12258 /// The contents of CResult_ClosingSignedDecodeErrorZ
12259 pub union CResult_ClosingSignedDecodeErrorZPtr {
12260         /// A pointer to the contents in the success state.
12261         /// Reading from this pointer when `result_ok` is not set is undefined.
12262         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12263         /// A pointer to the contents in the error state.
12264         /// Reading from this pointer when `result_ok` is set is undefined.
12265         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12266 }
12267 #[repr(C)]
12268 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12269 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12270 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12271 pub struct CResult_ClosingSignedDecodeErrorZ {
12272         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12273         /// `err` or `result` depending on the state of `result_ok`.
12274         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12275         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12276         pub result_ok: bool,
12277 }
12278 #[no_mangle]
12279 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12280 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12281         CResult_ClosingSignedDecodeErrorZ {
12282                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12283                         result: Box::into_raw(Box::new(o)),
12284                 },
12285                 result_ok: true,
12286         }
12287 }
12288 #[no_mangle]
12289 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12290 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12291         CResult_ClosingSignedDecodeErrorZ {
12292                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12293                         err: Box::into_raw(Box::new(e)),
12294                 },
12295                 result_ok: false,
12296         }
12297 }
12298 /// Checks if the given object is currently in the success state
12299 #[no_mangle]
12300 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12301         o.result_ok
12302 }
12303 #[no_mangle]
12304 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12305 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12306 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12307         fn drop(&mut self) {
12308                 if self.result_ok {
12309                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12310                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12311                         }
12312                 } else {
12313                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12314                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12315                         }
12316                 }
12317         }
12318 }
12319 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12320         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12321                 let contents = if o.result_ok {
12322                         let result = unsafe { o.contents.result };
12323                         unsafe { o.contents.result = core::ptr::null_mut() };
12324                         CResult_ClosingSignedDecodeErrorZPtr { result }
12325                 } else {
12326                         let err = unsafe { o.contents.err };
12327                         unsafe { o.contents.err = core::ptr::null_mut(); }
12328                         CResult_ClosingSignedDecodeErrorZPtr { err }
12329                 };
12330                 Self {
12331                         contents,
12332                         result_ok: o.result_ok,
12333                 }
12334         }
12335 }
12336 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12337         fn clone(&self) -> Self {
12338                 if self.result_ok {
12339                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12340                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12341                         } }
12342                 } else {
12343                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12344                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12345                         } }
12346                 }
12347         }
12348 }
12349 #[no_mangle]
12350 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12351 /// but with all dynamically-allocated buffers duplicated in new buffers.
12352 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12353 #[repr(C)]
12354 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12355 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12356         /// A pointer to the contents in the success state.
12357         /// Reading from this pointer when `result_ok` is not set is undefined.
12358         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12359         /// A pointer to the contents in the error state.
12360         /// Reading from this pointer when `result_ok` is set is undefined.
12361         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12362 }
12363 #[repr(C)]
12364 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12365 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12366 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12367 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12368         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12369         /// `err` or `result` depending on the state of `result_ok`.
12370         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12371         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12372         pub result_ok: bool,
12373 }
12374 #[no_mangle]
12375 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12376 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12377         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12378                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12379                         result: Box::into_raw(Box::new(o)),
12380                 },
12381                 result_ok: true,
12382         }
12383 }
12384 #[no_mangle]
12385 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12386 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12387         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12388                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12389                         err: Box::into_raw(Box::new(e)),
12390                 },
12391                 result_ok: false,
12392         }
12393 }
12394 /// Checks if the given object is currently in the success state
12395 #[no_mangle]
12396 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12397         o.result_ok
12398 }
12399 #[no_mangle]
12400 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12401 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12402 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12403         fn drop(&mut self) {
12404                 if self.result_ok {
12405                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12406                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12407                         }
12408                 } else {
12409                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12410                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12411                         }
12412                 }
12413         }
12414 }
12415 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12416         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12417                 let contents = if o.result_ok {
12418                         let result = unsafe { o.contents.result };
12419                         unsafe { o.contents.result = core::ptr::null_mut() };
12420                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12421                 } else {
12422                         let err = unsafe { o.contents.err };
12423                         unsafe { o.contents.err = core::ptr::null_mut(); }
12424                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12425                 };
12426                 Self {
12427                         contents,
12428                         result_ok: o.result_ok,
12429                 }
12430         }
12431 }
12432 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12433         fn clone(&self) -> Self {
12434                 if self.result_ok {
12435                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12436                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12437                         } }
12438                 } else {
12439                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12440                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12441                         } }
12442                 }
12443         }
12444 }
12445 #[no_mangle]
12446 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12447 /// but with all dynamically-allocated buffers duplicated in new buffers.
12448 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12449 #[repr(C)]
12450 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12451 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12452         /// A pointer to the contents in the success state.
12453         /// Reading from this pointer when `result_ok` is not set is undefined.
12454         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12455         /// A pointer to the contents in the error state.
12456         /// Reading from this pointer when `result_ok` is set is undefined.
12457         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12458 }
12459 #[repr(C)]
12460 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12461 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12462 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12463 pub struct CResult_CommitmentSignedDecodeErrorZ {
12464         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12465         /// `err` or `result` depending on the state of `result_ok`.
12466         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12467         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12468         pub result_ok: bool,
12469 }
12470 #[no_mangle]
12471 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12472 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12473         CResult_CommitmentSignedDecodeErrorZ {
12474                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12475                         result: Box::into_raw(Box::new(o)),
12476                 },
12477                 result_ok: true,
12478         }
12479 }
12480 #[no_mangle]
12481 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12482 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12483         CResult_CommitmentSignedDecodeErrorZ {
12484                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12485                         err: Box::into_raw(Box::new(e)),
12486                 },
12487                 result_ok: false,
12488         }
12489 }
12490 /// Checks if the given object is currently in the success state
12491 #[no_mangle]
12492 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12493         o.result_ok
12494 }
12495 #[no_mangle]
12496 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12497 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12498 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12499         fn drop(&mut self) {
12500                 if self.result_ok {
12501                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12502                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12503                         }
12504                 } else {
12505                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12506                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12507                         }
12508                 }
12509         }
12510 }
12511 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12512         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12513                 let contents = if o.result_ok {
12514                         let result = unsafe { o.contents.result };
12515                         unsafe { o.contents.result = core::ptr::null_mut() };
12516                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12517                 } else {
12518                         let err = unsafe { o.contents.err };
12519                         unsafe { o.contents.err = core::ptr::null_mut(); }
12520                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12521                 };
12522                 Self {
12523                         contents,
12524                         result_ok: o.result_ok,
12525                 }
12526         }
12527 }
12528 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12529         fn clone(&self) -> Self {
12530                 if self.result_ok {
12531                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12532                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12533                         } }
12534                 } else {
12535                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12536                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12537                         } }
12538                 }
12539         }
12540 }
12541 #[no_mangle]
12542 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12543 /// but with all dynamically-allocated buffers duplicated in new buffers.
12544 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12545 #[repr(C)]
12546 /// The contents of CResult_FundingCreatedDecodeErrorZ
12547 pub union CResult_FundingCreatedDecodeErrorZPtr {
12548         /// A pointer to the contents in the success state.
12549         /// Reading from this pointer when `result_ok` is not set is undefined.
12550         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12551         /// A pointer to the contents in the error state.
12552         /// Reading from this pointer when `result_ok` is set is undefined.
12553         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12554 }
12555 #[repr(C)]
12556 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12557 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12558 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12559 pub struct CResult_FundingCreatedDecodeErrorZ {
12560         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12561         /// `err` or `result` depending on the state of `result_ok`.
12562         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12563         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12564         pub result_ok: bool,
12565 }
12566 #[no_mangle]
12567 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12568 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12569         CResult_FundingCreatedDecodeErrorZ {
12570                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12571                         result: Box::into_raw(Box::new(o)),
12572                 },
12573                 result_ok: true,
12574         }
12575 }
12576 #[no_mangle]
12577 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12578 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12579         CResult_FundingCreatedDecodeErrorZ {
12580                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12581                         err: Box::into_raw(Box::new(e)),
12582                 },
12583                 result_ok: false,
12584         }
12585 }
12586 /// Checks if the given object is currently in the success state
12587 #[no_mangle]
12588 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12589         o.result_ok
12590 }
12591 #[no_mangle]
12592 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12593 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12594 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12595         fn drop(&mut self) {
12596                 if self.result_ok {
12597                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12598                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12599                         }
12600                 } else {
12601                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12602                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12603                         }
12604                 }
12605         }
12606 }
12607 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12608         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12609                 let contents = if o.result_ok {
12610                         let result = unsafe { o.contents.result };
12611                         unsafe { o.contents.result = core::ptr::null_mut() };
12612                         CResult_FundingCreatedDecodeErrorZPtr { result }
12613                 } else {
12614                         let err = unsafe { o.contents.err };
12615                         unsafe { o.contents.err = core::ptr::null_mut(); }
12616                         CResult_FundingCreatedDecodeErrorZPtr { err }
12617                 };
12618                 Self {
12619                         contents,
12620                         result_ok: o.result_ok,
12621                 }
12622         }
12623 }
12624 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12625         fn clone(&self) -> Self {
12626                 if self.result_ok {
12627                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12628                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12629                         } }
12630                 } else {
12631                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12632                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12633                         } }
12634                 }
12635         }
12636 }
12637 #[no_mangle]
12638 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12639 /// but with all dynamically-allocated buffers duplicated in new buffers.
12640 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12641 #[repr(C)]
12642 /// The contents of CResult_FundingSignedDecodeErrorZ
12643 pub union CResult_FundingSignedDecodeErrorZPtr {
12644         /// A pointer to the contents in the success state.
12645         /// Reading from this pointer when `result_ok` is not set is undefined.
12646         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12647         /// A pointer to the contents in the error state.
12648         /// Reading from this pointer when `result_ok` is set is undefined.
12649         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12650 }
12651 #[repr(C)]
12652 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12653 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12654 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12655 pub struct CResult_FundingSignedDecodeErrorZ {
12656         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12657         /// `err` or `result` depending on the state of `result_ok`.
12658         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12659         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12660         pub result_ok: bool,
12661 }
12662 #[no_mangle]
12663 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12664 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12665         CResult_FundingSignedDecodeErrorZ {
12666                 contents: CResult_FundingSignedDecodeErrorZPtr {
12667                         result: Box::into_raw(Box::new(o)),
12668                 },
12669                 result_ok: true,
12670         }
12671 }
12672 #[no_mangle]
12673 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12674 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12675         CResult_FundingSignedDecodeErrorZ {
12676                 contents: CResult_FundingSignedDecodeErrorZPtr {
12677                         err: Box::into_raw(Box::new(e)),
12678                 },
12679                 result_ok: false,
12680         }
12681 }
12682 /// Checks if the given object is currently in the success state
12683 #[no_mangle]
12684 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12685         o.result_ok
12686 }
12687 #[no_mangle]
12688 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12689 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12690 impl Drop for CResult_FundingSignedDecodeErrorZ {
12691         fn drop(&mut self) {
12692                 if self.result_ok {
12693                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12694                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12695                         }
12696                 } else {
12697                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12698                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12699                         }
12700                 }
12701         }
12702 }
12703 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12704         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12705                 let contents = if o.result_ok {
12706                         let result = unsafe { o.contents.result };
12707                         unsafe { o.contents.result = core::ptr::null_mut() };
12708                         CResult_FundingSignedDecodeErrorZPtr { result }
12709                 } else {
12710                         let err = unsafe { o.contents.err };
12711                         unsafe { o.contents.err = core::ptr::null_mut(); }
12712                         CResult_FundingSignedDecodeErrorZPtr { err }
12713                 };
12714                 Self {
12715                         contents,
12716                         result_ok: o.result_ok,
12717                 }
12718         }
12719 }
12720 impl Clone for CResult_FundingSignedDecodeErrorZ {
12721         fn clone(&self) -> Self {
12722                 if self.result_ok {
12723                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12724                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12725                         } }
12726                 } else {
12727                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12728                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12729                         } }
12730                 }
12731         }
12732 }
12733 #[no_mangle]
12734 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12735 /// but with all dynamically-allocated buffers duplicated in new buffers.
12736 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12737 #[repr(C)]
12738 /// The contents of CResult_FundingLockedDecodeErrorZ
12739 pub union CResult_FundingLockedDecodeErrorZPtr {
12740         /// A pointer to the contents in the success state.
12741         /// Reading from this pointer when `result_ok` is not set is undefined.
12742         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12743         /// A pointer to the contents in the error state.
12744         /// Reading from this pointer when `result_ok` is set is undefined.
12745         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12746 }
12747 #[repr(C)]
12748 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12749 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12750 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12751 pub struct CResult_FundingLockedDecodeErrorZ {
12752         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12753         /// `err` or `result` depending on the state of `result_ok`.
12754         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12755         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12756         pub result_ok: bool,
12757 }
12758 #[no_mangle]
12759 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12760 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12761         CResult_FundingLockedDecodeErrorZ {
12762                 contents: CResult_FundingLockedDecodeErrorZPtr {
12763                         result: Box::into_raw(Box::new(o)),
12764                 },
12765                 result_ok: true,
12766         }
12767 }
12768 #[no_mangle]
12769 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12770 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12771         CResult_FundingLockedDecodeErrorZ {
12772                 contents: CResult_FundingLockedDecodeErrorZPtr {
12773                         err: Box::into_raw(Box::new(e)),
12774                 },
12775                 result_ok: false,
12776         }
12777 }
12778 /// Checks if the given object is currently in the success state
12779 #[no_mangle]
12780 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12781         o.result_ok
12782 }
12783 #[no_mangle]
12784 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12785 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12786 impl Drop for CResult_FundingLockedDecodeErrorZ {
12787         fn drop(&mut self) {
12788                 if self.result_ok {
12789                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12790                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12791                         }
12792                 } else {
12793                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12794                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12795                         }
12796                 }
12797         }
12798 }
12799 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12800         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12801                 let contents = if o.result_ok {
12802                         let result = unsafe { o.contents.result };
12803                         unsafe { o.contents.result = core::ptr::null_mut() };
12804                         CResult_FundingLockedDecodeErrorZPtr { result }
12805                 } else {
12806                         let err = unsafe { o.contents.err };
12807                         unsafe { o.contents.err = core::ptr::null_mut(); }
12808                         CResult_FundingLockedDecodeErrorZPtr { err }
12809                 };
12810                 Self {
12811                         contents,
12812                         result_ok: o.result_ok,
12813                 }
12814         }
12815 }
12816 impl Clone for CResult_FundingLockedDecodeErrorZ {
12817         fn clone(&self) -> Self {
12818                 if self.result_ok {
12819                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12820                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12821                         } }
12822                 } else {
12823                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12824                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12825                         } }
12826                 }
12827         }
12828 }
12829 #[no_mangle]
12830 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12831 /// but with all dynamically-allocated buffers duplicated in new buffers.
12832 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12833 #[repr(C)]
12834 /// The contents of CResult_InitDecodeErrorZ
12835 pub union CResult_InitDecodeErrorZPtr {
12836         /// A pointer to the contents in the success state.
12837         /// Reading from this pointer when `result_ok` is not set is undefined.
12838         pub result: *mut crate::lightning::ln::msgs::Init,
12839         /// A pointer to the contents in the error state.
12840         /// Reading from this pointer when `result_ok` is set is undefined.
12841         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12842 }
12843 #[repr(C)]
12844 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12845 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12846 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12847 pub struct CResult_InitDecodeErrorZ {
12848         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12849         /// `err` or `result` depending on the state of `result_ok`.
12850         pub contents: CResult_InitDecodeErrorZPtr,
12851         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12852         pub result_ok: bool,
12853 }
12854 #[no_mangle]
12855 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12856 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12857         CResult_InitDecodeErrorZ {
12858                 contents: CResult_InitDecodeErrorZPtr {
12859                         result: Box::into_raw(Box::new(o)),
12860                 },
12861                 result_ok: true,
12862         }
12863 }
12864 #[no_mangle]
12865 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12866 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12867         CResult_InitDecodeErrorZ {
12868                 contents: CResult_InitDecodeErrorZPtr {
12869                         err: Box::into_raw(Box::new(e)),
12870                 },
12871                 result_ok: false,
12872         }
12873 }
12874 /// Checks if the given object is currently in the success state
12875 #[no_mangle]
12876 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12877         o.result_ok
12878 }
12879 #[no_mangle]
12880 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12881 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12882 impl Drop for CResult_InitDecodeErrorZ {
12883         fn drop(&mut self) {
12884                 if self.result_ok {
12885                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12886                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12887                         }
12888                 } else {
12889                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12890                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12891                         }
12892                 }
12893         }
12894 }
12895 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12896         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12897                 let contents = if o.result_ok {
12898                         let result = unsafe { o.contents.result };
12899                         unsafe { o.contents.result = core::ptr::null_mut() };
12900                         CResult_InitDecodeErrorZPtr { result }
12901                 } else {
12902                         let err = unsafe { o.contents.err };
12903                         unsafe { o.contents.err = core::ptr::null_mut(); }
12904                         CResult_InitDecodeErrorZPtr { err }
12905                 };
12906                 Self {
12907                         contents,
12908                         result_ok: o.result_ok,
12909                 }
12910         }
12911 }
12912 impl Clone for CResult_InitDecodeErrorZ {
12913         fn clone(&self) -> Self {
12914                 if self.result_ok {
12915                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12916                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12917                         } }
12918                 } else {
12919                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12920                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12921                         } }
12922                 }
12923         }
12924 }
12925 #[no_mangle]
12926 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12927 /// but with all dynamically-allocated buffers duplicated in new buffers.
12928 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12929 #[repr(C)]
12930 /// The contents of CResult_OpenChannelDecodeErrorZ
12931 pub union CResult_OpenChannelDecodeErrorZPtr {
12932         /// A pointer to the contents in the success state.
12933         /// Reading from this pointer when `result_ok` is not set is undefined.
12934         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12935         /// A pointer to the contents in the error state.
12936         /// Reading from this pointer when `result_ok` is set is undefined.
12937         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12938 }
12939 #[repr(C)]
12940 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12941 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12942 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12943 pub struct CResult_OpenChannelDecodeErrorZ {
12944         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12945         /// `err` or `result` depending on the state of `result_ok`.
12946         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12947         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12948         pub result_ok: bool,
12949 }
12950 #[no_mangle]
12951 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12952 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12953         CResult_OpenChannelDecodeErrorZ {
12954                 contents: CResult_OpenChannelDecodeErrorZPtr {
12955                         result: Box::into_raw(Box::new(o)),
12956                 },
12957                 result_ok: true,
12958         }
12959 }
12960 #[no_mangle]
12961 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12962 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12963         CResult_OpenChannelDecodeErrorZ {
12964                 contents: CResult_OpenChannelDecodeErrorZPtr {
12965                         err: Box::into_raw(Box::new(e)),
12966                 },
12967                 result_ok: false,
12968         }
12969 }
12970 /// Checks if the given object is currently in the success state
12971 #[no_mangle]
12972 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12973         o.result_ok
12974 }
12975 #[no_mangle]
12976 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12977 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12978 impl Drop for CResult_OpenChannelDecodeErrorZ {
12979         fn drop(&mut self) {
12980                 if self.result_ok {
12981                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12982                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12983                         }
12984                 } else {
12985                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12986                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12987                         }
12988                 }
12989         }
12990 }
12991 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12992         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12993                 let contents = if o.result_ok {
12994                         let result = unsafe { o.contents.result };
12995                         unsafe { o.contents.result = core::ptr::null_mut() };
12996                         CResult_OpenChannelDecodeErrorZPtr { result }
12997                 } else {
12998                         let err = unsafe { o.contents.err };
12999                         unsafe { o.contents.err = core::ptr::null_mut(); }
13000                         CResult_OpenChannelDecodeErrorZPtr { err }
13001                 };
13002                 Self {
13003                         contents,
13004                         result_ok: o.result_ok,
13005                 }
13006         }
13007 }
13008 impl Clone for CResult_OpenChannelDecodeErrorZ {
13009         fn clone(&self) -> Self {
13010                 if self.result_ok {
13011                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
13012                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
13013                         } }
13014                 } else {
13015                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
13016                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13017                         } }
13018                 }
13019         }
13020 }
13021 #[no_mangle]
13022 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
13023 /// but with all dynamically-allocated buffers duplicated in new buffers.
13024 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
13025 #[repr(C)]
13026 /// The contents of CResult_RevokeAndACKDecodeErrorZ
13027 pub union CResult_RevokeAndACKDecodeErrorZPtr {
13028         /// A pointer to the contents in the success state.
13029         /// Reading from this pointer when `result_ok` is not set is undefined.
13030         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
13031         /// A pointer to the contents in the error state.
13032         /// Reading from this pointer when `result_ok` is set is undefined.
13033         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13034 }
13035 #[repr(C)]
13036 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
13037 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
13038 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13039 pub struct CResult_RevokeAndACKDecodeErrorZ {
13040         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
13041         /// `err` or `result` depending on the state of `result_ok`.
13042         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
13043         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
13044         pub result_ok: bool,
13045 }
13046 #[no_mangle]
13047 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
13048 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
13049         CResult_RevokeAndACKDecodeErrorZ {
13050                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13051                         result: Box::into_raw(Box::new(o)),
13052                 },
13053                 result_ok: true,
13054         }
13055 }
13056 #[no_mangle]
13057 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
13058 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
13059         CResult_RevokeAndACKDecodeErrorZ {
13060                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
13061                         err: Box::into_raw(Box::new(e)),
13062                 },
13063                 result_ok: false,
13064         }
13065 }
13066 /// Checks if the given object is currently in the success state
13067 #[no_mangle]
13068 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
13069         o.result_ok
13070 }
13071 #[no_mangle]
13072 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
13073 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
13074 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
13075         fn drop(&mut self) {
13076                 if self.result_ok {
13077                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13078                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13079                         }
13080                 } else {
13081                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13082                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13083                         }
13084                 }
13085         }
13086 }
13087 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
13088         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
13089                 let contents = if o.result_ok {
13090                         let result = unsafe { o.contents.result };
13091                         unsafe { o.contents.result = core::ptr::null_mut() };
13092                         CResult_RevokeAndACKDecodeErrorZPtr { result }
13093                 } else {
13094                         let err = unsafe { o.contents.err };
13095                         unsafe { o.contents.err = core::ptr::null_mut(); }
13096                         CResult_RevokeAndACKDecodeErrorZPtr { err }
13097                 };
13098                 Self {
13099                         contents,
13100                         result_ok: o.result_ok,
13101                 }
13102         }
13103 }
13104 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13105         fn clone(&self) -> Self {
13106                 if self.result_ok {
13107                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13108                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13109                         } }
13110                 } else {
13111                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13112                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13113                         } }
13114                 }
13115         }
13116 }
13117 #[no_mangle]
13118 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13119 /// but with all dynamically-allocated buffers duplicated in new buffers.
13120 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13121 #[repr(C)]
13122 /// The contents of CResult_ShutdownDecodeErrorZ
13123 pub union CResult_ShutdownDecodeErrorZPtr {
13124         /// A pointer to the contents in the success state.
13125         /// Reading from this pointer when `result_ok` is not set is undefined.
13126         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13127         /// A pointer to the contents in the error state.
13128         /// Reading from this pointer when `result_ok` is set is undefined.
13129         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13130 }
13131 #[repr(C)]
13132 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13133 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13134 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13135 pub struct CResult_ShutdownDecodeErrorZ {
13136         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13137         /// `err` or `result` depending on the state of `result_ok`.
13138         pub contents: CResult_ShutdownDecodeErrorZPtr,
13139         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13140         pub result_ok: bool,
13141 }
13142 #[no_mangle]
13143 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13144 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13145         CResult_ShutdownDecodeErrorZ {
13146                 contents: CResult_ShutdownDecodeErrorZPtr {
13147                         result: Box::into_raw(Box::new(o)),
13148                 },
13149                 result_ok: true,
13150         }
13151 }
13152 #[no_mangle]
13153 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13154 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13155         CResult_ShutdownDecodeErrorZ {
13156                 contents: CResult_ShutdownDecodeErrorZPtr {
13157                         err: Box::into_raw(Box::new(e)),
13158                 },
13159                 result_ok: false,
13160         }
13161 }
13162 /// Checks if the given object is currently in the success state
13163 #[no_mangle]
13164 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13165         o.result_ok
13166 }
13167 #[no_mangle]
13168 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13169 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13170 impl Drop for CResult_ShutdownDecodeErrorZ {
13171         fn drop(&mut self) {
13172                 if self.result_ok {
13173                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13174                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13175                         }
13176                 } else {
13177                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13178                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13179                         }
13180                 }
13181         }
13182 }
13183 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13184         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13185                 let contents = if o.result_ok {
13186                         let result = unsafe { o.contents.result };
13187                         unsafe { o.contents.result = core::ptr::null_mut() };
13188                         CResult_ShutdownDecodeErrorZPtr { result }
13189                 } else {
13190                         let err = unsafe { o.contents.err };
13191                         unsafe { o.contents.err = core::ptr::null_mut(); }
13192                         CResult_ShutdownDecodeErrorZPtr { err }
13193                 };
13194                 Self {
13195                         contents,
13196                         result_ok: o.result_ok,
13197                 }
13198         }
13199 }
13200 impl Clone for CResult_ShutdownDecodeErrorZ {
13201         fn clone(&self) -> Self {
13202                 if self.result_ok {
13203                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13204                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13205                         } }
13206                 } else {
13207                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13208                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13209                         } }
13210                 }
13211         }
13212 }
13213 #[no_mangle]
13214 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13215 /// but with all dynamically-allocated buffers duplicated in new buffers.
13216 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13217 #[repr(C)]
13218 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13219 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13220         /// A pointer to the contents in the success state.
13221         /// Reading from this pointer when `result_ok` is not set is undefined.
13222         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13223         /// A pointer to the contents in the error state.
13224         /// Reading from this pointer when `result_ok` is set is undefined.
13225         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13226 }
13227 #[repr(C)]
13228 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13229 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13230 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13231 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13232         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13233         /// `err` or `result` depending on the state of `result_ok`.
13234         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13235         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13236         pub result_ok: bool,
13237 }
13238 #[no_mangle]
13239 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13240 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13241         CResult_UpdateFailHTLCDecodeErrorZ {
13242                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13243                         result: Box::into_raw(Box::new(o)),
13244                 },
13245                 result_ok: true,
13246         }
13247 }
13248 #[no_mangle]
13249 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13250 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13251         CResult_UpdateFailHTLCDecodeErrorZ {
13252                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13253                         err: Box::into_raw(Box::new(e)),
13254                 },
13255                 result_ok: false,
13256         }
13257 }
13258 /// Checks if the given object is currently in the success state
13259 #[no_mangle]
13260 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13261         o.result_ok
13262 }
13263 #[no_mangle]
13264 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13265 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13266 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13267         fn drop(&mut self) {
13268                 if self.result_ok {
13269                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13270                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13271                         }
13272                 } else {
13273                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13274                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13275                         }
13276                 }
13277         }
13278 }
13279 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13280         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13281                 let contents = if o.result_ok {
13282                         let result = unsafe { o.contents.result };
13283                         unsafe { o.contents.result = core::ptr::null_mut() };
13284                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13285                 } else {
13286                         let err = unsafe { o.contents.err };
13287                         unsafe { o.contents.err = core::ptr::null_mut(); }
13288                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13289                 };
13290                 Self {
13291                         contents,
13292                         result_ok: o.result_ok,
13293                 }
13294         }
13295 }
13296 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13297         fn clone(&self) -> Self {
13298                 if self.result_ok {
13299                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13300                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13301                         } }
13302                 } else {
13303                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13304                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13305                         } }
13306                 }
13307         }
13308 }
13309 #[no_mangle]
13310 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13311 /// but with all dynamically-allocated buffers duplicated in new buffers.
13312 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13313 #[repr(C)]
13314 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13315 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13316         /// A pointer to the contents in the success state.
13317         /// Reading from this pointer when `result_ok` is not set is undefined.
13318         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13319         /// A pointer to the contents in the error state.
13320         /// Reading from this pointer when `result_ok` is set is undefined.
13321         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13322 }
13323 #[repr(C)]
13324 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13325 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13326 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13327 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13328         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13329         /// `err` or `result` depending on the state of `result_ok`.
13330         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13331         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13332         pub result_ok: bool,
13333 }
13334 #[no_mangle]
13335 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13336 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13337         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13338                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13339                         result: Box::into_raw(Box::new(o)),
13340                 },
13341                 result_ok: true,
13342         }
13343 }
13344 #[no_mangle]
13345 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13346 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13347         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13348                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13349                         err: Box::into_raw(Box::new(e)),
13350                 },
13351                 result_ok: false,
13352         }
13353 }
13354 /// Checks if the given object is currently in the success state
13355 #[no_mangle]
13356 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13357         o.result_ok
13358 }
13359 #[no_mangle]
13360 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13361 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13362 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13363         fn drop(&mut self) {
13364                 if self.result_ok {
13365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13367                         }
13368                 } else {
13369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13371                         }
13372                 }
13373         }
13374 }
13375 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13376         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13377                 let contents = if o.result_ok {
13378                         let result = unsafe { o.contents.result };
13379                         unsafe { o.contents.result = core::ptr::null_mut() };
13380                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13381                 } else {
13382                         let err = unsafe { o.contents.err };
13383                         unsafe { o.contents.err = core::ptr::null_mut(); }
13384                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13385                 };
13386                 Self {
13387                         contents,
13388                         result_ok: o.result_ok,
13389                 }
13390         }
13391 }
13392 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13393         fn clone(&self) -> Self {
13394                 if self.result_ok {
13395                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13396                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13397                         } }
13398                 } else {
13399                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13400                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13401                         } }
13402                 }
13403         }
13404 }
13405 #[no_mangle]
13406 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13407 /// but with all dynamically-allocated buffers duplicated in new buffers.
13408 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13409 #[repr(C)]
13410 /// The contents of CResult_UpdateFeeDecodeErrorZ
13411 pub union CResult_UpdateFeeDecodeErrorZPtr {
13412         /// A pointer to the contents in the success state.
13413         /// Reading from this pointer when `result_ok` is not set is undefined.
13414         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13415         /// A pointer to the contents in the error state.
13416         /// Reading from this pointer when `result_ok` is set is undefined.
13417         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13418 }
13419 #[repr(C)]
13420 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13421 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13422 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13423 pub struct CResult_UpdateFeeDecodeErrorZ {
13424         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13425         /// `err` or `result` depending on the state of `result_ok`.
13426         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13427         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13428         pub result_ok: bool,
13429 }
13430 #[no_mangle]
13431 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13432 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13433         CResult_UpdateFeeDecodeErrorZ {
13434                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13435                         result: Box::into_raw(Box::new(o)),
13436                 },
13437                 result_ok: true,
13438         }
13439 }
13440 #[no_mangle]
13441 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13442 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13443         CResult_UpdateFeeDecodeErrorZ {
13444                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13445                         err: Box::into_raw(Box::new(e)),
13446                 },
13447                 result_ok: false,
13448         }
13449 }
13450 /// Checks if the given object is currently in the success state
13451 #[no_mangle]
13452 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13453         o.result_ok
13454 }
13455 #[no_mangle]
13456 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13457 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13458 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13459         fn drop(&mut self) {
13460                 if self.result_ok {
13461                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13462                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13463                         }
13464                 } else {
13465                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13466                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13467                         }
13468                 }
13469         }
13470 }
13471 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13472         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13473                 let contents = if o.result_ok {
13474                         let result = unsafe { o.contents.result };
13475                         unsafe { o.contents.result = core::ptr::null_mut() };
13476                         CResult_UpdateFeeDecodeErrorZPtr { result }
13477                 } else {
13478                         let err = unsafe { o.contents.err };
13479                         unsafe { o.contents.err = core::ptr::null_mut(); }
13480                         CResult_UpdateFeeDecodeErrorZPtr { err }
13481                 };
13482                 Self {
13483                         contents,
13484                         result_ok: o.result_ok,
13485                 }
13486         }
13487 }
13488 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13489         fn clone(&self) -> Self {
13490                 if self.result_ok {
13491                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13492                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13493                         } }
13494                 } else {
13495                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13496                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13497                         } }
13498                 }
13499         }
13500 }
13501 #[no_mangle]
13502 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13503 /// but with all dynamically-allocated buffers duplicated in new buffers.
13504 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13505 #[repr(C)]
13506 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13507 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13508         /// A pointer to the contents in the success state.
13509         /// Reading from this pointer when `result_ok` is not set is undefined.
13510         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13511         /// A pointer to the contents in the error state.
13512         /// Reading from this pointer when `result_ok` is set is undefined.
13513         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13514 }
13515 #[repr(C)]
13516 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13517 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13518 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13519 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13520         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13521         /// `err` or `result` depending on the state of `result_ok`.
13522         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13523         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13524         pub result_ok: bool,
13525 }
13526 #[no_mangle]
13527 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13528 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13529         CResult_UpdateFulfillHTLCDecodeErrorZ {
13530                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13531                         result: Box::into_raw(Box::new(o)),
13532                 },
13533                 result_ok: true,
13534         }
13535 }
13536 #[no_mangle]
13537 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13538 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13539         CResult_UpdateFulfillHTLCDecodeErrorZ {
13540                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13541                         err: Box::into_raw(Box::new(e)),
13542                 },
13543                 result_ok: false,
13544         }
13545 }
13546 /// Checks if the given object is currently in the success state
13547 #[no_mangle]
13548 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13549         o.result_ok
13550 }
13551 #[no_mangle]
13552 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13553 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13554 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13555         fn drop(&mut self) {
13556                 if self.result_ok {
13557                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13558                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13559                         }
13560                 } else {
13561                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13562                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13563                         }
13564                 }
13565         }
13566 }
13567 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13568         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13569                 let contents = if o.result_ok {
13570                         let result = unsafe { o.contents.result };
13571                         unsafe { o.contents.result = core::ptr::null_mut() };
13572                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13573                 } else {
13574                         let err = unsafe { o.contents.err };
13575                         unsafe { o.contents.err = core::ptr::null_mut(); }
13576                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13577                 };
13578                 Self {
13579                         contents,
13580                         result_ok: o.result_ok,
13581                 }
13582         }
13583 }
13584 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13585         fn clone(&self) -> Self {
13586                 if self.result_ok {
13587                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13588                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13589                         } }
13590                 } else {
13591                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13592                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13593                         } }
13594                 }
13595         }
13596 }
13597 #[no_mangle]
13598 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13599 /// but with all dynamically-allocated buffers duplicated in new buffers.
13600 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13601 #[repr(C)]
13602 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13603 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13604         /// A pointer to the contents in the success state.
13605         /// Reading from this pointer when `result_ok` is not set is undefined.
13606         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13607         /// A pointer to the contents in the error state.
13608         /// Reading from this pointer when `result_ok` is set is undefined.
13609         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13610 }
13611 #[repr(C)]
13612 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13613 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13614 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13615 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13616         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13617         /// `err` or `result` depending on the state of `result_ok`.
13618         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13619         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13620         pub result_ok: bool,
13621 }
13622 #[no_mangle]
13623 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13624 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13625         CResult_UpdateAddHTLCDecodeErrorZ {
13626                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13627                         result: Box::into_raw(Box::new(o)),
13628                 },
13629                 result_ok: true,
13630         }
13631 }
13632 #[no_mangle]
13633 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13634 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13635         CResult_UpdateAddHTLCDecodeErrorZ {
13636                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13637                         err: Box::into_raw(Box::new(e)),
13638                 },
13639                 result_ok: false,
13640         }
13641 }
13642 /// Checks if the given object is currently in the success state
13643 #[no_mangle]
13644 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13645         o.result_ok
13646 }
13647 #[no_mangle]
13648 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13649 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13650 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13651         fn drop(&mut self) {
13652                 if self.result_ok {
13653                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13654                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13655                         }
13656                 } else {
13657                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13658                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13659                         }
13660                 }
13661         }
13662 }
13663 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13664         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13665                 let contents = if o.result_ok {
13666                         let result = unsafe { o.contents.result };
13667                         unsafe { o.contents.result = core::ptr::null_mut() };
13668                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13669                 } else {
13670                         let err = unsafe { o.contents.err };
13671                         unsafe { o.contents.err = core::ptr::null_mut(); }
13672                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13673                 };
13674                 Self {
13675                         contents,
13676                         result_ok: o.result_ok,
13677                 }
13678         }
13679 }
13680 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13681         fn clone(&self) -> Self {
13682                 if self.result_ok {
13683                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13684                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13685                         } }
13686                 } else {
13687                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13688                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13689                         } }
13690                 }
13691         }
13692 }
13693 #[no_mangle]
13694 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13695 /// but with all dynamically-allocated buffers duplicated in new buffers.
13696 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13697 #[repr(C)]
13698 /// The contents of CResult_PingDecodeErrorZ
13699 pub union CResult_PingDecodeErrorZPtr {
13700         /// A pointer to the contents in the success state.
13701         /// Reading from this pointer when `result_ok` is not set is undefined.
13702         pub result: *mut crate::lightning::ln::msgs::Ping,
13703         /// A pointer to the contents in the error state.
13704         /// Reading from this pointer when `result_ok` is set is undefined.
13705         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13706 }
13707 #[repr(C)]
13708 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13709 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13710 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13711 pub struct CResult_PingDecodeErrorZ {
13712         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13713         /// `err` or `result` depending on the state of `result_ok`.
13714         pub contents: CResult_PingDecodeErrorZPtr,
13715         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13716         pub result_ok: bool,
13717 }
13718 #[no_mangle]
13719 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13720 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13721         CResult_PingDecodeErrorZ {
13722                 contents: CResult_PingDecodeErrorZPtr {
13723                         result: Box::into_raw(Box::new(o)),
13724                 },
13725                 result_ok: true,
13726         }
13727 }
13728 #[no_mangle]
13729 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13730 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13731         CResult_PingDecodeErrorZ {
13732                 contents: CResult_PingDecodeErrorZPtr {
13733                         err: Box::into_raw(Box::new(e)),
13734                 },
13735                 result_ok: false,
13736         }
13737 }
13738 /// Checks if the given object is currently in the success state
13739 #[no_mangle]
13740 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13741         o.result_ok
13742 }
13743 #[no_mangle]
13744 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13745 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13746 impl Drop for CResult_PingDecodeErrorZ {
13747         fn drop(&mut self) {
13748                 if self.result_ok {
13749                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13750                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13751                         }
13752                 } else {
13753                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13754                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13755                         }
13756                 }
13757         }
13758 }
13759 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13760         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13761                 let contents = if o.result_ok {
13762                         let result = unsafe { o.contents.result };
13763                         unsafe { o.contents.result = core::ptr::null_mut() };
13764                         CResult_PingDecodeErrorZPtr { result }
13765                 } else {
13766                         let err = unsafe { o.contents.err };
13767                         unsafe { o.contents.err = core::ptr::null_mut(); }
13768                         CResult_PingDecodeErrorZPtr { err }
13769                 };
13770                 Self {
13771                         contents,
13772                         result_ok: o.result_ok,
13773                 }
13774         }
13775 }
13776 impl Clone for CResult_PingDecodeErrorZ {
13777         fn clone(&self) -> Self {
13778                 if self.result_ok {
13779                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13780                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13781                         } }
13782                 } else {
13783                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13784                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13785                         } }
13786                 }
13787         }
13788 }
13789 #[no_mangle]
13790 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13791 /// but with all dynamically-allocated buffers duplicated in new buffers.
13792 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13793 #[repr(C)]
13794 /// The contents of CResult_PongDecodeErrorZ
13795 pub union CResult_PongDecodeErrorZPtr {
13796         /// A pointer to the contents in the success state.
13797         /// Reading from this pointer when `result_ok` is not set is undefined.
13798         pub result: *mut crate::lightning::ln::msgs::Pong,
13799         /// A pointer to the contents in the error state.
13800         /// Reading from this pointer when `result_ok` is set is undefined.
13801         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13802 }
13803 #[repr(C)]
13804 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13805 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13806 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13807 pub struct CResult_PongDecodeErrorZ {
13808         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13809         /// `err` or `result` depending on the state of `result_ok`.
13810         pub contents: CResult_PongDecodeErrorZPtr,
13811         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13812         pub result_ok: bool,
13813 }
13814 #[no_mangle]
13815 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13816 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13817         CResult_PongDecodeErrorZ {
13818                 contents: CResult_PongDecodeErrorZPtr {
13819                         result: Box::into_raw(Box::new(o)),
13820                 },
13821                 result_ok: true,
13822         }
13823 }
13824 #[no_mangle]
13825 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13826 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13827         CResult_PongDecodeErrorZ {
13828                 contents: CResult_PongDecodeErrorZPtr {
13829                         err: Box::into_raw(Box::new(e)),
13830                 },
13831                 result_ok: false,
13832         }
13833 }
13834 /// Checks if the given object is currently in the success state
13835 #[no_mangle]
13836 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13837         o.result_ok
13838 }
13839 #[no_mangle]
13840 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13841 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13842 impl Drop for CResult_PongDecodeErrorZ {
13843         fn drop(&mut self) {
13844                 if self.result_ok {
13845                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13846                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13847                         }
13848                 } else {
13849                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13850                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13851                         }
13852                 }
13853         }
13854 }
13855 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13856         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13857                 let contents = if o.result_ok {
13858                         let result = unsafe { o.contents.result };
13859                         unsafe { o.contents.result = core::ptr::null_mut() };
13860                         CResult_PongDecodeErrorZPtr { result }
13861                 } else {
13862                         let err = unsafe { o.contents.err };
13863                         unsafe { o.contents.err = core::ptr::null_mut(); }
13864                         CResult_PongDecodeErrorZPtr { err }
13865                 };
13866                 Self {
13867                         contents,
13868                         result_ok: o.result_ok,
13869                 }
13870         }
13871 }
13872 impl Clone for CResult_PongDecodeErrorZ {
13873         fn clone(&self) -> Self {
13874                 if self.result_ok {
13875                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13876                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13877                         } }
13878                 } else {
13879                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13880                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13881                         } }
13882                 }
13883         }
13884 }
13885 #[no_mangle]
13886 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13887 /// but with all dynamically-allocated buffers duplicated in new buffers.
13888 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13889 #[repr(C)]
13890 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13891 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13892         /// A pointer to the contents in the success state.
13893         /// Reading from this pointer when `result_ok` is not set is undefined.
13894         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13895         /// A pointer to the contents in the error state.
13896         /// Reading from this pointer when `result_ok` is set is undefined.
13897         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13898 }
13899 #[repr(C)]
13900 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13901 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13902 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13903 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13904         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13905         /// `err` or `result` depending on the state of `result_ok`.
13906         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13907         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13908         pub result_ok: bool,
13909 }
13910 #[no_mangle]
13911 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13912 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13913         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13914                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13915                         result: Box::into_raw(Box::new(o)),
13916                 },
13917                 result_ok: true,
13918         }
13919 }
13920 #[no_mangle]
13921 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13922 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13923         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13924                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13925                         err: Box::into_raw(Box::new(e)),
13926                 },
13927                 result_ok: false,
13928         }
13929 }
13930 /// Checks if the given object is currently in the success state
13931 #[no_mangle]
13932 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13933         o.result_ok
13934 }
13935 #[no_mangle]
13936 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13937 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13938 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13939         fn drop(&mut self) {
13940                 if self.result_ok {
13941                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13942                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13943                         }
13944                 } else {
13945                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13946                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13947                         }
13948                 }
13949         }
13950 }
13951 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13952         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13953                 let contents = if o.result_ok {
13954                         let result = unsafe { o.contents.result };
13955                         unsafe { o.contents.result = core::ptr::null_mut() };
13956                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13957                 } else {
13958                         let err = unsafe { o.contents.err };
13959                         unsafe { o.contents.err = core::ptr::null_mut(); }
13960                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13961                 };
13962                 Self {
13963                         contents,
13964                         result_ok: o.result_ok,
13965                 }
13966         }
13967 }
13968 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13969         fn clone(&self) -> Self {
13970                 if self.result_ok {
13971                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13972                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13973                         } }
13974                 } else {
13975                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13976                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13977                         } }
13978                 }
13979         }
13980 }
13981 #[no_mangle]
13982 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13983 /// but with all dynamically-allocated buffers duplicated in new buffers.
13984 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13985 #[repr(C)]
13986 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13987 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13988         /// A pointer to the contents in the success state.
13989         /// Reading from this pointer when `result_ok` is not set is undefined.
13990         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13991         /// A pointer to the contents in the error state.
13992         /// Reading from this pointer when `result_ok` is set is undefined.
13993         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13994 }
13995 #[repr(C)]
13996 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13997 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13998 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13999 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
14000         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
14001         /// `err` or `result` depending on the state of `result_ok`.
14002         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
14003         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
14004         pub result_ok: bool,
14005 }
14006 #[no_mangle]
14007 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
14008 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
14009         CResult_ChannelAnnouncementDecodeErrorZ {
14010                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14011                         result: Box::into_raw(Box::new(o)),
14012                 },
14013                 result_ok: true,
14014         }
14015 }
14016 #[no_mangle]
14017 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
14018 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
14019         CResult_ChannelAnnouncementDecodeErrorZ {
14020                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14021                         err: Box::into_raw(Box::new(e)),
14022                 },
14023                 result_ok: false,
14024         }
14025 }
14026 /// Checks if the given object is currently in the success state
14027 #[no_mangle]
14028 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
14029         o.result_ok
14030 }
14031 #[no_mangle]
14032 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
14033 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
14034 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
14035         fn drop(&mut self) {
14036                 if self.result_ok {
14037                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14038                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14039                         }
14040                 } else {
14041                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14042                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14043                         }
14044                 }
14045         }
14046 }
14047 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
14048         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14049                 let contents = if o.result_ok {
14050                         let result = unsafe { o.contents.result };
14051                         unsafe { o.contents.result = core::ptr::null_mut() };
14052                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
14053                 } else {
14054                         let err = unsafe { o.contents.err };
14055                         unsafe { o.contents.err = core::ptr::null_mut(); }
14056                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
14057                 };
14058                 Self {
14059                         contents,
14060                         result_ok: o.result_ok,
14061                 }
14062         }
14063 }
14064 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
14065         fn clone(&self) -> Self {
14066                 if self.result_ok {
14067                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14068                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
14069                         } }
14070                 } else {
14071                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
14072                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14073                         } }
14074                 }
14075         }
14076 }
14077 #[no_mangle]
14078 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
14079 /// but with all dynamically-allocated buffers duplicated in new buffers.
14080 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14081 #[repr(C)]
14082 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
14083 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14084         /// A pointer to the contents in the success state.
14085         /// Reading from this pointer when `result_ok` is not set is undefined.
14086         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
14087         /// A pointer to the contents in the error state.
14088         /// Reading from this pointer when `result_ok` is set is undefined.
14089         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14090 }
14091 #[repr(C)]
14092 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14093 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14094 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14095 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
14096         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
14097         /// `err` or `result` depending on the state of `result_ok`.
14098         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
14099         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
14100         pub result_ok: bool,
14101 }
14102 #[no_mangle]
14103 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
14104 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14105         CResult_UnsignedChannelUpdateDecodeErrorZ {
14106                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14107                         result: Box::into_raw(Box::new(o)),
14108                 },
14109                 result_ok: true,
14110         }
14111 }
14112 #[no_mangle]
14113 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14114 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14115         CResult_UnsignedChannelUpdateDecodeErrorZ {
14116                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14117                         err: Box::into_raw(Box::new(e)),
14118                 },
14119                 result_ok: false,
14120         }
14121 }
14122 /// Checks if the given object is currently in the success state
14123 #[no_mangle]
14124 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14125         o.result_ok
14126 }
14127 #[no_mangle]
14128 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14129 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14130 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14131         fn drop(&mut self) {
14132                 if self.result_ok {
14133                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14134                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14135                         }
14136                 } else {
14137                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14138                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14139                         }
14140                 }
14141         }
14142 }
14143 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14144         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14145                 let contents = if o.result_ok {
14146                         let result = unsafe { o.contents.result };
14147                         unsafe { o.contents.result = core::ptr::null_mut() };
14148                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14149                 } else {
14150                         let err = unsafe { o.contents.err };
14151                         unsafe { o.contents.err = core::ptr::null_mut(); }
14152                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14153                 };
14154                 Self {
14155                         contents,
14156                         result_ok: o.result_ok,
14157                 }
14158         }
14159 }
14160 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14161         fn clone(&self) -> Self {
14162                 if self.result_ok {
14163                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14164                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14165                         } }
14166                 } else {
14167                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14168                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14169                         } }
14170                 }
14171         }
14172 }
14173 #[no_mangle]
14174 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14175 /// but with all dynamically-allocated buffers duplicated in new buffers.
14176 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14177 #[repr(C)]
14178 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14179 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14180         /// A pointer to the contents in the success state.
14181         /// Reading from this pointer when `result_ok` is not set is undefined.
14182         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14183         /// A pointer to the contents in the error state.
14184         /// Reading from this pointer when `result_ok` is set is undefined.
14185         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14186 }
14187 #[repr(C)]
14188 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14189 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14190 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14191 pub struct CResult_ChannelUpdateDecodeErrorZ {
14192         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14193         /// `err` or `result` depending on the state of `result_ok`.
14194         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14195         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14196         pub result_ok: bool,
14197 }
14198 #[no_mangle]
14199 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14200 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14201         CResult_ChannelUpdateDecodeErrorZ {
14202                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14203                         result: Box::into_raw(Box::new(o)),
14204                 },
14205                 result_ok: true,
14206         }
14207 }
14208 #[no_mangle]
14209 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14210 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14211         CResult_ChannelUpdateDecodeErrorZ {
14212                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14213                         err: Box::into_raw(Box::new(e)),
14214                 },
14215                 result_ok: false,
14216         }
14217 }
14218 /// Checks if the given object is currently in the success state
14219 #[no_mangle]
14220 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14221         o.result_ok
14222 }
14223 #[no_mangle]
14224 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14225 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14226 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14227         fn drop(&mut self) {
14228                 if self.result_ok {
14229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14231                         }
14232                 } else {
14233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14235                         }
14236                 }
14237         }
14238 }
14239 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14240         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14241                 let contents = if o.result_ok {
14242                         let result = unsafe { o.contents.result };
14243                         unsafe { o.contents.result = core::ptr::null_mut() };
14244                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14245                 } else {
14246                         let err = unsafe { o.contents.err };
14247                         unsafe { o.contents.err = core::ptr::null_mut(); }
14248                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14249                 };
14250                 Self {
14251                         contents,
14252                         result_ok: o.result_ok,
14253                 }
14254         }
14255 }
14256 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14257         fn clone(&self) -> Self {
14258                 if self.result_ok {
14259                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14260                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14261                         } }
14262                 } else {
14263                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14264                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14265                         } }
14266                 }
14267         }
14268 }
14269 #[no_mangle]
14270 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14271 /// but with all dynamically-allocated buffers duplicated in new buffers.
14272 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14273 #[repr(C)]
14274 /// The contents of CResult_ErrorMessageDecodeErrorZ
14275 pub union CResult_ErrorMessageDecodeErrorZPtr {
14276         /// A pointer to the contents in the success state.
14277         /// Reading from this pointer when `result_ok` is not set is undefined.
14278         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14279         /// A pointer to the contents in the error state.
14280         /// Reading from this pointer when `result_ok` is set is undefined.
14281         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14282 }
14283 #[repr(C)]
14284 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14285 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14287 pub struct CResult_ErrorMessageDecodeErrorZ {
14288         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14289         /// `err` or `result` depending on the state of `result_ok`.
14290         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14291         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14292         pub result_ok: bool,
14293 }
14294 #[no_mangle]
14295 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14296 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14297         CResult_ErrorMessageDecodeErrorZ {
14298                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14299                         result: Box::into_raw(Box::new(o)),
14300                 },
14301                 result_ok: true,
14302         }
14303 }
14304 #[no_mangle]
14305 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14306 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14307         CResult_ErrorMessageDecodeErrorZ {
14308                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14309                         err: Box::into_raw(Box::new(e)),
14310                 },
14311                 result_ok: false,
14312         }
14313 }
14314 /// Checks if the given object is currently in the success state
14315 #[no_mangle]
14316 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14317         o.result_ok
14318 }
14319 #[no_mangle]
14320 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14321 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14322 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14323         fn drop(&mut self) {
14324                 if self.result_ok {
14325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14327                         }
14328                 } else {
14329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14331                         }
14332                 }
14333         }
14334 }
14335 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14336         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14337                 let contents = if o.result_ok {
14338                         let result = unsafe { o.contents.result };
14339                         unsafe { o.contents.result = core::ptr::null_mut() };
14340                         CResult_ErrorMessageDecodeErrorZPtr { result }
14341                 } else {
14342                         let err = unsafe { o.contents.err };
14343                         unsafe { o.contents.err = core::ptr::null_mut(); }
14344                         CResult_ErrorMessageDecodeErrorZPtr { err }
14345                 };
14346                 Self {
14347                         contents,
14348                         result_ok: o.result_ok,
14349                 }
14350         }
14351 }
14352 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14353         fn clone(&self) -> Self {
14354                 if self.result_ok {
14355                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14356                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14357                         } }
14358                 } else {
14359                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14360                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14361                         } }
14362                 }
14363         }
14364 }
14365 #[no_mangle]
14366 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14367 /// but with all dynamically-allocated buffers duplicated in new buffers.
14368 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14369 #[repr(C)]
14370 /// The contents of CResult_WarningMessageDecodeErrorZ
14371 pub union CResult_WarningMessageDecodeErrorZPtr {
14372         /// A pointer to the contents in the success state.
14373         /// Reading from this pointer when `result_ok` is not set is undefined.
14374         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14375         /// A pointer to the contents in the error state.
14376         /// Reading from this pointer when `result_ok` is set is undefined.
14377         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14378 }
14379 #[repr(C)]
14380 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14381 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14383 pub struct CResult_WarningMessageDecodeErrorZ {
14384         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14385         /// `err` or `result` depending on the state of `result_ok`.
14386         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14387         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14388         pub result_ok: bool,
14389 }
14390 #[no_mangle]
14391 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14392 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14393         CResult_WarningMessageDecodeErrorZ {
14394                 contents: CResult_WarningMessageDecodeErrorZPtr {
14395                         result: Box::into_raw(Box::new(o)),
14396                 },
14397                 result_ok: true,
14398         }
14399 }
14400 #[no_mangle]
14401 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14402 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14403         CResult_WarningMessageDecodeErrorZ {
14404                 contents: CResult_WarningMessageDecodeErrorZPtr {
14405                         err: Box::into_raw(Box::new(e)),
14406                 },
14407                 result_ok: false,
14408         }
14409 }
14410 /// Checks if the given object is currently in the success state
14411 #[no_mangle]
14412 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14413         o.result_ok
14414 }
14415 #[no_mangle]
14416 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14417 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14418 impl Drop for CResult_WarningMessageDecodeErrorZ {
14419         fn drop(&mut self) {
14420                 if self.result_ok {
14421                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14422                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14423                         }
14424                 } else {
14425                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14426                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14427                         }
14428                 }
14429         }
14430 }
14431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14432         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14433                 let contents = if o.result_ok {
14434                         let result = unsafe { o.contents.result };
14435                         unsafe { o.contents.result = core::ptr::null_mut() };
14436                         CResult_WarningMessageDecodeErrorZPtr { result }
14437                 } else {
14438                         let err = unsafe { o.contents.err };
14439                         unsafe { o.contents.err = core::ptr::null_mut(); }
14440                         CResult_WarningMessageDecodeErrorZPtr { err }
14441                 };
14442                 Self {
14443                         contents,
14444                         result_ok: o.result_ok,
14445                 }
14446         }
14447 }
14448 impl Clone for CResult_WarningMessageDecodeErrorZ {
14449         fn clone(&self) -> Self {
14450                 if self.result_ok {
14451                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14452                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14453                         } }
14454                 } else {
14455                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14456                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14457                         } }
14458                 }
14459         }
14460 }
14461 #[no_mangle]
14462 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14463 /// but with all dynamically-allocated buffers duplicated in new buffers.
14464 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14465 #[repr(C)]
14466 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14467 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14468         /// A pointer to the contents in the success state.
14469         /// Reading from this pointer when `result_ok` is not set is undefined.
14470         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14471         /// A pointer to the contents in the error state.
14472         /// Reading from this pointer when `result_ok` is set is undefined.
14473         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14474 }
14475 #[repr(C)]
14476 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14477 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14479 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14480         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14481         /// `err` or `result` depending on the state of `result_ok`.
14482         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14483         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14484         pub result_ok: bool,
14485 }
14486 #[no_mangle]
14487 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14488 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14489         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14490                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14491                         result: Box::into_raw(Box::new(o)),
14492                 },
14493                 result_ok: true,
14494         }
14495 }
14496 #[no_mangle]
14497 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14498 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14499         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14500                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14501                         err: Box::into_raw(Box::new(e)),
14502                 },
14503                 result_ok: false,
14504         }
14505 }
14506 /// Checks if the given object is currently in the success state
14507 #[no_mangle]
14508 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14509         o.result_ok
14510 }
14511 #[no_mangle]
14512 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14513 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14514 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14515         fn drop(&mut self) {
14516                 if self.result_ok {
14517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14519                         }
14520                 } else {
14521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14523                         }
14524                 }
14525         }
14526 }
14527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14529                 let contents = if o.result_ok {
14530                         let result = unsafe { o.contents.result };
14531                         unsafe { o.contents.result = core::ptr::null_mut() };
14532                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14533                 } else {
14534                         let err = unsafe { o.contents.err };
14535                         unsafe { o.contents.err = core::ptr::null_mut(); }
14536                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14537                 };
14538                 Self {
14539                         contents,
14540                         result_ok: o.result_ok,
14541                 }
14542         }
14543 }
14544 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14545         fn clone(&self) -> Self {
14546                 if self.result_ok {
14547                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14548                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14549                         } }
14550                 } else {
14551                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14552                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14553                         } }
14554                 }
14555         }
14556 }
14557 #[no_mangle]
14558 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14559 /// but with all dynamically-allocated buffers duplicated in new buffers.
14560 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14561 #[repr(C)]
14562 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14563 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14564         /// A pointer to the contents in the success state.
14565         /// Reading from this pointer when `result_ok` is not set is undefined.
14566         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14567         /// A pointer to the contents in the error state.
14568         /// Reading from this pointer when `result_ok` is set is undefined.
14569         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14570 }
14571 #[repr(C)]
14572 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14573 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14575 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14576         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14577         /// `err` or `result` depending on the state of `result_ok`.
14578         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14579         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14580         pub result_ok: bool,
14581 }
14582 #[no_mangle]
14583 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14584 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14585         CResult_NodeAnnouncementDecodeErrorZ {
14586                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14587                         result: Box::into_raw(Box::new(o)),
14588                 },
14589                 result_ok: true,
14590         }
14591 }
14592 #[no_mangle]
14593 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14594 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14595         CResult_NodeAnnouncementDecodeErrorZ {
14596                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14597                         err: Box::into_raw(Box::new(e)),
14598                 },
14599                 result_ok: false,
14600         }
14601 }
14602 /// Checks if the given object is currently in the success state
14603 #[no_mangle]
14604 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14605         o.result_ok
14606 }
14607 #[no_mangle]
14608 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14609 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14610 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14611         fn drop(&mut self) {
14612                 if self.result_ok {
14613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14615                         }
14616                 } else {
14617                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14618                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14619                         }
14620                 }
14621         }
14622 }
14623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14624         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14625                 let contents = if o.result_ok {
14626                         let result = unsafe { o.contents.result };
14627                         unsafe { o.contents.result = core::ptr::null_mut() };
14628                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14629                 } else {
14630                         let err = unsafe { o.contents.err };
14631                         unsafe { o.contents.err = core::ptr::null_mut(); }
14632                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14633                 };
14634                 Self {
14635                         contents,
14636                         result_ok: o.result_ok,
14637                 }
14638         }
14639 }
14640 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14641         fn clone(&self) -> Self {
14642                 if self.result_ok {
14643                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14644                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14645                         } }
14646                 } else {
14647                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14648                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14649                         } }
14650                 }
14651         }
14652 }
14653 #[no_mangle]
14654 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14655 /// but with all dynamically-allocated buffers duplicated in new buffers.
14656 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14657 #[repr(C)]
14658 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14659 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14660         /// A pointer to the contents in the success state.
14661         /// Reading from this pointer when `result_ok` is not set is undefined.
14662         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14663         /// A pointer to the contents in the error state.
14664         /// Reading from this pointer when `result_ok` is set is undefined.
14665         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14666 }
14667 #[repr(C)]
14668 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14669 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14670 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14671 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14672         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14673         /// `err` or `result` depending on the state of `result_ok`.
14674         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14675         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14676         pub result_ok: bool,
14677 }
14678 #[no_mangle]
14679 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14680 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14681         CResult_QueryShortChannelIdsDecodeErrorZ {
14682                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14683                         result: Box::into_raw(Box::new(o)),
14684                 },
14685                 result_ok: true,
14686         }
14687 }
14688 #[no_mangle]
14689 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14690 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14691         CResult_QueryShortChannelIdsDecodeErrorZ {
14692                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14693                         err: Box::into_raw(Box::new(e)),
14694                 },
14695                 result_ok: false,
14696         }
14697 }
14698 /// Checks if the given object is currently in the success state
14699 #[no_mangle]
14700 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14701         o.result_ok
14702 }
14703 #[no_mangle]
14704 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14705 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14706 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14707         fn drop(&mut self) {
14708                 if self.result_ok {
14709                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14710                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14711                         }
14712                 } else {
14713                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14714                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14715                         }
14716                 }
14717         }
14718 }
14719 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14720         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14721                 let contents = if o.result_ok {
14722                         let result = unsafe { o.contents.result };
14723                         unsafe { o.contents.result = core::ptr::null_mut() };
14724                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14725                 } else {
14726                         let err = unsafe { o.contents.err };
14727                         unsafe { o.contents.err = core::ptr::null_mut(); }
14728                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14729                 };
14730                 Self {
14731                         contents,
14732                         result_ok: o.result_ok,
14733                 }
14734         }
14735 }
14736 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14737         fn clone(&self) -> Self {
14738                 if self.result_ok {
14739                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14740                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14741                         } }
14742                 } else {
14743                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14744                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14745                         } }
14746                 }
14747         }
14748 }
14749 #[no_mangle]
14750 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14751 /// but with all dynamically-allocated buffers duplicated in new buffers.
14752 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14753 #[repr(C)]
14754 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14755 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14756         /// A pointer to the contents in the success state.
14757         /// Reading from this pointer when `result_ok` is not set is undefined.
14758         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14759         /// A pointer to the contents in the error state.
14760         /// Reading from this pointer when `result_ok` is set is undefined.
14761         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14762 }
14763 #[repr(C)]
14764 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14765 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14766 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14767 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14768         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14769         /// `err` or `result` depending on the state of `result_ok`.
14770         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14771         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14772         pub result_ok: bool,
14773 }
14774 #[no_mangle]
14775 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14776 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14777         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14778                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14779                         result: Box::into_raw(Box::new(o)),
14780                 },
14781                 result_ok: true,
14782         }
14783 }
14784 #[no_mangle]
14785 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14786 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14787         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14788                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14789                         err: Box::into_raw(Box::new(e)),
14790                 },
14791                 result_ok: false,
14792         }
14793 }
14794 /// Checks if the given object is currently in the success state
14795 #[no_mangle]
14796 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14797         o.result_ok
14798 }
14799 #[no_mangle]
14800 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14801 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14802 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14803         fn drop(&mut self) {
14804                 if self.result_ok {
14805                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14806                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14807                         }
14808                 } else {
14809                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14810                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14811                         }
14812                 }
14813         }
14814 }
14815 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14816         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14817                 let contents = if o.result_ok {
14818                         let result = unsafe { o.contents.result };
14819                         unsafe { o.contents.result = core::ptr::null_mut() };
14820                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14821                 } else {
14822                         let err = unsafe { o.contents.err };
14823                         unsafe { o.contents.err = core::ptr::null_mut(); }
14824                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14825                 };
14826                 Self {
14827                         contents,
14828                         result_ok: o.result_ok,
14829                 }
14830         }
14831 }
14832 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14833         fn clone(&self) -> Self {
14834                 if self.result_ok {
14835                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14836                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14837                         } }
14838                 } else {
14839                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14840                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14841                         } }
14842                 }
14843         }
14844 }
14845 #[no_mangle]
14846 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14847 /// but with all dynamically-allocated buffers duplicated in new buffers.
14848 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14849 #[repr(C)]
14850 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14851 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14852         /// A pointer to the contents in the success state.
14853         /// Reading from this pointer when `result_ok` is not set is undefined.
14854         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14855         /// A pointer to the contents in the error state.
14856         /// Reading from this pointer when `result_ok` is set is undefined.
14857         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14858 }
14859 #[repr(C)]
14860 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14861 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14862 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14863 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14864         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14865         /// `err` or `result` depending on the state of `result_ok`.
14866         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14867         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14868         pub result_ok: bool,
14869 }
14870 #[no_mangle]
14871 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14872 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14873         CResult_QueryChannelRangeDecodeErrorZ {
14874                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14875                         result: Box::into_raw(Box::new(o)),
14876                 },
14877                 result_ok: true,
14878         }
14879 }
14880 #[no_mangle]
14881 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14882 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14883         CResult_QueryChannelRangeDecodeErrorZ {
14884                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14885                         err: Box::into_raw(Box::new(e)),
14886                 },
14887                 result_ok: false,
14888         }
14889 }
14890 /// Checks if the given object is currently in the success state
14891 #[no_mangle]
14892 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14893         o.result_ok
14894 }
14895 #[no_mangle]
14896 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14897 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14898 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14899         fn drop(&mut self) {
14900                 if self.result_ok {
14901                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14902                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14903                         }
14904                 } else {
14905                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14906                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14907                         }
14908                 }
14909         }
14910 }
14911 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14912         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14913                 let contents = if o.result_ok {
14914                         let result = unsafe { o.contents.result };
14915                         unsafe { o.contents.result = core::ptr::null_mut() };
14916                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14917                 } else {
14918                         let err = unsafe { o.contents.err };
14919                         unsafe { o.contents.err = core::ptr::null_mut(); }
14920                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14921                 };
14922                 Self {
14923                         contents,
14924                         result_ok: o.result_ok,
14925                 }
14926         }
14927 }
14928 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14929         fn clone(&self) -> Self {
14930                 if self.result_ok {
14931                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14932                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14933                         } }
14934                 } else {
14935                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14936                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14937                         } }
14938                 }
14939         }
14940 }
14941 #[no_mangle]
14942 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14943 /// but with all dynamically-allocated buffers duplicated in new buffers.
14944 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14945 #[repr(C)]
14946 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14947 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14948         /// A pointer to the contents in the success state.
14949         /// Reading from this pointer when `result_ok` is not set is undefined.
14950         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14951         /// A pointer to the contents in the error state.
14952         /// Reading from this pointer when `result_ok` is set is undefined.
14953         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14954 }
14955 #[repr(C)]
14956 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14957 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14958 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14959 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14960         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14961         /// `err` or `result` depending on the state of `result_ok`.
14962         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14963         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14964         pub result_ok: bool,
14965 }
14966 #[no_mangle]
14967 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14968 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14969         CResult_ReplyChannelRangeDecodeErrorZ {
14970                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14971                         result: Box::into_raw(Box::new(o)),
14972                 },
14973                 result_ok: true,
14974         }
14975 }
14976 #[no_mangle]
14977 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14978 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14979         CResult_ReplyChannelRangeDecodeErrorZ {
14980                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14981                         err: Box::into_raw(Box::new(e)),
14982                 },
14983                 result_ok: false,
14984         }
14985 }
14986 /// Checks if the given object is currently in the success state
14987 #[no_mangle]
14988 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
14989         o.result_ok
14990 }
14991 #[no_mangle]
14992 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
14993 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
14994 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
14995         fn drop(&mut self) {
14996                 if self.result_ok {
14997                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14998                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14999                         }
15000                 } else {
15001                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15002                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15003                         }
15004                 }
15005         }
15006 }
15007 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
15008         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
15009                 let contents = if o.result_ok {
15010                         let result = unsafe { o.contents.result };
15011                         unsafe { o.contents.result = core::ptr::null_mut() };
15012                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
15013                 } else {
15014                         let err = unsafe { o.contents.err };
15015                         unsafe { o.contents.err = core::ptr::null_mut(); }
15016                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
15017                 };
15018                 Self {
15019                         contents,
15020                         result_ok: o.result_ok,
15021                 }
15022         }
15023 }
15024 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
15025         fn clone(&self) -> Self {
15026                 if self.result_ok {
15027                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15028                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
15029                         } }
15030                 } else {
15031                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
15032                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15033                         } }
15034                 }
15035         }
15036 }
15037 #[no_mangle]
15038 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
15039 /// but with all dynamically-allocated buffers duplicated in new buffers.
15040 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
15041 #[repr(C)]
15042 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
15043 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
15044         /// A pointer to the contents in the success state.
15045         /// Reading from this pointer when `result_ok` is not set is undefined.
15046         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
15047         /// A pointer to the contents in the error state.
15048         /// Reading from this pointer when `result_ok` is set is undefined.
15049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
15050 }
15051 #[repr(C)]
15052 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
15053 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
15054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15055 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
15056         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
15057         /// `err` or `result` depending on the state of `result_ok`.
15058         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
15059         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
15060         pub result_ok: bool,
15061 }
15062 #[no_mangle]
15063 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
15064 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
15065         CResult_GossipTimestampFilterDecodeErrorZ {
15066                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15067                         result: Box::into_raw(Box::new(o)),
15068                 },
15069                 result_ok: true,
15070         }
15071 }
15072 #[no_mangle]
15073 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
15074 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
15075         CResult_GossipTimestampFilterDecodeErrorZ {
15076                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15077                         err: Box::into_raw(Box::new(e)),
15078                 },
15079                 result_ok: false,
15080         }
15081 }
15082 /// Checks if the given object is currently in the success state
15083 #[no_mangle]
15084 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
15085         o.result_ok
15086 }
15087 #[no_mangle]
15088 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
15089 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
15090 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
15091         fn drop(&mut self) {
15092                 if self.result_ok {
15093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15095                         }
15096                 } else {
15097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15099                         }
15100                 }
15101         }
15102 }
15103 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
15104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15105                 let contents = if o.result_ok {
15106                         let result = unsafe { o.contents.result };
15107                         unsafe { o.contents.result = core::ptr::null_mut() };
15108                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15109                 } else {
15110                         let err = unsafe { o.contents.err };
15111                         unsafe { o.contents.err = core::ptr::null_mut(); }
15112                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15113                 };
15114                 Self {
15115                         contents,
15116                         result_ok: o.result_ok,
15117                 }
15118         }
15119 }
15120 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15121         fn clone(&self) -> Self {
15122                 if self.result_ok {
15123                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15124                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15125                         } }
15126                 } else {
15127                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15129                         } }
15130                 }
15131         }
15132 }
15133 #[no_mangle]
15134 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15135 /// but with all dynamically-allocated buffers duplicated in new buffers.
15136 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15137 #[repr(C)]
15138 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15139 /// This corresponds to std::vector in C++
15140 pub struct CVec_PhantomRouteHintsZ {
15141         /// The elements in the array.
15142         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15143         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15144         /// The number of elements pointed to by `data`.
15145         pub datalen: usize
15146 }
15147 impl CVec_PhantomRouteHintsZ {
15148         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15149                 if self.datalen == 0 { return Vec::new(); }
15150                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15151                 self.data = core::ptr::null_mut();
15152                 self.datalen = 0;
15153                 ret
15154         }
15155         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15156                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15157         }
15158 }
15159 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15160         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15161                 let datalen = v.len();
15162                 let data = Box::into_raw(v.into_boxed_slice());
15163                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15164         }
15165 }
15166 #[no_mangle]
15167 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15168 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15169 impl Drop for CVec_PhantomRouteHintsZ {
15170         fn drop(&mut self) {
15171                 if self.datalen == 0 { return; }
15172                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15173         }
15174 }
15175 impl Clone for CVec_PhantomRouteHintsZ {
15176         fn clone(&self) -> Self {
15177                 let mut res = Vec::new();
15178                 if self.datalen == 0 { return Self::from(res); }
15179                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15180                 Self::from(res)
15181         }
15182 }
15183 #[repr(C)]
15184 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15185 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15186         /// A pointer to the contents in the success state.
15187         /// Reading from this pointer when `result_ok` is not set is undefined.
15188         pub result: *mut crate::lightning_invoice::Invoice,
15189         /// A pointer to the contents in the error state.
15190         /// Reading from this pointer when `result_ok` is set is undefined.
15191         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15192 }
15193 #[repr(C)]
15194 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15195 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15196 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15197 pub struct CResult_InvoiceSignOrCreationErrorZ {
15198         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15199         /// `err` or `result` depending on the state of `result_ok`.
15200         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15201         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15202         pub result_ok: bool,
15203 }
15204 #[no_mangle]
15205 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15206 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15207         CResult_InvoiceSignOrCreationErrorZ {
15208                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15209                         result: Box::into_raw(Box::new(o)),
15210                 },
15211                 result_ok: true,
15212         }
15213 }
15214 #[no_mangle]
15215 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15216 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15217         CResult_InvoiceSignOrCreationErrorZ {
15218                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15219                         err: Box::into_raw(Box::new(e)),
15220                 },
15221                 result_ok: false,
15222         }
15223 }
15224 /// Checks if the given object is currently in the success state
15225 #[no_mangle]
15226 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15227         o.result_ok
15228 }
15229 #[no_mangle]
15230 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15231 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15232 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15233         fn drop(&mut self) {
15234                 if self.result_ok {
15235                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15236                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15237                         }
15238                 } else {
15239                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15240                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15241                         }
15242                 }
15243         }
15244 }
15245 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15246         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15247                 let contents = if o.result_ok {
15248                         let result = unsafe { o.contents.result };
15249                         unsafe { o.contents.result = core::ptr::null_mut() };
15250                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15251                 } else {
15252                         let err = unsafe { o.contents.err };
15253                         unsafe { o.contents.err = core::ptr::null_mut(); }
15254                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15255                 };
15256                 Self {
15257                         contents,
15258                         result_ok: o.result_ok,
15259                 }
15260         }
15261 }
15262 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15263         fn clone(&self) -> Self {
15264                 if self.result_ok {
15265                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15266                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15267                         } }
15268                 } else {
15269                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15270                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15271                         } }
15272                 }
15273         }
15274 }
15275 #[no_mangle]
15276 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15277 /// but with all dynamically-allocated buffers duplicated in new buffers.
15278 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15279 #[repr(C)]
15280 /// An enum which can either contain a crate::lightning::chain::Filter or not
15281 pub enum COption_FilterZ {
15282         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15283         Some(crate::lightning::chain::Filter),
15284         /// When we're in this state, this COption_FilterZ contains nothing
15285         None
15286 }
15287 impl COption_FilterZ {
15288         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15289                 if let Self::None = self { false } else { true }
15290         }
15291         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15292                 !self.is_some()
15293         }
15294         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15295                 if let Self::Some(v) = self { v } else { unreachable!() }
15296         }
15297 }
15298 #[no_mangle]
15299 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15300 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15301         COption_FilterZ::Some(o)
15302 }
15303 #[no_mangle]
15304 /// Constructs a new COption_FilterZ containing nothing
15305 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15306         COption_FilterZ::None
15307 }
15308 #[no_mangle]
15309 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15310 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15311 #[repr(C)]
15312 /// The contents of CResult_LockedChannelMonitorNoneZ
15313 pub union CResult_LockedChannelMonitorNoneZPtr {
15314         /// A pointer to the contents in the success state.
15315         /// Reading from this pointer when `result_ok` is not set is undefined.
15316         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15317         /// Note that this value is always NULL, as there are no contents in the Err variant
15318         pub err: *mut core::ffi::c_void,
15319 }
15320 #[repr(C)]
15321 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15322 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15323 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15324 pub struct CResult_LockedChannelMonitorNoneZ {
15325         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15326         /// `err` or `result` depending on the state of `result_ok`.
15327         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15328         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15329         pub result_ok: bool,
15330 }
15331 #[no_mangle]
15332 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15333 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15334         CResult_LockedChannelMonitorNoneZ {
15335                 contents: CResult_LockedChannelMonitorNoneZPtr {
15336                         result: Box::into_raw(Box::new(o)),
15337                 },
15338                 result_ok: true,
15339         }
15340 }
15341 #[no_mangle]
15342 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15343 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15344         CResult_LockedChannelMonitorNoneZ {
15345                 contents: CResult_LockedChannelMonitorNoneZPtr {
15346                         err: core::ptr::null_mut(),
15347                 },
15348                 result_ok: false,
15349         }
15350 }
15351 /// Checks if the given object is currently in the success state
15352 #[no_mangle]
15353 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15354         o.result_ok
15355 }
15356 #[no_mangle]
15357 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15358 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15359 impl Drop for CResult_LockedChannelMonitorNoneZ {
15360         fn drop(&mut self) {
15361                 if self.result_ok {
15362                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15363                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15364                         }
15365                 } else {
15366                 }
15367         }
15368 }
15369 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15370         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15371                 let contents = if o.result_ok {
15372                         let result = unsafe { o.contents.result };
15373                         unsafe { o.contents.result = core::ptr::null_mut() };
15374                         CResult_LockedChannelMonitorNoneZPtr { result }
15375                 } else {
15376                         let _ = unsafe { Box::from_raw(o.contents.err) };
15377                         o.contents.err = core::ptr::null_mut();
15378                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15379                 };
15380                 Self {
15381                         contents,
15382                         result_ok: o.result_ok,
15383                 }
15384         }
15385 }
15386 #[repr(C)]
15387 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15388 /// This corresponds to std::vector in C++
15389 pub struct CVec_OutPointZ {
15390         /// The elements in the array.
15391         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15392         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15393         /// The number of elements pointed to by `data`.
15394         pub datalen: usize
15395 }
15396 impl CVec_OutPointZ {
15397         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15398                 if self.datalen == 0 { return Vec::new(); }
15399                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15400                 self.data = core::ptr::null_mut();
15401                 self.datalen = 0;
15402                 ret
15403         }
15404         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15405                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15406         }
15407 }
15408 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15409         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15410                 let datalen = v.len();
15411                 let data = Box::into_raw(v.into_boxed_slice());
15412                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15413         }
15414 }
15415 #[no_mangle]
15416 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15417 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15418 impl Drop for CVec_OutPointZ {
15419         fn drop(&mut self) {
15420                 if self.datalen == 0 { return; }
15421                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15422         }
15423 }
15424 impl Clone for CVec_OutPointZ {
15425         fn clone(&self) -> Self {
15426                 let mut res = Vec::new();
15427                 if self.datalen == 0 { return Self::from(res); }
15428                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15429                 Self::from(res)
15430         }
15431 }