b531374e80d5cdf2addd10f25dc5c86648f25edb
[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 #[repr(C)]
274 /// The contents of CResult_PublicKeyErrorZ
275 pub union CResult_PublicKeyErrorZPtr {
276         /// A pointer to the contents in the success state.
277         /// Reading from this pointer when `result_ok` is not set is undefined.
278         pub result: *mut crate::c_types::PublicKey,
279         /// A pointer to the contents in the error state.
280         /// Reading from this pointer when `result_ok` is set is undefined.
281         pub err: *mut crate::c_types::Secp256k1Error,
282 }
283 #[repr(C)]
284 /// A CResult_PublicKeyErrorZ represents the result of a fallible operation,
285 /// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
286 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
287 pub struct CResult_PublicKeyErrorZ {
288         /// The contents of this CResult_PublicKeyErrorZ, accessible via either
289         /// `err` or `result` depending on the state of `result_ok`.
290         pub contents: CResult_PublicKeyErrorZPtr,
291         /// Whether this CResult_PublicKeyErrorZ represents a success state.
292         pub result_ok: bool,
293 }
294 #[no_mangle]
295 /// Creates a new CResult_PublicKeyErrorZ in the success state.
296 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
297         CResult_PublicKeyErrorZ {
298                 contents: CResult_PublicKeyErrorZPtr {
299                         result: Box::into_raw(Box::new(o)),
300                 },
301                 result_ok: true,
302         }
303 }
304 #[no_mangle]
305 /// Creates a new CResult_PublicKeyErrorZ in the error state.
306 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
307         CResult_PublicKeyErrorZ {
308                 contents: CResult_PublicKeyErrorZPtr {
309                         err: Box::into_raw(Box::new(e)),
310                 },
311                 result_ok: false,
312         }
313 }
314 /// Checks if the given object is currently in the success state
315 #[no_mangle]
316 pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool {
317         o.result_ok
318 }
319 #[no_mangle]
320 /// Frees any resources used by the CResult_PublicKeyErrorZ.
321 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
322 impl Drop for CResult_PublicKeyErrorZ {
323         fn drop(&mut self) {
324                 if self.result_ok {
325                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
326                                 let _ = unsafe { Box::from_raw(self.contents.result) };
327                         }
328                 } else {
329                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
330                                 let _ = unsafe { Box::from_raw(self.contents.err) };
331                         }
332                 }
333         }
334 }
335 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
336         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
337                 let contents = if o.result_ok {
338                         let result = unsafe { o.contents.result };
339                         unsafe { o.contents.result = core::ptr::null_mut() };
340                         CResult_PublicKeyErrorZPtr { result }
341                 } else {
342                         let err = unsafe { o.contents.err };
343                         unsafe { o.contents.err = core::ptr::null_mut(); }
344                         CResult_PublicKeyErrorZPtr { err }
345                 };
346                 Self {
347                         contents,
348                         result_ok: o.result_ok,
349                 }
350         }
351 }
352 impl Clone for CResult_PublicKeyErrorZ {
353         fn clone(&self) -> Self {
354                 if self.result_ok {
355                         Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr {
356                                 result: Box::into_raw(Box::new(<crate::c_types::PublicKey>::clone(unsafe { &*self.contents.result })))
357                         } }
358                 } else {
359                         Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr {
360                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
361                         } }
362                 }
363         }
364 }
365 #[no_mangle]
366 /// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
367 /// but with all dynamically-allocated buffers duplicated in new buffers.
368 pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) }
369 #[repr(C)]
370 /// The contents of CResult_TxCreationKeysDecodeErrorZ
371 pub union CResult_TxCreationKeysDecodeErrorZPtr {
372         /// A pointer to the contents in the success state.
373         /// Reading from this pointer when `result_ok` is not set is undefined.
374         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
375         /// A pointer to the contents in the error state.
376         /// Reading from this pointer when `result_ok` is set is undefined.
377         pub err: *mut crate::lightning::ln::msgs::DecodeError,
378 }
379 #[repr(C)]
380 /// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
381 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
382 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
383 pub struct CResult_TxCreationKeysDecodeErrorZ {
384         /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
385         /// `err` or `result` depending on the state of `result_ok`.
386         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
387         /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
388         pub result_ok: bool,
389 }
390 #[no_mangle]
391 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
392 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
393         CResult_TxCreationKeysDecodeErrorZ {
394                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
395                         result: Box::into_raw(Box::new(o)),
396                 },
397                 result_ok: true,
398         }
399 }
400 #[no_mangle]
401 /// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
402 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
403         CResult_TxCreationKeysDecodeErrorZ {
404                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
405                         err: Box::into_raw(Box::new(e)),
406                 },
407                 result_ok: false,
408         }
409 }
410 /// Checks if the given object is currently in the success state
411 #[no_mangle]
412 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool {
413         o.result_ok
414 }
415 #[no_mangle]
416 /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
417 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
418 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
419         fn drop(&mut self) {
420                 if self.result_ok {
421                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
422                                 let _ = unsafe { Box::from_raw(self.contents.result) };
423                         }
424                 } else {
425                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
426                                 let _ = unsafe { Box::from_raw(self.contents.err) };
427                         }
428                 }
429         }
430 }
431 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
432         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
433                 let contents = if o.result_ok {
434                         let result = unsafe { o.contents.result };
435                         unsafe { o.contents.result = core::ptr::null_mut() };
436                         CResult_TxCreationKeysDecodeErrorZPtr { result }
437                 } else {
438                         let err = unsafe { o.contents.err };
439                         unsafe { o.contents.err = core::ptr::null_mut(); }
440                         CResult_TxCreationKeysDecodeErrorZPtr { err }
441                 };
442                 Self {
443                         contents,
444                         result_ok: o.result_ok,
445                 }
446         }
447 }
448 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
449         fn clone(&self) -> Self {
450                 if self.result_ok {
451                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
452                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
453                         } }
454                 } else {
455                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
456                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
457                         } }
458                 }
459         }
460 }
461 #[no_mangle]
462 /// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
463 /// but with all dynamically-allocated buffers duplicated in new buffers.
464 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) }
465 #[repr(C)]
466 /// The contents of CResult_ChannelPublicKeysDecodeErrorZ
467 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
468         /// A pointer to the contents in the success state.
469         /// Reading from this pointer when `result_ok` is not set is undefined.
470         pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys,
471         /// A pointer to the contents in the error state.
472         /// Reading from this pointer when `result_ok` is set is undefined.
473         pub err: *mut crate::lightning::ln::msgs::DecodeError,
474 }
475 #[repr(C)]
476 /// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
477 /// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
478 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
479 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
480         /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
481         /// `err` or `result` depending on the state of `result_ok`.
482         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
483         /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
484         pub result_ok: bool,
485 }
486 #[no_mangle]
487 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
488 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
489         CResult_ChannelPublicKeysDecodeErrorZ {
490                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
491                         result: Box::into_raw(Box::new(o)),
492                 },
493                 result_ok: true,
494         }
495 }
496 #[no_mangle]
497 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
498 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
499         CResult_ChannelPublicKeysDecodeErrorZ {
500                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
501                         err: Box::into_raw(Box::new(e)),
502                 },
503                 result_ok: false,
504         }
505 }
506 /// Checks if the given object is currently in the success state
507 #[no_mangle]
508 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool {
509         o.result_ok
510 }
511 #[no_mangle]
512 /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
513 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
514 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
515         fn drop(&mut self) {
516                 if self.result_ok {
517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
519                         }
520                 } else {
521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
523                         }
524                 }
525         }
526 }
527 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
528         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelPublicKeys, crate::lightning::ln::msgs::DecodeError>) -> Self {
529                 let contents = if o.result_ok {
530                         let result = unsafe { o.contents.result };
531                         unsafe { o.contents.result = core::ptr::null_mut() };
532                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
533                 } else {
534                         let err = unsafe { o.contents.err };
535                         unsafe { o.contents.err = core::ptr::null_mut(); }
536                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
537                 };
538                 Self {
539                         contents,
540                         result_ok: o.result_ok,
541                 }
542         }
543 }
544 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
545         fn clone(&self) -> Self {
546                 if self.result_ok {
547                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
548                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
549                         } }
550                 } else {
551                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
552                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
553                         } }
554                 }
555         }
556 }
557 #[no_mangle]
558 /// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
559 /// but with all dynamically-allocated buffers duplicated in new buffers.
560 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) }
561 #[repr(C)]
562 /// The contents of CResult_TxCreationKeysErrorZ
563 pub union CResult_TxCreationKeysErrorZPtr {
564         /// A pointer to the contents in the success state.
565         /// Reading from this pointer when `result_ok` is not set is undefined.
566         pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys,
567         /// A pointer to the contents in the error state.
568         /// Reading from this pointer when `result_ok` is set is undefined.
569         pub err: *mut crate::c_types::Secp256k1Error,
570 }
571 #[repr(C)]
572 /// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
573 /// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
574 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
575 pub struct CResult_TxCreationKeysErrorZ {
576         /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either
577         /// `err` or `result` depending on the state of `result_ok`.
578         pub contents: CResult_TxCreationKeysErrorZPtr,
579         /// Whether this CResult_TxCreationKeysErrorZ represents a success state.
580         pub result_ok: bool,
581 }
582 #[no_mangle]
583 /// Creates a new CResult_TxCreationKeysErrorZ in the success state.
584 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
585         CResult_TxCreationKeysErrorZ {
586                 contents: CResult_TxCreationKeysErrorZPtr {
587                         result: Box::into_raw(Box::new(o)),
588                 },
589                 result_ok: true,
590         }
591 }
592 #[no_mangle]
593 /// Creates a new CResult_TxCreationKeysErrorZ in the error state.
594 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
595         CResult_TxCreationKeysErrorZ {
596                 contents: CResult_TxCreationKeysErrorZPtr {
597                         err: Box::into_raw(Box::new(e)),
598                 },
599                 result_ok: false,
600         }
601 }
602 /// Checks if the given object is currently in the success state
603 #[no_mangle]
604 pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool {
605         o.result_ok
606 }
607 #[no_mangle]
608 /// Frees any resources used by the CResult_TxCreationKeysErrorZ.
609 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
610 impl Drop for CResult_TxCreationKeysErrorZ {
611         fn drop(&mut self) {
612                 if self.result_ok {
613                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
614                                 let _ = unsafe { Box::from_raw(self.contents.result) };
615                         }
616                 } else {
617                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
618                                 let _ = unsafe { Box::from_raw(self.contents.err) };
619                         }
620                 }
621         }
622 }
623 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
624         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
625                 let contents = if o.result_ok {
626                         let result = unsafe { o.contents.result };
627                         unsafe { o.contents.result = core::ptr::null_mut() };
628                         CResult_TxCreationKeysErrorZPtr { result }
629                 } else {
630                         let err = unsafe { o.contents.err };
631                         unsafe { o.contents.err = core::ptr::null_mut(); }
632                         CResult_TxCreationKeysErrorZPtr { err }
633                 };
634                 Self {
635                         contents,
636                         result_ok: o.result_ok,
637                 }
638         }
639 }
640 impl Clone for CResult_TxCreationKeysErrorZ {
641         fn clone(&self) -> Self {
642                 if self.result_ok {
643                         Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr {
644                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
645                         } }
646                 } else {
647                         Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr {
648                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
649                         } }
650                 }
651         }
652 }
653 #[no_mangle]
654 /// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
655 /// but with all dynamically-allocated buffers duplicated in new buffers.
656 pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) }
657 #[repr(C)]
658 #[derive(Clone)]
659 /// An enum which can either contain a u32 or not
660 pub enum COption_u32Z {
661         /// When we're in this state, this COption_u32Z contains a u32
662         Some(u32),
663         /// When we're in this state, this COption_u32Z contains nothing
664         None
665 }
666 impl COption_u32Z {
667         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
668                 if let Self::None = self { false } else { true }
669         }
670         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
671                 !self.is_some()
672         }
673         #[allow(unused)] pub(crate) fn take(mut self) -> u32 {
674                 if let Self::Some(v) = self { v } else { unreachable!() }
675         }
676 }
677 #[no_mangle]
678 /// Constructs a new COption_u32Z containing a u32
679 pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z {
680         COption_u32Z::Some(o)
681 }
682 #[no_mangle]
683 /// Constructs a new COption_u32Z containing nothing
684 pub extern "C" fn COption_u32Z_none() -> COption_u32Z {
685         COption_u32Z::None
686 }
687 #[no_mangle]
688 /// Frees any resources associated with the u32, if we are in the Some state
689 pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { }
690 #[no_mangle]
691 /// Creates a new COption_u32Z which has the same data as `orig`
692 /// but with all dynamically-allocated buffers duplicated in new buffers.
693 pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) }
694 #[repr(C)]
695 /// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
696 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
697         /// A pointer to the contents in the success state.
698         /// Reading from this pointer when `result_ok` is not set is undefined.
699         pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment,
700         /// A pointer to the contents in the error state.
701         /// Reading from this pointer when `result_ok` is set is undefined.
702         pub err: *mut crate::lightning::ln::msgs::DecodeError,
703 }
704 #[repr(C)]
705 /// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
706 /// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
707 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
708 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
709         /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
710         /// `err` or `result` depending on the state of `result_ok`.
711         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
712         /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
713         pub result_ok: bool,
714 }
715 #[no_mangle]
716 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
717 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
718         CResult_HTLCOutputInCommitmentDecodeErrorZ {
719                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
720                         result: Box::into_raw(Box::new(o)),
721                 },
722                 result_ok: true,
723         }
724 }
725 #[no_mangle]
726 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
727 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
728         CResult_HTLCOutputInCommitmentDecodeErrorZ {
729                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
730                         err: Box::into_raw(Box::new(e)),
731                 },
732                 result_ok: false,
733         }
734 }
735 /// Checks if the given object is currently in the success state
736 #[no_mangle]
737 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool {
738         o.result_ok
739 }
740 #[no_mangle]
741 /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
742 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
743 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
744         fn drop(&mut self) {
745                 if self.result_ok {
746                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
747                                 let _ = unsafe { Box::from_raw(self.contents.result) };
748                         }
749                 } else {
750                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
751                                 let _ = unsafe { Box::from_raw(self.contents.err) };
752                         }
753                 }
754         }
755 }
756 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
757         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HTLCOutputInCommitment, crate::lightning::ln::msgs::DecodeError>) -> Self {
758                 let contents = if o.result_ok {
759                         let result = unsafe { o.contents.result };
760                         unsafe { o.contents.result = core::ptr::null_mut() };
761                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
762                 } else {
763                         let err = unsafe { o.contents.err };
764                         unsafe { o.contents.err = core::ptr::null_mut(); }
765                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
766                 };
767                 Self {
768                         contents,
769                         result_ok: o.result_ok,
770                 }
771         }
772 }
773 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
774         fn clone(&self) -> Self {
775                 if self.result_ok {
776                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
777                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
778                         } }
779                 } else {
780                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
781                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
782                         } }
783                 }
784         }
785 }
786 #[no_mangle]
787 /// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
788 /// but with all dynamically-allocated buffers duplicated in new buffers.
789 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) }
790 #[repr(C)]
791 /// An enum which can either contain a  or not
792 pub enum COption_NoneZ {
793         /// When we're in this state, this COption_NoneZ contains a 
794         Some,
795         /// When we're in this state, this COption_NoneZ contains nothing
796         None
797 }
798 impl COption_NoneZ {
799         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
800                 if let Self::None = self { false } else { true }
801         }
802         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
803                 !self.is_some()
804         }
805 }
806 #[no_mangle]
807 /// Constructs a new COption_NoneZ containing a 
808 pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ {
809         COption_NoneZ::Some
810 }
811 #[no_mangle]
812 /// Constructs a new COption_NoneZ containing nothing
813 pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ {
814         COption_NoneZ::None
815 }
816 #[no_mangle]
817 /// Frees any resources associated with the , if we are in the Some state
818 pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { }
819 #[repr(C)]
820 /// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
821 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
822         /// A pointer to the contents in the success state.
823         /// Reading from this pointer when `result_ok` is not set is undefined.
824         pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters,
825         /// A pointer to the contents in the error state.
826         /// Reading from this pointer when `result_ok` is set is undefined.
827         pub err: *mut crate::lightning::ln::msgs::DecodeError,
828 }
829 #[repr(C)]
830 /// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
831 /// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
832 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
833 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
834         /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
835         /// `err` or `result` depending on the state of `result_ok`.
836         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
837         /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
838         pub result_ok: bool,
839 }
840 #[no_mangle]
841 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
842 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
843         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
844                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
845                         result: Box::into_raw(Box::new(o)),
846                 },
847                 result_ok: true,
848         }
849 }
850 #[no_mangle]
851 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
852 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
853         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
854                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
855                         err: Box::into_raw(Box::new(e)),
856                 },
857                 result_ok: false,
858         }
859 }
860 /// Checks if the given object is currently in the success state
861 #[no_mangle]
862 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool {
863         o.result_ok
864 }
865 #[no_mangle]
866 /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
867 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
868 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
869         fn drop(&mut self) {
870                 if self.result_ok {
871                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
872                                 let _ = unsafe { Box::from_raw(self.contents.result) };
873                         }
874                 } else {
875                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
876                                 let _ = unsafe { Box::from_raw(self.contents.err) };
877                         }
878                 }
879         }
880 }
881 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
882         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
883                 let contents = if o.result_ok {
884                         let result = unsafe { o.contents.result };
885                         unsafe { o.contents.result = core::ptr::null_mut() };
886                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
887                 } else {
888                         let err = unsafe { o.contents.err };
889                         unsafe { o.contents.err = core::ptr::null_mut(); }
890                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
891                 };
892                 Self {
893                         contents,
894                         result_ok: o.result_ok,
895                 }
896         }
897 }
898 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
899         fn clone(&self) -> Self {
900                 if self.result_ok {
901                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
902                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
903                         } }
904                 } else {
905                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
906                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
907                         } }
908                 }
909         }
910 }
911 #[no_mangle]
912 /// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
913 /// but with all dynamically-allocated buffers duplicated in new buffers.
914 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
915 #[repr(C)]
916 /// The contents of CResult_ChannelTransactionParametersDecodeErrorZ
917 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
918         /// A pointer to the contents in the success state.
919         /// Reading from this pointer when `result_ok` is not set is undefined.
920         pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters,
921         /// A pointer to the contents in the error state.
922         /// Reading from this pointer when `result_ok` is set is undefined.
923         pub err: *mut crate::lightning::ln::msgs::DecodeError,
924 }
925 #[repr(C)]
926 /// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
927 /// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
928 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
929 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
930         /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
931         /// `err` or `result` depending on the state of `result_ok`.
932         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
933         /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
934         pub result_ok: bool,
935 }
936 #[no_mangle]
937 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
938 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
939         CResult_ChannelTransactionParametersDecodeErrorZ {
940                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
941                         result: Box::into_raw(Box::new(o)),
942                 },
943                 result_ok: true,
944         }
945 }
946 #[no_mangle]
947 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
948 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
949         CResult_ChannelTransactionParametersDecodeErrorZ {
950                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
951                         err: Box::into_raw(Box::new(e)),
952                 },
953                 result_ok: false,
954         }
955 }
956 /// Checks if the given object is currently in the success state
957 #[no_mangle]
958 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool {
959         o.result_ok
960 }
961 #[no_mangle]
962 /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
963 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
964 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
965         fn drop(&mut self) {
966                 if self.result_ok {
967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
969                         }
970                 } else {
971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
973                         }
974                 }
975         }
976 }
977 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
978         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::ChannelTransactionParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
979                 let contents = if o.result_ok {
980                         let result = unsafe { o.contents.result };
981                         unsafe { o.contents.result = core::ptr::null_mut() };
982                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
983                 } else {
984                         let err = unsafe { o.contents.err };
985                         unsafe { o.contents.err = core::ptr::null_mut(); }
986                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
987                 };
988                 Self {
989                         contents,
990                         result_ok: o.result_ok,
991                 }
992         }
993 }
994 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
995         fn clone(&self) -> Self {
996                 if self.result_ok {
997                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
998                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
999                         } }
1000                 } else {
1001                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
1002                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1003                         } }
1004                 }
1005         }
1006 }
1007 #[no_mangle]
1008 /// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
1009 /// but with all dynamically-allocated buffers duplicated in new buffers.
1010 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) }
1011 #[repr(C)]
1012 /// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1013 /// This corresponds to std::vector in C++
1014 pub struct CVec_SignatureZ {
1015         /// The elements in the array.
1016         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1017         pub data: *mut crate::c_types::Signature,
1018         /// The number of elements pointed to by `data`.
1019         pub datalen: usize
1020 }
1021 impl CVec_SignatureZ {
1022         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
1023                 if self.datalen == 0 { return Vec::new(); }
1024                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1025                 self.data = core::ptr::null_mut();
1026                 self.datalen = 0;
1027                 ret
1028         }
1029         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
1030                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1031         }
1032 }
1033 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
1034         fn from(v: Vec<crate::c_types::Signature>) -> Self {
1035                 let datalen = v.len();
1036                 let data = Box::into_raw(v.into_boxed_slice());
1037                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1038         }
1039 }
1040 #[no_mangle]
1041 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1042 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
1043 impl Drop for CVec_SignatureZ {
1044         fn drop(&mut self) {
1045                 if self.datalen == 0 { return; }
1046                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
1047         }
1048 }
1049 impl Clone for CVec_SignatureZ {
1050         fn clone(&self) -> Self {
1051                 let mut res = Vec::new();
1052                 if self.datalen == 0 { return Self::from(res); }
1053                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
1054                 Self::from(res)
1055         }
1056 }
1057 #[repr(C)]
1058 /// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1059 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1060         /// A pointer to the contents in the success state.
1061         /// Reading from this pointer when `result_ok` is not set is undefined.
1062         pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction,
1063         /// A pointer to the contents in the error state.
1064         /// Reading from this pointer when `result_ok` is set is undefined.
1065         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1066 }
1067 #[repr(C)]
1068 /// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1069 /// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1070 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1071 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
1072         /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1073         /// `err` or `result` depending on the state of `result_ok`.
1074         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
1075         /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1076         pub result_ok: bool,
1077 }
1078 #[no_mangle]
1079 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
1080 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1081         CResult_HolderCommitmentTransactionDecodeErrorZ {
1082                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1083                         result: Box::into_raw(Box::new(o)),
1084                 },
1085                 result_ok: true,
1086         }
1087 }
1088 #[no_mangle]
1089 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
1090 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
1091         CResult_HolderCommitmentTransactionDecodeErrorZ {
1092                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1093                         err: Box::into_raw(Box::new(e)),
1094                 },
1095                 result_ok: false,
1096         }
1097 }
1098 /// Checks if the given object is currently in the success state
1099 #[no_mangle]
1100 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool {
1101         o.result_ok
1102 }
1103 #[no_mangle]
1104 /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
1105 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
1106 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
1107         fn drop(&mut self) {
1108                 if self.result_ok {
1109                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1110                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1111                         }
1112                 } else {
1113                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1114                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1115                         }
1116                 }
1117         }
1118 }
1119 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
1120         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::HolderCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1121                 let contents = if o.result_ok {
1122                         let result = unsafe { o.contents.result };
1123                         unsafe { o.contents.result = core::ptr::null_mut() };
1124                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
1125                 } else {
1126                         let err = unsafe { o.contents.err };
1127                         unsafe { o.contents.err = core::ptr::null_mut(); }
1128                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
1129                 };
1130                 Self {
1131                         contents,
1132                         result_ok: o.result_ok,
1133                 }
1134         }
1135 }
1136 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
1137         fn clone(&self) -> Self {
1138                 if self.result_ok {
1139                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1140                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1141                         } }
1142                 } else {
1143                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
1144                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1145                         } }
1146                 }
1147         }
1148 }
1149 #[no_mangle]
1150 /// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1151 /// but with all dynamically-allocated buffers duplicated in new buffers.
1152 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1153 #[repr(C)]
1154 /// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1155 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1156         /// A pointer to the contents in the success state.
1157         /// Reading from this pointer when `result_ok` is not set is undefined.
1158         pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction,
1159         /// A pointer to the contents in the error state.
1160         /// Reading from this pointer when `result_ok` is set is undefined.
1161         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1162 }
1163 #[repr(C)]
1164 /// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1165 /// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1166 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1167 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
1168         /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1169         /// `err` or `result` depending on the state of `result_ok`.
1170         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
1171         /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1172         pub result_ok: bool,
1173 }
1174 #[no_mangle]
1175 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
1176 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1177         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1178                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1179                         result: Box::into_raw(Box::new(o)),
1180                 },
1181                 result_ok: true,
1182         }
1183 }
1184 #[no_mangle]
1185 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
1186 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
1187         CResult_BuiltCommitmentTransactionDecodeErrorZ {
1188                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1189                         err: Box::into_raw(Box::new(e)),
1190                 },
1191                 result_ok: false,
1192         }
1193 }
1194 /// Checks if the given object is currently in the success state
1195 #[no_mangle]
1196 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool {
1197         o.result_ok
1198 }
1199 #[no_mangle]
1200 /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
1201 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
1202 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1203         fn drop(&mut self) {
1204                 if self.result_ok {
1205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1207                         }
1208                 } else {
1209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1211                         }
1212                 }
1213         }
1214 }
1215 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1216         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1217                 let contents = if o.result_ok {
1218                         let result = unsafe { o.contents.result };
1219                         unsafe { o.contents.result = core::ptr::null_mut() };
1220                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
1221                 } else {
1222                         let err = unsafe { o.contents.err };
1223                         unsafe { o.contents.err = core::ptr::null_mut(); }
1224                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
1225                 };
1226                 Self {
1227                         contents,
1228                         result_ok: o.result_ok,
1229                 }
1230         }
1231 }
1232 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
1233         fn clone(&self) -> Self {
1234                 if self.result_ok {
1235                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1236                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1237                         } }
1238                 } else {
1239                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1240                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1241                         } }
1242                 }
1243         }
1244 }
1245 #[no_mangle]
1246 /// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
1247 /// but with all dynamically-allocated buffers duplicated in new buffers.
1248 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1249 #[repr(C)]
1250 /// The contents of CResult_TrustedClosingTransactionNoneZ
1251 pub union CResult_TrustedClosingTransactionNoneZPtr {
1252         /// A pointer to the contents in the success state.
1253         /// Reading from this pointer when `result_ok` is not set is undefined.
1254         pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction,
1255         /// Note that this value is always NULL, as there are no contents in the Err variant
1256         pub err: *mut core::ffi::c_void,
1257 }
1258 #[repr(C)]
1259 /// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1260 /// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1262 pub struct CResult_TrustedClosingTransactionNoneZ {
1263         /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1264         /// `err` or `result` depending on the state of `result_ok`.
1265         pub contents: CResult_TrustedClosingTransactionNoneZPtr,
1266         /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1267         pub result_ok: bool,
1268 }
1269 #[no_mangle]
1270 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
1271 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ {
1272         CResult_TrustedClosingTransactionNoneZ {
1273                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1274                         result: Box::into_raw(Box::new(o)),
1275                 },
1276                 result_ok: true,
1277         }
1278 }
1279 #[no_mangle]
1280 /// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
1281 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ {
1282         CResult_TrustedClosingTransactionNoneZ {
1283                 contents: CResult_TrustedClosingTransactionNoneZPtr {
1284                         err: core::ptr::null_mut(),
1285                 },
1286                 result_ok: false,
1287         }
1288 }
1289 /// Checks if the given object is currently in the success state
1290 #[no_mangle]
1291 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool {
1292         o.result_ok
1293 }
1294 #[no_mangle]
1295 /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
1296 pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { }
1297 impl Drop for CResult_TrustedClosingTransactionNoneZ {
1298         fn drop(&mut self) {
1299                 if self.result_ok {
1300                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1301                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1302                         }
1303                 } else {
1304                 }
1305         }
1306 }
1307 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>> for CResult_TrustedClosingTransactionNoneZ {
1308         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedClosingTransaction, ()>) -> Self {
1309                 let contents = if o.result_ok {
1310                         let result = unsafe { o.contents.result };
1311                         unsafe { o.contents.result = core::ptr::null_mut() };
1312                         CResult_TrustedClosingTransactionNoneZPtr { result }
1313                 } else {
1314                         let _ = unsafe { Box::from_raw(o.contents.err) };
1315                         o.contents.err = core::ptr::null_mut();
1316                         CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() }
1317                 };
1318                 Self {
1319                         contents,
1320                         result_ok: o.result_ok,
1321                 }
1322         }
1323 }
1324 #[repr(C)]
1325 /// The contents of CResult_CommitmentTransactionDecodeErrorZ
1326 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
1327         /// A pointer to the contents in the success state.
1328         /// Reading from this pointer when `result_ok` is not set is undefined.
1329         pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction,
1330         /// A pointer to the contents in the error state.
1331         /// Reading from this pointer when `result_ok` is set is undefined.
1332         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1333 }
1334 #[repr(C)]
1335 /// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1336 /// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1337 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1338 pub struct CResult_CommitmentTransactionDecodeErrorZ {
1339         /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1340         /// `err` or `result` depending on the state of `result_ok`.
1341         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
1342         /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1343         pub result_ok: bool,
1344 }
1345 #[no_mangle]
1346 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
1347 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
1348         CResult_CommitmentTransactionDecodeErrorZ {
1349                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1350                         result: Box::into_raw(Box::new(o)),
1351                 },
1352                 result_ok: true,
1353         }
1354 }
1355 #[no_mangle]
1356 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
1357 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
1358         CResult_CommitmentTransactionDecodeErrorZ {
1359                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1360                         err: Box::into_raw(Box::new(e)),
1361                 },
1362                 result_ok: false,
1363         }
1364 }
1365 /// Checks if the given object is currently in the success state
1366 #[no_mangle]
1367 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool {
1368         o.result_ok
1369 }
1370 #[no_mangle]
1371 /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
1372 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
1373 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
1374         fn drop(&mut self) {
1375                 if self.result_ok {
1376                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1377                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1378                         }
1379                 } else {
1380                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1381                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1382                         }
1383                 }
1384         }
1385 }
1386 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
1387         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::CommitmentTransaction, crate::lightning::ln::msgs::DecodeError>) -> Self {
1388                 let contents = if o.result_ok {
1389                         let result = unsafe { o.contents.result };
1390                         unsafe { o.contents.result = core::ptr::null_mut() };
1391                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
1392                 } else {
1393                         let err = unsafe { o.contents.err };
1394                         unsafe { o.contents.err = core::ptr::null_mut(); }
1395                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
1396                 };
1397                 Self {
1398                         contents,
1399                         result_ok: o.result_ok,
1400                 }
1401         }
1402 }
1403 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
1404         fn clone(&self) -> Self {
1405                 if self.result_ok {
1406                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1407                                 result: Box::into_raw(Box::new(<crate::lightning::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
1408                         } }
1409                 } else {
1410                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
1411                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1412                         } }
1413                 }
1414         }
1415 }
1416 #[no_mangle]
1417 /// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
1418 /// but with all dynamically-allocated buffers duplicated in new buffers.
1419 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) }
1420 #[repr(C)]
1421 /// The contents of CResult_TrustedCommitmentTransactionNoneZ
1422 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
1423         /// A pointer to the contents in the success state.
1424         /// Reading from this pointer when `result_ok` is not set is undefined.
1425         pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction,
1426         /// Note that this value is always NULL, as there are no contents in the Err variant
1427         pub err: *mut core::ffi::c_void,
1428 }
1429 #[repr(C)]
1430 /// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1431 /// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1432 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1433 pub struct CResult_TrustedCommitmentTransactionNoneZ {
1434         /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1435         /// `err` or `result` depending on the state of `result_ok`.
1436         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
1437         /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1438         pub result_ok: bool,
1439 }
1440 #[no_mangle]
1441 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
1442 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
1443         CResult_TrustedCommitmentTransactionNoneZ {
1444                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1445                         result: Box::into_raw(Box::new(o)),
1446                 },
1447                 result_ok: true,
1448         }
1449 }
1450 #[no_mangle]
1451 /// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
1452 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
1453         CResult_TrustedCommitmentTransactionNoneZ {
1454                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
1455                         err: core::ptr::null_mut(),
1456                 },
1457                 result_ok: false,
1458         }
1459 }
1460 /// Checks if the given object is currently in the success state
1461 #[no_mangle]
1462 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool {
1463         o.result_ok
1464 }
1465 #[no_mangle]
1466 /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
1467 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
1468 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
1469         fn drop(&mut self) {
1470                 if self.result_ok {
1471                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1472                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1473                         }
1474                 } else {
1475                 }
1476         }
1477 }
1478 impl From<crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>> for CResult_TrustedCommitmentTransactionNoneZ {
1479         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, ()>) -> Self {
1480                 let contents = if o.result_ok {
1481                         let result = unsafe { o.contents.result };
1482                         unsafe { o.contents.result = core::ptr::null_mut() };
1483                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
1484                 } else {
1485                         let _ = unsafe { Box::from_raw(o.contents.err) };
1486                         o.contents.err = core::ptr::null_mut();
1487                         CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() }
1488                 };
1489                 Self {
1490                         contents,
1491                         result_ok: o.result_ok,
1492                 }
1493         }
1494 }
1495 #[repr(C)]
1496 /// The contents of CResult_CVec_SignatureZNoneZ
1497 pub union CResult_CVec_SignatureZNoneZPtr {
1498         /// A pointer to the contents in the success state.
1499         /// Reading from this pointer when `result_ok` is not set is undefined.
1500         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
1501         /// Note that this value is always NULL, as there are no contents in the Err variant
1502         pub err: *mut core::ffi::c_void,
1503 }
1504 #[repr(C)]
1505 /// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1506 /// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1507 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1508 pub struct CResult_CVec_SignatureZNoneZ {
1509         /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1510         /// `err` or `result` depending on the state of `result_ok`.
1511         pub contents: CResult_CVec_SignatureZNoneZPtr,
1512         /// Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1513         pub result_ok: bool,
1514 }
1515 #[no_mangle]
1516 /// Creates a new CResult_CVec_SignatureZNoneZ in the success state.
1517 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
1518         CResult_CVec_SignatureZNoneZ {
1519                 contents: CResult_CVec_SignatureZNoneZPtr {
1520                         result: Box::into_raw(Box::new(o)),
1521                 },
1522                 result_ok: true,
1523         }
1524 }
1525 #[no_mangle]
1526 /// Creates a new CResult_CVec_SignatureZNoneZ in the error state.
1527 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
1528         CResult_CVec_SignatureZNoneZ {
1529                 contents: CResult_CVec_SignatureZNoneZPtr {
1530                         err: core::ptr::null_mut(),
1531                 },
1532                 result_ok: false,
1533         }
1534 }
1535 /// Checks if the given object is currently in the success state
1536 #[no_mangle]
1537 pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool {
1538         o.result_ok
1539 }
1540 #[no_mangle]
1541 /// Frees any resources used by the CResult_CVec_SignatureZNoneZ.
1542 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
1543 impl Drop for CResult_CVec_SignatureZNoneZ {
1544         fn drop(&mut self) {
1545                 if self.result_ok {
1546                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1547                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1548                         }
1549                 } else {
1550                 }
1551         }
1552 }
1553 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>> for CResult_CVec_SignatureZNoneZ {
1554         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, ()>) -> Self {
1555                 let contents = if o.result_ok {
1556                         let result = unsafe { o.contents.result };
1557                         unsafe { o.contents.result = core::ptr::null_mut() };
1558                         CResult_CVec_SignatureZNoneZPtr { result }
1559                 } else {
1560                         let _ = unsafe { Box::from_raw(o.contents.err) };
1561                         o.contents.err = core::ptr::null_mut();
1562                         CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() }
1563                 };
1564                 Self {
1565                         contents,
1566                         result_ok: o.result_ok,
1567                 }
1568         }
1569 }
1570 impl Clone for CResult_CVec_SignatureZNoneZ {
1571         fn clone(&self) -> Self {
1572                 if self.result_ok {
1573                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
1574                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
1575                         } }
1576                 } else {
1577                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
1578                                 err: core::ptr::null_mut()
1579                         } }
1580                 }
1581         }
1582 }
1583 #[no_mangle]
1584 /// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
1585 /// but with all dynamically-allocated buffers duplicated in new buffers.
1586 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) }
1587 #[repr(C)]
1588 /// The contents of CResult_ShutdownScriptDecodeErrorZ
1589 pub union CResult_ShutdownScriptDecodeErrorZPtr {
1590         /// A pointer to the contents in the success state.
1591         /// Reading from this pointer when `result_ok` is not set is undefined.
1592         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1593         /// A pointer to the contents in the error state.
1594         /// Reading from this pointer when `result_ok` is set is undefined.
1595         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1596 }
1597 #[repr(C)]
1598 /// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1599 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1600 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1601 pub struct CResult_ShutdownScriptDecodeErrorZ {
1602         /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1603         /// `err` or `result` depending on the state of `result_ok`.
1604         pub contents: CResult_ShutdownScriptDecodeErrorZPtr,
1605         /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1606         pub result_ok: bool,
1607 }
1608 #[no_mangle]
1609 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
1610 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ {
1611         CResult_ShutdownScriptDecodeErrorZ {
1612                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1613                         result: Box::into_raw(Box::new(o)),
1614                 },
1615                 result_ok: true,
1616         }
1617 }
1618 #[no_mangle]
1619 /// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
1620 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ {
1621         CResult_ShutdownScriptDecodeErrorZ {
1622                 contents: CResult_ShutdownScriptDecodeErrorZPtr {
1623                         err: Box::into_raw(Box::new(e)),
1624                 },
1625                 result_ok: false,
1626         }
1627 }
1628 /// Checks if the given object is currently in the success state
1629 #[no_mangle]
1630 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool {
1631         o.result_ok
1632 }
1633 #[no_mangle]
1634 /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
1635 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { }
1636 impl Drop for CResult_ShutdownScriptDecodeErrorZ {
1637         fn drop(&mut self) {
1638                 if self.result_ok {
1639                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1640                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1641                         }
1642                 } else {
1643                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1644                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1645                         }
1646                 }
1647         }
1648 }
1649 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownScriptDecodeErrorZ {
1650         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::msgs::DecodeError>) -> Self {
1651                 let contents = if o.result_ok {
1652                         let result = unsafe { o.contents.result };
1653                         unsafe { o.contents.result = core::ptr::null_mut() };
1654                         CResult_ShutdownScriptDecodeErrorZPtr { result }
1655                 } else {
1656                         let err = unsafe { o.contents.err };
1657                         unsafe { o.contents.err = core::ptr::null_mut(); }
1658                         CResult_ShutdownScriptDecodeErrorZPtr { err }
1659                 };
1660                 Self {
1661                         contents,
1662                         result_ok: o.result_ok,
1663                 }
1664         }
1665 }
1666 impl Clone for CResult_ShutdownScriptDecodeErrorZ {
1667         fn clone(&self) -> Self {
1668                 if self.result_ok {
1669                         Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1670                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1671                         } }
1672                 } else {
1673                         Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr {
1674                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1675                         } }
1676                 }
1677         }
1678 }
1679 #[no_mangle]
1680 /// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
1681 /// but with all dynamically-allocated buffers duplicated in new buffers.
1682 pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) }
1683 #[repr(C)]
1684 /// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1685 pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1686         /// A pointer to the contents in the success state.
1687         /// Reading from this pointer when `result_ok` is not set is undefined.
1688         pub result: *mut crate::lightning::ln::script::ShutdownScript,
1689         /// A pointer to the contents in the error state.
1690         /// Reading from this pointer when `result_ok` is set is undefined.
1691         pub err: *mut crate::lightning::ln::script::InvalidShutdownScript,
1692 }
1693 #[repr(C)]
1694 /// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1695 /// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1696 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1697 pub struct CResult_ShutdownScriptInvalidShutdownScriptZ {
1698         /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1699         /// `err` or `result` depending on the state of `result_ok`.
1700         pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr,
1701         /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1702         pub result_ok: bool,
1703 }
1704 #[no_mangle]
1705 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
1706 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1707         CResult_ShutdownScriptInvalidShutdownScriptZ {
1708                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1709                         result: Box::into_raw(Box::new(o)),
1710                 },
1711                 result_ok: true,
1712         }
1713 }
1714 #[no_mangle]
1715 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
1716 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ {
1717         CResult_ShutdownScriptInvalidShutdownScriptZ {
1718                 contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1719                         err: Box::into_raw(Box::new(e)),
1720                 },
1721                 result_ok: false,
1722         }
1723 }
1724 /// Checks if the given object is currently in the success state
1725 #[no_mangle]
1726 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool {
1727         o.result_ok
1728 }
1729 #[no_mangle]
1730 /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
1731 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { }
1732 impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ {
1733         fn drop(&mut self) {
1734                 if self.result_ok {
1735                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1736                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1737                         }
1738                 } else {
1739                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1740                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1741                         }
1742                 }
1743         }
1744 }
1745 impl From<crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>> for CResult_ShutdownScriptInvalidShutdownScriptZ {
1746         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::script::ShutdownScript, crate::lightning::ln::script::InvalidShutdownScript>) -> Self {
1747                 let contents = if o.result_ok {
1748                         let result = unsafe { o.contents.result };
1749                         unsafe { o.contents.result = core::ptr::null_mut() };
1750                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { result }
1751                 } else {
1752                         let err = unsafe { o.contents.err };
1753                         unsafe { o.contents.err = core::ptr::null_mut(); }
1754                         CResult_ShutdownScriptInvalidShutdownScriptZPtr { err }
1755                 };
1756                 Self {
1757                         contents,
1758                         result_ok: o.result_ok,
1759                 }
1760         }
1761 }
1762 impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ {
1763         fn clone(&self) -> Self {
1764                 if self.result_ok {
1765                         Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1766                                 result: Box::into_raw(Box::new(<crate::lightning::ln::script::ShutdownScript>::clone(unsafe { &*self.contents.result })))
1767                         } }
1768                 } else {
1769                         Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr {
1770                                 err: Box::into_raw(Box::new(<crate::lightning::ln::script::InvalidShutdownScript>::clone(unsafe { &*self.contents.err })))
1771                         } }
1772                 }
1773         }
1774 }
1775 #[no_mangle]
1776 /// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
1777 /// but with all dynamically-allocated buffers duplicated in new buffers.
1778 pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) }
1779 #[repr(C)]
1780 /// The contents of CResult_NoneErrorZ
1781 pub union CResult_NoneErrorZPtr {
1782         /// Note that this value is always NULL, as there are no contents in the OK variant
1783         pub result: *mut core::ffi::c_void,
1784         /// A pointer to the contents in the error state.
1785         /// Reading from this pointer when `result_ok` is set is undefined.
1786         pub err: *mut crate::c_types::IOError,
1787 }
1788 #[repr(C)]
1789 /// A CResult_NoneErrorZ represents the result of a fallible operation,
1790 /// containing a () on success and a crate::c_types::IOError on failure.
1791 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1792 pub struct CResult_NoneErrorZ {
1793         /// The contents of this CResult_NoneErrorZ, accessible via either
1794         /// `err` or `result` depending on the state of `result_ok`.
1795         pub contents: CResult_NoneErrorZPtr,
1796         /// Whether this CResult_NoneErrorZ represents a success state.
1797         pub result_ok: bool,
1798 }
1799 #[no_mangle]
1800 /// Creates a new CResult_NoneErrorZ in the success state.
1801 pub extern "C" fn CResult_NoneErrorZ_ok() -> CResult_NoneErrorZ {
1802         CResult_NoneErrorZ {
1803                 contents: CResult_NoneErrorZPtr {
1804                         result: core::ptr::null_mut(),
1805                 },
1806                 result_ok: true,
1807         }
1808 }
1809 #[no_mangle]
1810 /// Creates a new CResult_NoneErrorZ in the error state.
1811 pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneErrorZ {
1812         CResult_NoneErrorZ {
1813                 contents: CResult_NoneErrorZPtr {
1814                         err: Box::into_raw(Box::new(e)),
1815                 },
1816                 result_ok: false,
1817         }
1818 }
1819 /// Checks if the given object is currently in the success state
1820 #[no_mangle]
1821 pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool {
1822         o.result_ok
1823 }
1824 #[no_mangle]
1825 /// Frees any resources used by the CResult_NoneErrorZ.
1826 pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { }
1827 impl Drop for CResult_NoneErrorZ {
1828         fn drop(&mut self) {
1829                 if self.result_ok {
1830                 } else {
1831                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1832                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1833                         }
1834                 }
1835         }
1836 }
1837 impl From<crate::c_types::CResultTempl<(), crate::c_types::IOError>> for CResult_NoneErrorZ {
1838         fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self {
1839                 let contents = if o.result_ok {
1840                         let _ = unsafe { Box::from_raw(o.contents.result) };
1841                         o.contents.result = core::ptr::null_mut();
1842                         CResult_NoneErrorZPtr { result: core::ptr::null_mut() }
1843                 } else {
1844                         let err = unsafe { o.contents.err };
1845                         unsafe { o.contents.err = core::ptr::null_mut(); }
1846                         CResult_NoneErrorZPtr { err }
1847                 };
1848                 Self {
1849                         contents,
1850                         result_ok: o.result_ok,
1851                 }
1852         }
1853 }
1854 impl Clone for CResult_NoneErrorZ {
1855         fn clone(&self) -> Self {
1856                 if self.result_ok {
1857                         Self { result_ok: true, contents: CResult_NoneErrorZPtr {
1858                                 result: core::ptr::null_mut()
1859                         } }
1860                 } else {
1861                         Self { result_ok: false, contents: CResult_NoneErrorZPtr {
1862                                 err: Box::into_raw(Box::new(<crate::c_types::IOError>::clone(unsafe { &*self.contents.err })))
1863                         } }
1864                 }
1865         }
1866 }
1867 #[no_mangle]
1868 /// Creates a new CResult_NoneErrorZ which has the same data as `orig`
1869 /// but with all dynamically-allocated buffers duplicated in new buffers.
1870 pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) }
1871 #[repr(C)]
1872 /// The contents of CResult_RouteHopDecodeErrorZ
1873 pub union CResult_RouteHopDecodeErrorZPtr {
1874         /// A pointer to the contents in the success state.
1875         /// Reading from this pointer when `result_ok` is not set is undefined.
1876         pub result: *mut crate::lightning::routing::router::RouteHop,
1877         /// A pointer to the contents in the error state.
1878         /// Reading from this pointer when `result_ok` is set is undefined.
1879         pub err: *mut crate::lightning::ln::msgs::DecodeError,
1880 }
1881 #[repr(C)]
1882 /// A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1883 /// containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1884 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
1885 pub struct CResult_RouteHopDecodeErrorZ {
1886         /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1887         /// `err` or `result` depending on the state of `result_ok`.
1888         pub contents: CResult_RouteHopDecodeErrorZPtr,
1889         /// Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1890         pub result_ok: bool,
1891 }
1892 #[no_mangle]
1893 /// Creates a new CResult_RouteHopDecodeErrorZ in the success state.
1894 pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ {
1895         CResult_RouteHopDecodeErrorZ {
1896                 contents: CResult_RouteHopDecodeErrorZPtr {
1897                         result: Box::into_raw(Box::new(o)),
1898                 },
1899                 result_ok: true,
1900         }
1901 }
1902 #[no_mangle]
1903 /// Creates a new CResult_RouteHopDecodeErrorZ in the error state.
1904 pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ {
1905         CResult_RouteHopDecodeErrorZ {
1906                 contents: CResult_RouteHopDecodeErrorZPtr {
1907                         err: Box::into_raw(Box::new(e)),
1908                 },
1909                 result_ok: false,
1910         }
1911 }
1912 /// Checks if the given object is currently in the success state
1913 #[no_mangle]
1914 pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool {
1915         o.result_ok
1916 }
1917 #[no_mangle]
1918 /// Frees any resources used by the CResult_RouteHopDecodeErrorZ.
1919 pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { }
1920 impl Drop for CResult_RouteHopDecodeErrorZ {
1921         fn drop(&mut self) {
1922                 if self.result_ok {
1923                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1924                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1925                         }
1926                 } else {
1927                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1928                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1929                         }
1930                 }
1931         }
1932 }
1933 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHopDecodeErrorZ {
1934         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
1935                 let contents = if o.result_ok {
1936                         let result = unsafe { o.contents.result };
1937                         unsafe { o.contents.result = core::ptr::null_mut() };
1938                         CResult_RouteHopDecodeErrorZPtr { result }
1939                 } else {
1940                         let err = unsafe { o.contents.err };
1941                         unsafe { o.contents.err = core::ptr::null_mut(); }
1942                         CResult_RouteHopDecodeErrorZPtr { err }
1943                 };
1944                 Self {
1945                         contents,
1946                         result_ok: o.result_ok,
1947                 }
1948         }
1949 }
1950 impl Clone for CResult_RouteHopDecodeErrorZ {
1951         fn clone(&self) -> Self {
1952                 if self.result_ok {
1953                         Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr {
1954                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHop>::clone(unsafe { &*self.contents.result })))
1955                         } }
1956                 } else {
1957                         Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr {
1958                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1959                         } }
1960                 }
1961         }
1962 }
1963 #[no_mangle]
1964 /// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
1965 /// but with all dynamically-allocated buffers duplicated in new buffers.
1966 pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) }
1967 #[repr(C)]
1968 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1969 /// This corresponds to std::vector in C++
1970 pub struct CVec_RouteHopZ {
1971         /// The elements in the array.
1972         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1973         pub data: *mut crate::lightning::routing::router::RouteHop,
1974         /// The number of elements pointed to by `data`.
1975         pub datalen: usize
1976 }
1977 impl CVec_RouteHopZ {
1978         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHop> {
1979                 if self.datalen == 0 { return Vec::new(); }
1980                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1981                 self.data = core::ptr::null_mut();
1982                 self.datalen = 0;
1983                 ret
1984         }
1985         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] {
1986                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
1987         }
1988 }
1989 impl From<Vec<crate::lightning::routing::router::RouteHop>> for CVec_RouteHopZ {
1990         fn from(v: Vec<crate::lightning::routing::router::RouteHop>) -> Self {
1991                 let datalen = v.len();
1992                 let data = Box::into_raw(v.into_boxed_slice());
1993                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1994         }
1995 }
1996 #[no_mangle]
1997 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
1998 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
1999 impl Drop for CVec_RouteHopZ {
2000         fn drop(&mut self) {
2001                 if self.datalen == 0 { return; }
2002                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2003         }
2004 }
2005 impl Clone for CVec_RouteHopZ {
2006         fn clone(&self) -> Self {
2007                 let mut res = Vec::new();
2008                 if self.datalen == 0 { return Self::from(res); }
2009                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2010                 Self::from(res)
2011         }
2012 }
2013 #[repr(C)]
2014 /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2015 /// This corresponds to std::vector in C++
2016 pub struct CVec_CVec_RouteHopZZ {
2017         /// The elements in the array.
2018         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2019         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
2020         /// The number of elements pointed to by `data`.
2021         pub datalen: usize
2022 }
2023 impl CVec_CVec_RouteHopZZ {
2024         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
2025                 if self.datalen == 0 { return Vec::new(); }
2026                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2027                 self.data = core::ptr::null_mut();
2028                 self.datalen = 0;
2029                 ret
2030         }
2031         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
2032                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2033         }
2034 }
2035 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
2036         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
2037                 let datalen = v.len();
2038                 let data = Box::into_raw(v.into_boxed_slice());
2039                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2040         }
2041 }
2042 #[no_mangle]
2043 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2044 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
2045 impl Drop for CVec_CVec_RouteHopZZ {
2046         fn drop(&mut self) {
2047                 if self.datalen == 0 { return; }
2048                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2049         }
2050 }
2051 impl Clone for CVec_CVec_RouteHopZZ {
2052         fn clone(&self) -> Self {
2053                 let mut res = Vec::new();
2054                 if self.datalen == 0 { return Self::from(res); }
2055                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2056                 Self::from(res)
2057         }
2058 }
2059 #[repr(C)]
2060 /// The contents of CResult_RouteDecodeErrorZ
2061 pub union CResult_RouteDecodeErrorZPtr {
2062         /// A pointer to the contents in the success state.
2063         /// Reading from this pointer when `result_ok` is not set is undefined.
2064         pub result: *mut crate::lightning::routing::router::Route,
2065         /// A pointer to the contents in the error state.
2066         /// Reading from this pointer when `result_ok` is set is undefined.
2067         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2068 }
2069 #[repr(C)]
2070 /// A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2071 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2072 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2073 pub struct CResult_RouteDecodeErrorZ {
2074         /// The contents of this CResult_RouteDecodeErrorZ, accessible via either
2075         /// `err` or `result` depending on the state of `result_ok`.
2076         pub contents: CResult_RouteDecodeErrorZPtr,
2077         /// Whether this CResult_RouteDecodeErrorZ represents a success state.
2078         pub result_ok: bool,
2079 }
2080 #[no_mangle]
2081 /// Creates a new CResult_RouteDecodeErrorZ in the success state.
2082 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ {
2083         CResult_RouteDecodeErrorZ {
2084                 contents: CResult_RouteDecodeErrorZPtr {
2085                         result: Box::into_raw(Box::new(o)),
2086                 },
2087                 result_ok: true,
2088         }
2089 }
2090 #[no_mangle]
2091 /// Creates a new CResult_RouteDecodeErrorZ in the error state.
2092 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
2093         CResult_RouteDecodeErrorZ {
2094                 contents: CResult_RouteDecodeErrorZPtr {
2095                         err: Box::into_raw(Box::new(e)),
2096                 },
2097                 result_ok: false,
2098         }
2099 }
2100 /// Checks if the given object is currently in the success state
2101 #[no_mangle]
2102 pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool {
2103         o.result_ok
2104 }
2105 #[no_mangle]
2106 /// Frees any resources used by the CResult_RouteDecodeErrorZ.
2107 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
2108 impl Drop for CResult_RouteDecodeErrorZ {
2109         fn drop(&mut self) {
2110                 if self.result_ok {
2111                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2112                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2113                         }
2114                 } else {
2115                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2116                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2117                         }
2118                 }
2119         }
2120 }
2121 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
2122         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::DecodeError>) -> Self {
2123                 let contents = if o.result_ok {
2124                         let result = unsafe { o.contents.result };
2125                         unsafe { o.contents.result = core::ptr::null_mut() };
2126                         CResult_RouteDecodeErrorZPtr { result }
2127                 } else {
2128                         let err = unsafe { o.contents.err };
2129                         unsafe { o.contents.err = core::ptr::null_mut(); }
2130                         CResult_RouteDecodeErrorZPtr { err }
2131                 };
2132                 Self {
2133                         contents,
2134                         result_ok: o.result_ok,
2135                 }
2136         }
2137 }
2138 impl Clone for CResult_RouteDecodeErrorZ {
2139         fn clone(&self) -> Self {
2140                 if self.result_ok {
2141                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
2142                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2143                         } }
2144                 } else {
2145                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
2146                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2147                         } }
2148                 }
2149         }
2150 }
2151 #[no_mangle]
2152 /// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
2153 /// but with all dynamically-allocated buffers duplicated in new buffers.
2154 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) }
2155 #[repr(C)]
2156 /// The contents of CResult_RouteParametersDecodeErrorZ
2157 pub union CResult_RouteParametersDecodeErrorZPtr {
2158         /// A pointer to the contents in the success state.
2159         /// Reading from this pointer when `result_ok` is not set is undefined.
2160         pub result: *mut crate::lightning::routing::router::RouteParameters,
2161         /// A pointer to the contents in the error state.
2162         /// Reading from this pointer when `result_ok` is set is undefined.
2163         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2164 }
2165 #[repr(C)]
2166 /// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
2167 /// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2168 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2169 pub struct CResult_RouteParametersDecodeErrorZ {
2170         /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
2171         /// `err` or `result` depending on the state of `result_ok`.
2172         pub contents: CResult_RouteParametersDecodeErrorZPtr,
2173         /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
2174         pub result_ok: bool,
2175 }
2176 #[no_mangle]
2177 /// Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
2178 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ {
2179         CResult_RouteParametersDecodeErrorZ {
2180                 contents: CResult_RouteParametersDecodeErrorZPtr {
2181                         result: Box::into_raw(Box::new(o)),
2182                 },
2183                 result_ok: true,
2184         }
2185 }
2186 #[no_mangle]
2187 /// Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
2188 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ {
2189         CResult_RouteParametersDecodeErrorZ {
2190                 contents: CResult_RouteParametersDecodeErrorZPtr {
2191                         err: Box::into_raw(Box::new(e)),
2192                 },
2193                 result_ok: false,
2194         }
2195 }
2196 /// Checks if the given object is currently in the success state
2197 #[no_mangle]
2198 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool {
2199         o.result_ok
2200 }
2201 #[no_mangle]
2202 /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
2203 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { }
2204 impl Drop for CResult_RouteParametersDecodeErrorZ {
2205         fn drop(&mut self) {
2206                 if self.result_ok {
2207                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2208                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2209                         }
2210                 } else {
2211                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2212                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2213                         }
2214                 }
2215         }
2216 }
2217 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteParametersDecodeErrorZ {
2218         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2219                 let contents = if o.result_ok {
2220                         let result = unsafe { o.contents.result };
2221                         unsafe { o.contents.result = core::ptr::null_mut() };
2222                         CResult_RouteParametersDecodeErrorZPtr { result }
2223                 } else {
2224                         let err = unsafe { o.contents.err };
2225                         unsafe { o.contents.err = core::ptr::null_mut(); }
2226                         CResult_RouteParametersDecodeErrorZPtr { err }
2227                 };
2228                 Self {
2229                         contents,
2230                         result_ok: o.result_ok,
2231                 }
2232         }
2233 }
2234 impl Clone for CResult_RouteParametersDecodeErrorZ {
2235         fn clone(&self) -> Self {
2236                 if self.result_ok {
2237                         Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr {
2238                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteParameters>::clone(unsafe { &*self.contents.result })))
2239                         } }
2240                 } else {
2241                         Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr {
2242                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2243                         } }
2244                 }
2245         }
2246 }
2247 #[no_mangle]
2248 /// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
2249 /// but with all dynamically-allocated buffers duplicated in new buffers.
2250 pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) }
2251 #[repr(C)]
2252 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2253 /// This corresponds to std::vector in C++
2254 pub struct CVec_RouteHintZ {
2255         /// The elements in the array.
2256         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2257         pub data: *mut crate::lightning::routing::router::RouteHint,
2258         /// The number of elements pointed to by `data`.
2259         pub datalen: usize
2260 }
2261 impl CVec_RouteHintZ {
2262         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHint> {
2263                 if self.datalen == 0 { return Vec::new(); }
2264                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2265                 self.data = core::ptr::null_mut();
2266                 self.datalen = 0;
2267                 ret
2268         }
2269         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHint] {
2270                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2271         }
2272 }
2273 impl From<Vec<crate::lightning::routing::router::RouteHint>> for CVec_RouteHintZ {
2274         fn from(v: Vec<crate::lightning::routing::router::RouteHint>) -> Self {
2275                 let datalen = v.len();
2276                 let data = Box::into_raw(v.into_boxed_slice());
2277                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2278         }
2279 }
2280 #[no_mangle]
2281 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2282 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
2283 impl Drop for CVec_RouteHintZ {
2284         fn drop(&mut self) {
2285                 if self.datalen == 0 { return; }
2286                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2287         }
2288 }
2289 impl Clone for CVec_RouteHintZ {
2290         fn clone(&self) -> Self {
2291                 let mut res = Vec::new();
2292                 if self.datalen == 0 { return Self::from(res); }
2293                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2294                 Self::from(res)
2295         }
2296 }
2297 #[repr(C)]
2298 #[derive(Clone)]
2299 /// An enum which can either contain a u64 or not
2300 pub enum COption_u64Z {
2301         /// When we're in this state, this COption_u64Z contains a u64
2302         Some(u64),
2303         /// When we're in this state, this COption_u64Z contains nothing
2304         None
2305 }
2306 impl COption_u64Z {
2307         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
2308                 if let Self::None = self { false } else { true }
2309         }
2310         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
2311                 !self.is_some()
2312         }
2313         #[allow(unused)] pub(crate) fn take(mut self) -> u64 {
2314                 if let Self::Some(v) = self { v } else { unreachable!() }
2315         }
2316 }
2317 #[no_mangle]
2318 /// Constructs a new COption_u64Z containing a u64
2319 pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z {
2320         COption_u64Z::Some(o)
2321 }
2322 #[no_mangle]
2323 /// Constructs a new COption_u64Z containing nothing
2324 pub extern "C" fn COption_u64Z_none() -> COption_u64Z {
2325         COption_u64Z::None
2326 }
2327 #[no_mangle]
2328 /// Frees any resources associated with the u64, if we are in the Some state
2329 pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { }
2330 #[no_mangle]
2331 /// Creates a new COption_u64Z which has the same data as `orig`
2332 /// but with all dynamically-allocated buffers duplicated in new buffers.
2333 pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) }
2334 #[repr(C)]
2335 /// The contents of CResult_PaymentParametersDecodeErrorZ
2336 pub union CResult_PaymentParametersDecodeErrorZPtr {
2337         /// A pointer to the contents in the success state.
2338         /// Reading from this pointer when `result_ok` is not set is undefined.
2339         pub result: *mut crate::lightning::routing::router::PaymentParameters,
2340         /// A pointer to the contents in the error state.
2341         /// Reading from this pointer when `result_ok` is set is undefined.
2342         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2343 }
2344 #[repr(C)]
2345 /// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2346 /// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2347 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2348 pub struct CResult_PaymentParametersDecodeErrorZ {
2349         /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2350         /// `err` or `result` depending on the state of `result_ok`.
2351         pub contents: CResult_PaymentParametersDecodeErrorZPtr,
2352         /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2353         pub result_ok: bool,
2354 }
2355 #[no_mangle]
2356 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
2357 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ {
2358         CResult_PaymentParametersDecodeErrorZ {
2359                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2360                         result: Box::into_raw(Box::new(o)),
2361                 },
2362                 result_ok: true,
2363         }
2364 }
2365 #[no_mangle]
2366 /// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
2367 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ {
2368         CResult_PaymentParametersDecodeErrorZ {
2369                 contents: CResult_PaymentParametersDecodeErrorZPtr {
2370                         err: Box::into_raw(Box::new(e)),
2371                 },
2372                 result_ok: false,
2373         }
2374 }
2375 /// Checks if the given object is currently in the success state
2376 #[no_mangle]
2377 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool {
2378         o.result_ok
2379 }
2380 #[no_mangle]
2381 /// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
2382 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { }
2383 impl Drop for CResult_PaymentParametersDecodeErrorZ {
2384         fn drop(&mut self) {
2385                 if self.result_ok {
2386                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2387                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2388                         }
2389                 } else {
2390                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2391                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2392                         }
2393                 }
2394         }
2395 }
2396 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_PaymentParametersDecodeErrorZ {
2397         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::PaymentParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
2398                 let contents = if o.result_ok {
2399                         let result = unsafe { o.contents.result };
2400                         unsafe { o.contents.result = core::ptr::null_mut() };
2401                         CResult_PaymentParametersDecodeErrorZPtr { result }
2402                 } else {
2403                         let err = unsafe { o.contents.err };
2404                         unsafe { o.contents.err = core::ptr::null_mut(); }
2405                         CResult_PaymentParametersDecodeErrorZPtr { err }
2406                 };
2407                 Self {
2408                         contents,
2409                         result_ok: o.result_ok,
2410                 }
2411         }
2412 }
2413 impl Clone for CResult_PaymentParametersDecodeErrorZ {
2414         fn clone(&self) -> Self {
2415                 if self.result_ok {
2416                         Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr {
2417                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::PaymentParameters>::clone(unsafe { &*self.contents.result })))
2418                         } }
2419                 } else {
2420                         Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr {
2421                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2422                         } }
2423                 }
2424         }
2425 }
2426 #[no_mangle]
2427 /// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
2428 /// but with all dynamically-allocated buffers duplicated in new buffers.
2429 pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) }
2430 #[repr(C)]
2431 /// A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2432 /// This corresponds to std::vector in C++
2433 pub struct CVec_RouteHintHopZ {
2434         /// The elements in the array.
2435         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2436         pub data: *mut crate::lightning::routing::router::RouteHintHop,
2437         /// The number of elements pointed to by `data`.
2438         pub datalen: usize
2439 }
2440 impl CVec_RouteHintHopZ {
2441         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::routing::router::RouteHintHop> {
2442                 if self.datalen == 0 { return Vec::new(); }
2443                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2444                 self.data = core::ptr::null_mut();
2445                 self.datalen = 0;
2446                 ret
2447         }
2448         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHintHop] {
2449                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2450         }
2451 }
2452 impl From<Vec<crate::lightning::routing::router::RouteHintHop>> for CVec_RouteHintHopZ {
2453         fn from(v: Vec<crate::lightning::routing::router::RouteHintHop>) -> Self {
2454                 let datalen = v.len();
2455                 let data = Box::into_raw(v.into_boxed_slice());
2456                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2457         }
2458 }
2459 #[no_mangle]
2460 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2461 pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { }
2462 impl Drop for CVec_RouteHintHopZ {
2463         fn drop(&mut self) {
2464                 if self.datalen == 0 { return; }
2465                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2466         }
2467 }
2468 impl Clone for CVec_RouteHintHopZ {
2469         fn clone(&self) -> Self {
2470                 let mut res = Vec::new();
2471                 if self.datalen == 0 { return Self::from(res); }
2472                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2473                 Self::from(res)
2474         }
2475 }
2476 #[repr(C)]
2477 /// The contents of CResult_RouteHintDecodeErrorZ
2478 pub union CResult_RouteHintDecodeErrorZPtr {
2479         /// A pointer to the contents in the success state.
2480         /// Reading from this pointer when `result_ok` is not set is undefined.
2481         pub result: *mut crate::lightning::routing::router::RouteHint,
2482         /// A pointer to the contents in the error state.
2483         /// Reading from this pointer when `result_ok` is set is undefined.
2484         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2485 }
2486 #[repr(C)]
2487 /// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2488 /// containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2489 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2490 pub struct CResult_RouteHintDecodeErrorZ {
2491         /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2492         /// `err` or `result` depending on the state of `result_ok`.
2493         pub contents: CResult_RouteHintDecodeErrorZPtr,
2494         /// Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2495         pub result_ok: bool,
2496 }
2497 #[no_mangle]
2498 /// Creates a new CResult_RouteHintDecodeErrorZ in the success state.
2499 pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHint) -> CResult_RouteHintDecodeErrorZ {
2500         CResult_RouteHintDecodeErrorZ {
2501                 contents: CResult_RouteHintDecodeErrorZPtr {
2502                         result: Box::into_raw(Box::new(o)),
2503                 },
2504                 result_ok: true,
2505         }
2506 }
2507 #[no_mangle]
2508 /// Creates a new CResult_RouteHintDecodeErrorZ in the error state.
2509 pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ {
2510         CResult_RouteHintDecodeErrorZ {
2511                 contents: CResult_RouteHintDecodeErrorZPtr {
2512                         err: Box::into_raw(Box::new(e)),
2513                 },
2514                 result_ok: false,
2515         }
2516 }
2517 /// Checks if the given object is currently in the success state
2518 #[no_mangle]
2519 pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool {
2520         o.result_ok
2521 }
2522 #[no_mangle]
2523 /// Frees any resources used by the CResult_RouteHintDecodeErrorZ.
2524 pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { }
2525 impl Drop for CResult_RouteHintDecodeErrorZ {
2526         fn drop(&mut self) {
2527                 if self.result_ok {
2528                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2529                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2530                         }
2531                 } else {
2532                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2533                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2534                         }
2535                 }
2536         }
2537 }
2538 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintDecodeErrorZ {
2539         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHint, crate::lightning::ln::msgs::DecodeError>) -> Self {
2540                 let contents = if o.result_ok {
2541                         let result = unsafe { o.contents.result };
2542                         unsafe { o.contents.result = core::ptr::null_mut() };
2543                         CResult_RouteHintDecodeErrorZPtr { result }
2544                 } else {
2545                         let err = unsafe { o.contents.err };
2546                         unsafe { o.contents.err = core::ptr::null_mut(); }
2547                         CResult_RouteHintDecodeErrorZPtr { err }
2548                 };
2549                 Self {
2550                         contents,
2551                         result_ok: o.result_ok,
2552                 }
2553         }
2554 }
2555 impl Clone for CResult_RouteHintDecodeErrorZ {
2556         fn clone(&self) -> Self {
2557                 if self.result_ok {
2558                         Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr {
2559                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHint>::clone(unsafe { &*self.contents.result })))
2560                         } }
2561                 } else {
2562                         Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr {
2563                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2564                         } }
2565                 }
2566         }
2567 }
2568 #[no_mangle]
2569 /// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
2570 /// but with all dynamically-allocated buffers duplicated in new buffers.
2571 pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) }
2572 #[repr(C)]
2573 /// The contents of CResult_RouteHintHopDecodeErrorZ
2574 pub union CResult_RouteHintHopDecodeErrorZPtr {
2575         /// A pointer to the contents in the success state.
2576         /// Reading from this pointer when `result_ok` is not set is undefined.
2577         pub result: *mut crate::lightning::routing::router::RouteHintHop,
2578         /// A pointer to the contents in the error state.
2579         /// Reading from this pointer when `result_ok` is set is undefined.
2580         pub err: *mut crate::lightning::ln::msgs::DecodeError,
2581 }
2582 #[repr(C)]
2583 /// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2584 /// containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2585 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2586 pub struct CResult_RouteHintHopDecodeErrorZ {
2587         /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2588         /// `err` or `result` depending on the state of `result_ok`.
2589         pub contents: CResult_RouteHintHopDecodeErrorZPtr,
2590         /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2591         pub result_ok: bool,
2592 }
2593 #[no_mangle]
2594 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
2595 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ {
2596         CResult_RouteHintHopDecodeErrorZ {
2597                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2598                         result: Box::into_raw(Box::new(o)),
2599                 },
2600                 result_ok: true,
2601         }
2602 }
2603 #[no_mangle]
2604 /// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
2605 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ {
2606         CResult_RouteHintHopDecodeErrorZ {
2607                 contents: CResult_RouteHintHopDecodeErrorZPtr {
2608                         err: Box::into_raw(Box::new(e)),
2609                 },
2610                 result_ok: false,
2611         }
2612 }
2613 /// Checks if the given object is currently in the success state
2614 #[no_mangle]
2615 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool {
2616         o.result_ok
2617 }
2618 #[no_mangle]
2619 /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
2620 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { }
2621 impl Drop for CResult_RouteHintHopDecodeErrorZ {
2622         fn drop(&mut self) {
2623                 if self.result_ok {
2624                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2625                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2626                         }
2627                 } else {
2628                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2629                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2630                         }
2631                 }
2632         }
2633 }
2634 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>> for CResult_RouteHintHopDecodeErrorZ {
2635         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::RouteHintHop, crate::lightning::ln::msgs::DecodeError>) -> Self {
2636                 let contents = if o.result_ok {
2637                         let result = unsafe { o.contents.result };
2638                         unsafe { o.contents.result = core::ptr::null_mut() };
2639                         CResult_RouteHintHopDecodeErrorZPtr { result }
2640                 } else {
2641                         let err = unsafe { o.contents.err };
2642                         unsafe { o.contents.err = core::ptr::null_mut(); }
2643                         CResult_RouteHintHopDecodeErrorZPtr { err }
2644                 };
2645                 Self {
2646                         contents,
2647                         result_ok: o.result_ok,
2648                 }
2649         }
2650 }
2651 impl Clone for CResult_RouteHintHopDecodeErrorZ {
2652         fn clone(&self) -> Self {
2653                 if self.result_ok {
2654                         Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr {
2655                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::RouteHintHop>::clone(unsafe { &*self.contents.result })))
2656                         } }
2657                 } else {
2658                         Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr {
2659                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2660                         } }
2661                 }
2662         }
2663 }
2664 #[no_mangle]
2665 /// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
2666 /// but with all dynamically-allocated buffers duplicated in new buffers.
2667 pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) }
2668 #[repr(C)]
2669 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2670 /// This corresponds to std::vector in C++
2671 pub struct CVec_ChannelDetailsZ {
2672         /// The elements in the array.
2673         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2674         pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails,
2675         /// The number of elements pointed to by `data`.
2676         pub datalen: usize
2677 }
2678 impl CVec_ChannelDetailsZ {
2679         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::ChannelDetails> {
2680                 if self.datalen == 0 { return Vec::new(); }
2681                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2682                 self.data = core::ptr::null_mut();
2683                 self.datalen = 0;
2684                 ret
2685         }
2686         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] {
2687                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2688         }
2689 }
2690 impl From<Vec<crate::lightning::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
2691         fn from(v: Vec<crate::lightning::ln::channelmanager::ChannelDetails>) -> Self {
2692                 let datalen = v.len();
2693                 let data = Box::into_raw(v.into_boxed_slice());
2694                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2695         }
2696 }
2697 #[no_mangle]
2698 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2699 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
2700 impl Drop for CVec_ChannelDetailsZ {
2701         fn drop(&mut self) {
2702                 if self.datalen == 0 { return; }
2703                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2704         }
2705 }
2706 impl Clone for CVec_ChannelDetailsZ {
2707         fn clone(&self) -> Self {
2708                 let mut res = Vec::new();
2709                 if self.datalen == 0 { return Self::from(res); }
2710                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2711                 Self::from(res)
2712         }
2713 }
2714 #[repr(C)]
2715 /// The contents of CResult_RouteLightningErrorZ
2716 pub union CResult_RouteLightningErrorZPtr {
2717         /// A pointer to the contents in the success state.
2718         /// Reading from this pointer when `result_ok` is not set is undefined.
2719         pub result: *mut crate::lightning::routing::router::Route,
2720         /// A pointer to the contents in the error state.
2721         /// Reading from this pointer when `result_ok` is set is undefined.
2722         pub err: *mut crate::lightning::ln::msgs::LightningError,
2723 }
2724 #[repr(C)]
2725 /// A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2726 /// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2727 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2728 pub struct CResult_RouteLightningErrorZ {
2729         /// The contents of this CResult_RouteLightningErrorZ, accessible via either
2730         /// `err` or `result` depending on the state of `result_ok`.
2731         pub contents: CResult_RouteLightningErrorZPtr,
2732         /// Whether this CResult_RouteLightningErrorZ represents a success state.
2733         pub result_ok: bool,
2734 }
2735 #[no_mangle]
2736 /// Creates a new CResult_RouteLightningErrorZ in the success state.
2737 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ {
2738         CResult_RouteLightningErrorZ {
2739                 contents: CResult_RouteLightningErrorZPtr {
2740                         result: Box::into_raw(Box::new(o)),
2741                 },
2742                 result_ok: true,
2743         }
2744 }
2745 #[no_mangle]
2746 /// Creates a new CResult_RouteLightningErrorZ in the error state.
2747 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
2748         CResult_RouteLightningErrorZ {
2749                 contents: CResult_RouteLightningErrorZPtr {
2750                         err: Box::into_raw(Box::new(e)),
2751                 },
2752                 result_ok: false,
2753         }
2754 }
2755 /// Checks if the given object is currently in the success state
2756 #[no_mangle]
2757 pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool {
2758         o.result_ok
2759 }
2760 #[no_mangle]
2761 /// Frees any resources used by the CResult_RouteLightningErrorZ.
2762 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
2763 impl Drop for CResult_RouteLightningErrorZ {
2764         fn drop(&mut self) {
2765                 if self.result_ok {
2766                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2767                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2768                         }
2769                 } else {
2770                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2771                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2772                         }
2773                 }
2774         }
2775 }
2776 impl From<crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
2777         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::router::Route, crate::lightning::ln::msgs::LightningError>) -> Self {
2778                 let contents = if o.result_ok {
2779                         let result = unsafe { o.contents.result };
2780                         unsafe { o.contents.result = core::ptr::null_mut() };
2781                         CResult_RouteLightningErrorZPtr { result }
2782                 } else {
2783                         let err = unsafe { o.contents.err };
2784                         unsafe { o.contents.err = core::ptr::null_mut(); }
2785                         CResult_RouteLightningErrorZPtr { err }
2786                 };
2787                 Self {
2788                         contents,
2789                         result_ok: o.result_ok,
2790                 }
2791         }
2792 }
2793 impl Clone for CResult_RouteLightningErrorZ {
2794         fn clone(&self) -> Self {
2795                 if self.result_ok {
2796                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
2797                                 result: Box::into_raw(Box::new(<crate::lightning::routing::router::Route>::clone(unsafe { &*self.contents.result })))
2798                         } }
2799                 } else {
2800                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
2801                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
2802                         } }
2803                 }
2804         }
2805 }
2806 #[no_mangle]
2807 /// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
2808 /// but with all dynamically-allocated buffers duplicated in new buffers.
2809 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) }
2810 #[repr(C)]
2811 /// The contents of CResult_TxOutAccessErrorZ
2812 pub union CResult_TxOutAccessErrorZPtr {
2813         /// A pointer to the contents in the success state.
2814         /// Reading from this pointer when `result_ok` is not set is undefined.
2815         pub result: *mut crate::c_types::TxOut,
2816         /// A pointer to the contents in the error state.
2817         /// Reading from this pointer when `result_ok` is set is undefined.
2818         pub err: *mut crate::lightning::chain::AccessError,
2819 }
2820 #[repr(C)]
2821 /// A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2822 /// containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2823 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
2824 pub struct CResult_TxOutAccessErrorZ {
2825         /// The contents of this CResult_TxOutAccessErrorZ, accessible via either
2826         /// `err` or `result` depending on the state of `result_ok`.
2827         pub contents: CResult_TxOutAccessErrorZPtr,
2828         /// Whether this CResult_TxOutAccessErrorZ represents a success state.
2829         pub result_ok: bool,
2830 }
2831 #[no_mangle]
2832 /// Creates a new CResult_TxOutAccessErrorZ in the success state.
2833 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2834         CResult_TxOutAccessErrorZ {
2835                 contents: CResult_TxOutAccessErrorZPtr {
2836                         result: Box::into_raw(Box::new(o)),
2837                 },
2838                 result_ok: true,
2839         }
2840 }
2841 #[no_mangle]
2842 /// Creates a new CResult_TxOutAccessErrorZ in the error state.
2843 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2844         CResult_TxOutAccessErrorZ {
2845                 contents: CResult_TxOutAccessErrorZPtr {
2846                         err: Box::into_raw(Box::new(e)),
2847                 },
2848                 result_ok: false,
2849         }
2850 }
2851 /// Checks if the given object is currently in the success state
2852 #[no_mangle]
2853 pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool {
2854         o.result_ok
2855 }
2856 #[no_mangle]
2857 /// Frees any resources used by the CResult_TxOutAccessErrorZ.
2858 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2859 impl Drop for CResult_TxOutAccessErrorZ {
2860         fn drop(&mut self) {
2861                 if self.result_ok {
2862                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2863                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2864                         }
2865                 } else {
2866                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2867                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2868                         }
2869                 }
2870         }
2871 }
2872 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>> for CResult_TxOutAccessErrorZ {
2873         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::lightning::chain::AccessError>) -> Self {
2874                 let contents = if o.result_ok {
2875                         let result = unsafe { o.contents.result };
2876                         unsafe { o.contents.result = core::ptr::null_mut() };
2877                         CResult_TxOutAccessErrorZPtr { result }
2878                 } else {
2879                         let err = unsafe { o.contents.err };
2880                         unsafe { o.contents.err = core::ptr::null_mut(); }
2881                         CResult_TxOutAccessErrorZPtr { err }
2882                 };
2883                 Self {
2884                         contents,
2885                         result_ok: o.result_ok,
2886                 }
2887         }
2888 }
2889 impl Clone for CResult_TxOutAccessErrorZ {
2890         fn clone(&self) -> Self {
2891                 if self.result_ok {
2892                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
2893                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
2894                         } }
2895                 } else {
2896                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
2897                                 err: Box::into_raw(Box::new(<crate::lightning::chain::AccessError>::clone(unsafe { &*self.contents.err })))
2898                         } }
2899                 }
2900         }
2901 }
2902 #[no_mangle]
2903 /// Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
2904 /// but with all dynamically-allocated buffers duplicated in new buffers.
2905 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { Clone::clone(&orig) }
2906 #[repr(C)]
2907 /// A tuple of 2 elements. See the individual fields for the types contained.
2908 pub struct C2Tuple_usizeTransactionZ {
2909         /// The element at position 0
2910         pub a: usize,
2911         /// The element at position 1
2912         pub b: crate::c_types::Transaction,
2913 }
2914 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2915         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2916                 Self {
2917                         a: tup.0,
2918                         b: tup.1,
2919                 }
2920         }
2921 }
2922 impl C2Tuple_usizeTransactionZ {
2923         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2924                 (self.a, self.b)
2925         }
2926 }
2927 impl Clone for C2Tuple_usizeTransactionZ {
2928         fn clone(&self) -> Self {
2929                 Self {
2930                         a: Clone::clone(&self.a),
2931                         b: Clone::clone(&self.b),
2932                 }
2933         }
2934 }
2935 #[no_mangle]
2936 /// Creates a new tuple which has the same data as `orig`
2937 /// but with all dynamically-allocated buffers duplicated in new buffers.
2938 pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) }
2939 /// Creates a new C2Tuple_usizeTransactionZ from the contained elements.
2940 #[no_mangle]
2941 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2942         C2Tuple_usizeTransactionZ { a, b, }
2943 }
2944
2945 #[no_mangle]
2946 /// Frees any resources used by the C2Tuple_usizeTransactionZ.
2947 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2948 #[repr(C)]
2949 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2950 /// This corresponds to std::vector in C++
2951 pub struct CVec_C2Tuple_usizeTransactionZZ {
2952         /// The elements in the array.
2953         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2954         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2955         /// The number of elements pointed to by `data`.
2956         pub datalen: usize
2957 }
2958 impl CVec_C2Tuple_usizeTransactionZZ {
2959         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2960                 if self.datalen == 0 { return Vec::new(); }
2961                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2962                 self.data = core::ptr::null_mut();
2963                 self.datalen = 0;
2964                 ret
2965         }
2966         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2967                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
2968         }
2969 }
2970 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2971         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2972                 let datalen = v.len();
2973                 let data = Box::into_raw(v.into_boxed_slice());
2974                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2975         }
2976 }
2977 #[no_mangle]
2978 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
2979 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2980 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2981         fn drop(&mut self) {
2982                 if self.datalen == 0 { return; }
2983                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
2984         }
2985 }
2986 impl Clone for CVec_C2Tuple_usizeTransactionZZ {
2987         fn clone(&self) -> Self {
2988                 let mut res = Vec::new();
2989                 if self.datalen == 0 { return Self::from(res); }
2990                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
2991                 Self::from(res)
2992         }
2993 }
2994 #[repr(C)]
2995 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2996 /// This corresponds to std::vector in C++
2997 pub struct CVec_TxidZ {
2998         /// The elements in the array.
2999         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3000         pub data: *mut crate::c_types::ThirtyTwoBytes,
3001         /// The number of elements pointed to by `data`.
3002         pub datalen: usize
3003 }
3004 impl CVec_TxidZ {
3005         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
3006                 if self.datalen == 0 { return Vec::new(); }
3007                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3008                 self.data = core::ptr::null_mut();
3009                 self.datalen = 0;
3010                 ret
3011         }
3012         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
3013                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3014         }
3015 }
3016 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_TxidZ {
3017         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
3018                 let datalen = v.len();
3019                 let data = Box::into_raw(v.into_boxed_slice());
3020                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3021         }
3022 }
3023 #[no_mangle]
3024 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3025 pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { }
3026 impl Drop for CVec_TxidZ {
3027         fn drop(&mut self) {
3028                 if self.datalen == 0 { return; }
3029                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3030         }
3031 }
3032 impl Clone for CVec_TxidZ {
3033         fn clone(&self) -> Self {
3034                 let mut res = Vec::new();
3035                 if self.datalen == 0 { return Self::from(res); }
3036                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3037                 Self::from(res)
3038         }
3039 }
3040 #[repr(C)]
3041 /// The contents of CResult_NoneChannelMonitorUpdateErrZ
3042 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
3043         /// Note that this value is always NULL, as there are no contents in the OK variant
3044         pub result: *mut core::ffi::c_void,
3045         /// A pointer to the contents in the error state.
3046         /// Reading from this pointer when `result_ok` is set is undefined.
3047         pub err: *mut crate::lightning::chain::ChannelMonitorUpdateErr,
3048 }
3049 #[repr(C)]
3050 /// A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
3051 /// containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
3052 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3053 pub struct CResult_NoneChannelMonitorUpdateErrZ {
3054         /// The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
3055         /// `err` or `result` depending on the state of `result_ok`.
3056         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
3057         /// Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
3058         pub result_ok: bool,
3059 }
3060 #[no_mangle]
3061 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
3062 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
3063         CResult_NoneChannelMonitorUpdateErrZ {
3064                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3065                         result: core::ptr::null_mut(),
3066                 },
3067                 result_ok: true,
3068         }
3069 }
3070 #[no_mangle]
3071 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
3072 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning::chain::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
3073         CResult_NoneChannelMonitorUpdateErrZ {
3074                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3075                         err: Box::into_raw(Box::new(e)),
3076                 },
3077                 result_ok: false,
3078         }
3079 }
3080 /// Checks if the given object is currently in the success state
3081 #[no_mangle]
3082 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool {
3083         o.result_ok
3084 }
3085 #[no_mangle]
3086 /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
3087 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
3088 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
3089         fn drop(&mut self) {
3090                 if self.result_ok {
3091                 } else {
3092                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3093                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3094                         }
3095                 }
3096         }
3097 }
3098 impl From<crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
3099         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::chain::ChannelMonitorUpdateErr>) -> Self {
3100                 let contents = if o.result_ok {
3101                         let _ = unsafe { Box::from_raw(o.contents.result) };
3102                         o.contents.result = core::ptr::null_mut();
3103                         CResult_NoneChannelMonitorUpdateErrZPtr { result: core::ptr::null_mut() }
3104                 } else {
3105                         let err = unsafe { o.contents.err };
3106                         unsafe { o.contents.err = core::ptr::null_mut(); }
3107                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
3108                 };
3109                 Self {
3110                         contents,
3111                         result_ok: o.result_ok,
3112                 }
3113         }
3114 }
3115 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
3116         fn clone(&self) -> Self {
3117                 if self.result_ok {
3118                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3119                                 result: core::ptr::null_mut()
3120                         } }
3121                 } else {
3122                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
3123                                 err: Box::into_raw(Box::new(<crate::lightning::chain::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
3124                         } }
3125                 }
3126         }
3127 }
3128 #[no_mangle]
3129 /// Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
3130 /// but with all dynamically-allocated buffers duplicated in new buffers.
3131 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { Clone::clone(&orig) }
3132 #[repr(C)]
3133 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
3134 /// This corresponds to std::vector in C++
3135 pub struct CVec_MonitorEventZ {
3136         /// The elements in the array.
3137         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3138         pub data: *mut crate::lightning::chain::channelmonitor::MonitorEvent,
3139         /// The number of elements pointed to by `data`.
3140         pub datalen: usize
3141 }
3142 impl CVec_MonitorEventZ {
3143         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::MonitorEvent> {
3144                 if self.datalen == 0 { return Vec::new(); }
3145                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3146                 self.data = core::ptr::null_mut();
3147                 self.datalen = 0;
3148                 ret
3149         }
3150         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] {
3151                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3152         }
3153 }
3154 impl From<Vec<crate::lightning::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
3155         fn from(v: Vec<crate::lightning::chain::channelmonitor::MonitorEvent>) -> Self {
3156                 let datalen = v.len();
3157                 let data = Box::into_raw(v.into_boxed_slice());
3158                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3159         }
3160 }
3161 #[no_mangle]
3162 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3163 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
3164 impl Drop for CVec_MonitorEventZ {
3165         fn drop(&mut self) {
3166                 if self.datalen == 0 { return; }
3167                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3168         }
3169 }
3170 impl Clone for CVec_MonitorEventZ {
3171         fn clone(&self) -> Self {
3172                 let mut res = Vec::new();
3173                 if self.datalen == 0 { return Self::from(res); }
3174                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3175                 Self::from(res)
3176         }
3177 }
3178 #[repr(C)]
3179 #[derive(Clone)]
3180 /// An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3181 pub enum COption_C2Tuple_usizeTransactionZZ {
3182         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3183         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3184         /// When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3185         None
3186 }
3187 impl COption_C2Tuple_usizeTransactionZZ {
3188         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3189                 if let Self::None = self { false } else { true }
3190         }
3191         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3192                 !self.is_some()
3193         }
3194         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3195                 if let Self::Some(v) = self { v } else { unreachable!() }
3196         }
3197 }
3198 #[no_mangle]
3199 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
3200 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_some(o: crate::c_types::derived::C2Tuple_usizeTransactionZ) -> COption_C2Tuple_usizeTransactionZZ {
3201         COption_C2Tuple_usizeTransactionZZ::Some(o)
3202 }
3203 #[no_mangle]
3204 /// Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
3205 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_none() -> COption_C2Tuple_usizeTransactionZZ {
3206         COption_C2Tuple_usizeTransactionZZ::None
3207 }
3208 #[no_mangle]
3209 /// Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
3210 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3211 #[no_mangle]
3212 /// Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
3213 /// but with all dynamically-allocated buffers duplicated in new buffers.
3214 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) }
3215 #[repr(C)]
3216 #[derive(Clone)]
3217 /// An enum which can either contain a crate::lightning::util::events::ClosureReason or not
3218 pub enum COption_ClosureReasonZ {
3219         /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
3220         Some(crate::lightning::util::events::ClosureReason),
3221         /// When we're in this state, this COption_ClosureReasonZ contains nothing
3222         None
3223 }
3224 impl COption_ClosureReasonZ {
3225         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3226                 if let Self::None = self { false } else { true }
3227         }
3228         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3229                 !self.is_some()
3230         }
3231         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason {
3232                 if let Self::Some(v) = self { v } else { unreachable!() }
3233         }
3234 }
3235 #[no_mangle]
3236 /// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
3237 pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ {
3238         COption_ClosureReasonZ::Some(o)
3239 }
3240 #[no_mangle]
3241 /// Constructs a new COption_ClosureReasonZ containing nothing
3242 pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ {
3243         COption_ClosureReasonZ::None
3244 }
3245 #[no_mangle]
3246 /// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
3247 pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { }
3248 #[no_mangle]
3249 /// Creates a new COption_ClosureReasonZ which has the same data as `orig`
3250 /// but with all dynamically-allocated buffers duplicated in new buffers.
3251 pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) }
3252 #[repr(C)]
3253 /// The contents of CResult_COption_ClosureReasonZDecodeErrorZ
3254 pub union CResult_COption_ClosureReasonZDecodeErrorZPtr {
3255         /// A pointer to the contents in the success state.
3256         /// Reading from this pointer when `result_ok` is not set is undefined.
3257         pub result: *mut crate::c_types::derived::COption_ClosureReasonZ,
3258         /// A pointer to the contents in the error state.
3259         /// Reading from this pointer when `result_ok` is set is undefined.
3260         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3261 }
3262 #[repr(C)]
3263 /// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
3264 /// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3265 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3266 pub struct CResult_COption_ClosureReasonZDecodeErrorZ {
3267         /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
3268         /// `err` or `result` depending on the state of `result_ok`.
3269         pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr,
3270         /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
3271         pub result_ok: bool,
3272 }
3273 #[no_mangle]
3274 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
3275 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3276         CResult_COption_ClosureReasonZDecodeErrorZ {
3277                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3278                         result: Box::into_raw(Box::new(o)),
3279                 },
3280                 result_ok: true,
3281         }
3282 }
3283 #[no_mangle]
3284 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
3285 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ {
3286         CResult_COption_ClosureReasonZDecodeErrorZ {
3287                 contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3288                         err: Box::into_raw(Box::new(e)),
3289                 },
3290                 result_ok: false,
3291         }
3292 }
3293 /// Checks if the given object is currently in the success state
3294 #[no_mangle]
3295 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool {
3296         o.result_ok
3297 }
3298 #[no_mangle]
3299 /// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
3300 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { }
3301 impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ {
3302         fn drop(&mut self) {
3303                 if self.result_ok {
3304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3306                         }
3307                 } else {
3308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3310                         }
3311                 }
3312         }
3313 }
3314 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_ClosureReasonZDecodeErrorZ {
3315         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_ClosureReasonZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3316                 let contents = if o.result_ok {
3317                         let result = unsafe { o.contents.result };
3318                         unsafe { o.contents.result = core::ptr::null_mut() };
3319                         CResult_COption_ClosureReasonZDecodeErrorZPtr { result }
3320                 } else {
3321                         let err = unsafe { o.contents.err };
3322                         unsafe { o.contents.err = core::ptr::null_mut(); }
3323                         CResult_COption_ClosureReasonZDecodeErrorZPtr { err }
3324                 };
3325                 Self {
3326                         contents,
3327                         result_ok: o.result_ok,
3328                 }
3329         }
3330 }
3331 impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ {
3332         fn clone(&self) -> Self {
3333                 if self.result_ok {
3334                         Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3335                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_ClosureReasonZ>::clone(unsafe { &*self.contents.result })))
3336                         } }
3337                 } else {
3338                         Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr {
3339                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3340                         } }
3341                 }
3342         }
3343 }
3344 #[no_mangle]
3345 /// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
3346 /// but with all dynamically-allocated buffers duplicated in new buffers.
3347 pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) }
3348 #[repr(C)]
3349 #[derive(Clone)]
3350 /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
3351 pub enum COption_NetworkUpdateZ {
3352         /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
3353         Some(crate::lightning::routing::network_graph::NetworkUpdate),
3354         /// When we're in this state, this COption_NetworkUpdateZ contains nothing
3355         None
3356 }
3357 impl COption_NetworkUpdateZ {
3358         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3359                 if let Self::None = self { false } else { true }
3360         }
3361         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3362                 !self.is_some()
3363         }
3364         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::network_graph::NetworkUpdate {
3365                 if let Self::Some(v) = self { v } else { unreachable!() }
3366         }
3367 }
3368 #[no_mangle]
3369 /// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
3370 pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::network_graph::NetworkUpdate) -> COption_NetworkUpdateZ {
3371         COption_NetworkUpdateZ::Some(o)
3372 }
3373 #[no_mangle]
3374 /// Constructs a new COption_NetworkUpdateZ containing nothing
3375 pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ {
3376         COption_NetworkUpdateZ::None
3377 }
3378 #[no_mangle]
3379 /// Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
3380 pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { }
3381 #[no_mangle]
3382 /// Creates a new COption_NetworkUpdateZ which has the same data as `orig`
3383 /// but with all dynamically-allocated buffers duplicated in new buffers.
3384 pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) }
3385 #[repr(C)]
3386 /// A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
3387 /// This corresponds to std::vector in C++
3388 pub struct CVec_SpendableOutputDescriptorZ {
3389         /// The elements in the array.
3390         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3391         pub data: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
3392         /// The number of elements pointed to by `data`.
3393         pub datalen: usize
3394 }
3395 impl CVec_SpendableOutputDescriptorZ {
3396         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor> {
3397                 if self.datalen == 0 { return Vec::new(); }
3398                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3399                 self.data = core::ptr::null_mut();
3400                 self.datalen = 0;
3401                 ret
3402         }
3403         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::keysinterface::SpendableOutputDescriptor] {
3404                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3405         }
3406 }
3407 impl From<Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3408         fn from(v: Vec<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3409                 let datalen = v.len();
3410                 let data = Box::into_raw(v.into_boxed_slice());
3411                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3412         }
3413 }
3414 #[no_mangle]
3415 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3416 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3417 impl Drop for CVec_SpendableOutputDescriptorZ {
3418         fn drop(&mut self) {
3419                 if self.datalen == 0 { return; }
3420                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3421         }
3422 }
3423 impl Clone for CVec_SpendableOutputDescriptorZ {
3424         fn clone(&self) -> Self {
3425                 let mut res = Vec::new();
3426                 if self.datalen == 0 { return Self::from(res); }
3427                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3428                 Self::from(res)
3429         }
3430 }
3431 #[repr(C)]
3432 #[derive(Clone)]
3433 /// An enum which can either contain a crate::lightning::util::events::Event or not
3434 pub enum COption_EventZ {
3435         /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3436         Some(crate::lightning::util::events::Event),
3437         /// When we're in this state, this COption_EventZ contains nothing
3438         None
3439 }
3440 impl COption_EventZ {
3441         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3442                 if let Self::None = self { false } else { true }
3443         }
3444         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
3445                 !self.is_some()
3446         }
3447         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event {
3448                 if let Self::Some(v) = self { v } else { unreachable!() }
3449         }
3450 }
3451 #[no_mangle]
3452 /// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
3453 pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ {
3454         COption_EventZ::Some(o)
3455 }
3456 #[no_mangle]
3457 /// Constructs a new COption_EventZ containing nothing
3458 pub extern "C" fn COption_EventZ_none() -> COption_EventZ {
3459         COption_EventZ::None
3460 }
3461 #[no_mangle]
3462 /// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
3463 pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { }
3464 #[no_mangle]
3465 /// Creates a new COption_EventZ which has the same data as `orig`
3466 /// but with all dynamically-allocated buffers duplicated in new buffers.
3467 pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) }
3468 #[repr(C)]
3469 /// The contents of CResult_COption_EventZDecodeErrorZ
3470 pub union CResult_COption_EventZDecodeErrorZPtr {
3471         /// A pointer to the contents in the success state.
3472         /// Reading from this pointer when `result_ok` is not set is undefined.
3473         pub result: *mut crate::c_types::derived::COption_EventZ,
3474         /// A pointer to the contents in the error state.
3475         /// Reading from this pointer when `result_ok` is set is undefined.
3476         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3477 }
3478 #[repr(C)]
3479 /// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3480 /// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3481 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3482 pub struct CResult_COption_EventZDecodeErrorZ {
3483         /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3484         /// `err` or `result` depending on the state of `result_ok`.
3485         pub contents: CResult_COption_EventZDecodeErrorZPtr,
3486         /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3487         pub result_ok: bool,
3488 }
3489 #[no_mangle]
3490 /// Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
3491 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ {
3492         CResult_COption_EventZDecodeErrorZ {
3493                 contents: CResult_COption_EventZDecodeErrorZPtr {
3494                         result: Box::into_raw(Box::new(o)),
3495                 },
3496                 result_ok: true,
3497         }
3498 }
3499 #[no_mangle]
3500 /// Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
3501 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ {
3502         CResult_COption_EventZDecodeErrorZ {
3503                 contents: CResult_COption_EventZDecodeErrorZPtr {
3504                         err: Box::into_raw(Box::new(e)),
3505                 },
3506                 result_ok: false,
3507         }
3508 }
3509 /// Checks if the given object is currently in the success state
3510 #[no_mangle]
3511 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool {
3512         o.result_ok
3513 }
3514 #[no_mangle]
3515 /// Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
3516 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { }
3517 impl Drop for CResult_COption_EventZDecodeErrorZ {
3518         fn drop(&mut self) {
3519                 if self.result_ok {
3520                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3521                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3522                         }
3523                 } else {
3524                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3525                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3526                         }
3527                 }
3528         }
3529 }
3530 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_EventZDecodeErrorZ {
3531         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_EventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
3532                 let contents = if o.result_ok {
3533                         let result = unsafe { o.contents.result };
3534                         unsafe { o.contents.result = core::ptr::null_mut() };
3535                         CResult_COption_EventZDecodeErrorZPtr { result }
3536                 } else {
3537                         let err = unsafe { o.contents.err };
3538                         unsafe { o.contents.err = core::ptr::null_mut(); }
3539                         CResult_COption_EventZDecodeErrorZPtr { err }
3540                 };
3541                 Self {
3542                         contents,
3543                         result_ok: o.result_ok,
3544                 }
3545         }
3546 }
3547 impl Clone for CResult_COption_EventZDecodeErrorZ {
3548         fn clone(&self) -> Self {
3549                 if self.result_ok {
3550                         Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr {
3551                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_EventZ>::clone(unsafe { &*self.contents.result })))
3552                         } }
3553                 } else {
3554                         Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr {
3555                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3556                         } }
3557                 }
3558         }
3559 }
3560 #[no_mangle]
3561 /// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
3562 /// but with all dynamically-allocated buffers duplicated in new buffers.
3563 pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) }
3564 #[repr(C)]
3565 /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3566 /// This corresponds to std::vector in C++
3567 pub struct CVec_MessageSendEventZ {
3568         /// The elements in the array.
3569         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3570         pub data: *mut crate::lightning::util::events::MessageSendEvent,
3571         /// The number of elements pointed to by `data`.
3572         pub datalen: usize
3573 }
3574 impl CVec_MessageSendEventZ {
3575         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::MessageSendEvent> {
3576                 if self.datalen == 0 { return Vec::new(); }
3577                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3578                 self.data = core::ptr::null_mut();
3579                 self.datalen = 0;
3580                 ret
3581         }
3582         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::MessageSendEvent] {
3583                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
3584         }
3585 }
3586 impl From<Vec<crate::lightning::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
3587         fn from(v: Vec<crate::lightning::util::events::MessageSendEvent>) -> Self {
3588                 let datalen = v.len();
3589                 let data = Box::into_raw(v.into_boxed_slice());
3590                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3591         }
3592 }
3593 #[no_mangle]
3594 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
3595 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
3596 impl Drop for CVec_MessageSendEventZ {
3597         fn drop(&mut self) {
3598                 if self.datalen == 0 { return; }
3599                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
3600         }
3601 }
3602 impl Clone for CVec_MessageSendEventZ {
3603         fn clone(&self) -> Self {
3604                 let mut res = Vec::new();
3605                 if self.datalen == 0 { return Self::from(res); }
3606                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
3607                 Self::from(res)
3608         }
3609 }
3610 #[repr(C)]
3611 /// The contents of CResult_FixedPenaltyScorerDecodeErrorZ
3612 pub union CResult_FixedPenaltyScorerDecodeErrorZPtr {
3613         /// A pointer to the contents in the success state.
3614         /// Reading from this pointer when `result_ok` is not set is undefined.
3615         pub result: *mut crate::lightning::routing::scoring::FixedPenaltyScorer,
3616         /// A pointer to the contents in the error state.
3617         /// Reading from this pointer when `result_ok` is set is undefined.
3618         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3619 }
3620 #[repr(C)]
3621 /// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
3622 /// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3623 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3624 pub struct CResult_FixedPenaltyScorerDecodeErrorZ {
3625         /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
3626         /// `err` or `result` depending on the state of `result_ok`.
3627         pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr,
3628         /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
3629         pub result_ok: bool,
3630 }
3631 #[no_mangle]
3632 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
3633 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3634         CResult_FixedPenaltyScorerDecodeErrorZ {
3635                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3636                         result: Box::into_raw(Box::new(o)),
3637                 },
3638                 result_ok: true,
3639         }
3640 }
3641 #[no_mangle]
3642 /// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
3643 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ {
3644         CResult_FixedPenaltyScorerDecodeErrorZ {
3645                 contents: CResult_FixedPenaltyScorerDecodeErrorZPtr {
3646                         err: Box::into_raw(Box::new(e)),
3647                 },
3648                 result_ok: false,
3649         }
3650 }
3651 /// Checks if the given object is currently in the success state
3652 #[no_mangle]
3653 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool {
3654         o.result_ok
3655 }
3656 #[no_mangle]
3657 /// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
3658 pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { }
3659 impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ {
3660         fn drop(&mut self) {
3661                 if self.result_ok {
3662                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3663                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3664                         }
3665                 } else {
3666                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3667                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3668                         }
3669                 }
3670         }
3671 }
3672 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>> for CResult_FixedPenaltyScorerDecodeErrorZ {
3673         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::FixedPenaltyScorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3674                 let contents = if o.result_ok {
3675                         let result = unsafe { o.contents.result };
3676                         unsafe { o.contents.result = core::ptr::null_mut() };
3677                         CResult_FixedPenaltyScorerDecodeErrorZPtr { result }
3678                 } else {
3679                         let err = unsafe { o.contents.err };
3680                         unsafe { o.contents.err = core::ptr::null_mut(); }
3681                         CResult_FixedPenaltyScorerDecodeErrorZPtr { err }
3682                 };
3683                 Self {
3684                         contents,
3685                         result_ok: o.result_ok,
3686                 }
3687         }
3688 }
3689 #[repr(C)]
3690 /// The contents of CResult_ScoringParametersDecodeErrorZ
3691 pub union CResult_ScoringParametersDecodeErrorZPtr {
3692         /// A pointer to the contents in the success state.
3693         /// Reading from this pointer when `result_ok` is not set is undefined.
3694         pub result: *mut crate::lightning::routing::scoring::ScoringParameters,
3695         /// A pointer to the contents in the error state.
3696         /// Reading from this pointer when `result_ok` is set is undefined.
3697         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3698 }
3699 #[repr(C)]
3700 /// A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
3701 /// containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3702 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3703 pub struct CResult_ScoringParametersDecodeErrorZ {
3704         /// The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
3705         /// `err` or `result` depending on the state of `result_ok`.
3706         pub contents: CResult_ScoringParametersDecodeErrorZPtr,
3707         /// Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
3708         pub result_ok: bool,
3709 }
3710 #[no_mangle]
3711 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
3712 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ScoringParameters) -> CResult_ScoringParametersDecodeErrorZ {
3713         CResult_ScoringParametersDecodeErrorZ {
3714                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3715                         result: Box::into_raw(Box::new(o)),
3716                 },
3717                 result_ok: true,
3718         }
3719 }
3720 #[no_mangle]
3721 /// Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
3722 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScoringParametersDecodeErrorZ {
3723         CResult_ScoringParametersDecodeErrorZ {
3724                 contents: CResult_ScoringParametersDecodeErrorZPtr {
3725                         err: Box::into_raw(Box::new(e)),
3726                 },
3727                 result_ok: false,
3728         }
3729 }
3730 /// Checks if the given object is currently in the success state
3731 #[no_mangle]
3732 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool {
3733         o.result_ok
3734 }
3735 #[no_mangle]
3736 /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
3737 pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { }
3738 impl Drop for CResult_ScoringParametersDecodeErrorZ {
3739         fn drop(&mut self) {
3740                 if self.result_ok {
3741                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3742                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3743                         }
3744                 } else {
3745                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3746                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3747                         }
3748                 }
3749         }
3750 }
3751 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ScoringParametersDecodeErrorZ {
3752         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3753                 let contents = if o.result_ok {
3754                         let result = unsafe { o.contents.result };
3755                         unsafe { o.contents.result = core::ptr::null_mut() };
3756                         CResult_ScoringParametersDecodeErrorZPtr { result }
3757                 } else {
3758                         let err = unsafe { o.contents.err };
3759                         unsafe { o.contents.err = core::ptr::null_mut(); }
3760                         CResult_ScoringParametersDecodeErrorZPtr { err }
3761                 };
3762                 Self {
3763                         contents,
3764                         result_ok: o.result_ok,
3765                 }
3766         }
3767 }
3768 #[repr(C)]
3769 /// The contents of CResult_ScorerDecodeErrorZ
3770 pub union CResult_ScorerDecodeErrorZPtr {
3771         /// A pointer to the contents in the success state.
3772         /// Reading from this pointer when `result_ok` is not set is undefined.
3773         pub result: *mut crate::lightning::routing::scoring::Scorer,
3774         /// A pointer to the contents in the error state.
3775         /// Reading from this pointer when `result_ok` is set is undefined.
3776         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3777 }
3778 #[repr(C)]
3779 /// A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
3780 /// containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
3781 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3782 pub struct CResult_ScorerDecodeErrorZ {
3783         /// The contents of this CResult_ScorerDecodeErrorZ, accessible via either
3784         /// `err` or `result` depending on the state of `result_ok`.
3785         pub contents: CResult_ScorerDecodeErrorZPtr,
3786         /// Whether this CResult_ScorerDecodeErrorZ represents a success state.
3787         pub result_ok: bool,
3788 }
3789 #[no_mangle]
3790 /// Creates a new CResult_ScorerDecodeErrorZ in the success state.
3791 pub extern "C" fn CResult_ScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::Scorer) -> CResult_ScorerDecodeErrorZ {
3792         CResult_ScorerDecodeErrorZ {
3793                 contents: CResult_ScorerDecodeErrorZPtr {
3794                         result: Box::into_raw(Box::new(o)),
3795                 },
3796                 result_ok: true,
3797         }
3798 }
3799 #[no_mangle]
3800 /// Creates a new CResult_ScorerDecodeErrorZ in the error state.
3801 pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ScorerDecodeErrorZ {
3802         CResult_ScorerDecodeErrorZ {
3803                 contents: CResult_ScorerDecodeErrorZPtr {
3804                         err: Box::into_raw(Box::new(e)),
3805                 },
3806                 result_ok: false,
3807         }
3808 }
3809 /// Checks if the given object is currently in the success state
3810 #[no_mangle]
3811 pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool {
3812         o.result_ok
3813 }
3814 #[no_mangle]
3815 /// Frees any resources used by the CResult_ScorerDecodeErrorZ.
3816 pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { }
3817 impl Drop for CResult_ScorerDecodeErrorZ {
3818         fn drop(&mut self) {
3819                 if self.result_ok {
3820                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3821                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3822                         }
3823                 } else {
3824                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3825                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3826                         }
3827                 }
3828         }
3829 }
3830 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>> for CResult_ScorerDecodeErrorZ {
3831         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::Scorer, crate::lightning::ln::msgs::DecodeError>) -> Self {
3832                 let contents = if o.result_ok {
3833                         let result = unsafe { o.contents.result };
3834                         unsafe { o.contents.result = core::ptr::null_mut() };
3835                         CResult_ScorerDecodeErrorZPtr { result }
3836                 } else {
3837                         let err = unsafe { o.contents.err };
3838                         unsafe { o.contents.err = core::ptr::null_mut(); }
3839                         CResult_ScorerDecodeErrorZPtr { err }
3840                 };
3841                 Self {
3842                         contents,
3843                         result_ok: o.result_ok,
3844                 }
3845         }
3846 }
3847 #[repr(C)]
3848 /// The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
3849 pub union CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3850         /// A pointer to the contents in the success state.
3851         /// Reading from this pointer when `result_ok` is not set is undefined.
3852         pub result: *mut crate::lightning::routing::scoring::ProbabilisticScoringParameters,
3853         /// A pointer to the contents in the error state.
3854         /// Reading from this pointer when `result_ok` is set is undefined.
3855         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3856 }
3857 #[repr(C)]
3858 /// A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
3859 /// containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
3860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3861 pub struct CResult_ProbabilisticScoringParametersDecodeErrorZ {
3862         /// The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
3863         /// `err` or `result` depending on the state of `result_ok`.
3864         pub contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr,
3865         /// Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
3866         pub result_ok: bool,
3867 }
3868 #[no_mangle]
3869 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
3870 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScoringParameters) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3871         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3872                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3873                         result: Box::into_raw(Box::new(o)),
3874                 },
3875                 result_ok: true,
3876         }
3877 }
3878 #[no_mangle]
3879 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
3880 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScoringParametersDecodeErrorZ {
3881         CResult_ProbabilisticScoringParametersDecodeErrorZ {
3882                 contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3883                         err: Box::into_raw(Box::new(e)),
3884                 },
3885                 result_ok: false,
3886         }
3887 }
3888 /// Checks if the given object is currently in the success state
3889 #[no_mangle]
3890 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> bool {
3891         o.result_ok
3892 }
3893 #[no_mangle]
3894 /// Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
3895 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res: CResult_ProbabilisticScoringParametersDecodeErrorZ) { }
3896 impl Drop for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3897         fn drop(&mut self) {
3898                 if self.result_ok {
3899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3901                         }
3902                 } else {
3903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3905                         }
3906                 }
3907         }
3908 }
3909 impl From<crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>> for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3910         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::scoring::ProbabilisticScoringParameters, crate::lightning::ln::msgs::DecodeError>) -> Self {
3911                 let contents = if o.result_ok {
3912                         let result = unsafe { o.contents.result };
3913                         unsafe { o.contents.result = core::ptr::null_mut() };
3914                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { result }
3915                 } else {
3916                         let err = unsafe { o.contents.err };
3917                         unsafe { o.contents.err = core::ptr::null_mut(); }
3918                         CResult_ProbabilisticScoringParametersDecodeErrorZPtr { err }
3919                 };
3920                 Self {
3921                         contents,
3922                         result_ok: o.result_ok,
3923                 }
3924         }
3925 }
3926 impl Clone for CResult_ProbabilisticScoringParametersDecodeErrorZ {
3927         fn clone(&self) -> Self {
3928                 if self.result_ok {
3929                         Self { result_ok: true, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3930                                 result: Box::into_raw(Box::new(<crate::lightning::routing::scoring::ProbabilisticScoringParameters>::clone(unsafe { &*self.contents.result })))
3931                         } }
3932                 } else {
3933                         Self { result_ok: false, contents: CResult_ProbabilisticScoringParametersDecodeErrorZPtr {
3934                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3935                         } }
3936                 }
3937         }
3938 }
3939 #[no_mangle]
3940 /// Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
3941 /// but with all dynamically-allocated buffers duplicated in new buffers.
3942 pub extern "C" fn CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig: &CResult_ProbabilisticScoringParametersDecodeErrorZ) -> CResult_ProbabilisticScoringParametersDecodeErrorZ { Clone::clone(&orig) }
3943 #[repr(C)]
3944 /// The contents of CResult_InitFeaturesDecodeErrorZ
3945 pub union CResult_InitFeaturesDecodeErrorZPtr {
3946         /// A pointer to the contents in the success state.
3947         /// Reading from this pointer when `result_ok` is not set is undefined.
3948         pub result: *mut crate::lightning::ln::features::InitFeatures,
3949         /// A pointer to the contents in the error state.
3950         /// Reading from this pointer when `result_ok` is set is undefined.
3951         pub err: *mut crate::lightning::ln::msgs::DecodeError,
3952 }
3953 #[repr(C)]
3954 /// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
3955 /// containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3956 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
3957 pub struct CResult_InitFeaturesDecodeErrorZ {
3958         /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
3959         /// `err` or `result` depending on the state of `result_ok`.
3960         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
3961         /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
3962         pub result_ok: bool,
3963 }
3964 #[no_mangle]
3965 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
3966 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
3967         CResult_InitFeaturesDecodeErrorZ {
3968                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3969                         result: Box::into_raw(Box::new(o)),
3970                 },
3971                 result_ok: true,
3972         }
3973 }
3974 #[no_mangle]
3975 /// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
3976 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
3977         CResult_InitFeaturesDecodeErrorZ {
3978                 contents: CResult_InitFeaturesDecodeErrorZPtr {
3979                         err: Box::into_raw(Box::new(e)),
3980                 },
3981                 result_ok: false,
3982         }
3983 }
3984 /// Checks if the given object is currently in the success state
3985 #[no_mangle]
3986 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool {
3987         o.result_ok
3988 }
3989 #[no_mangle]
3990 /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
3991 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
3992 impl Drop for CResult_InitFeaturesDecodeErrorZ {
3993         fn drop(&mut self) {
3994                 if self.result_ok {
3995                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3996                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3997                         }
3998                 } else {
3999                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4000                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4001                         }
4002                 }
4003         }
4004 }
4005 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
4006         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InitFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4007                 let contents = if o.result_ok {
4008                         let result = unsafe { o.contents.result };
4009                         unsafe { o.contents.result = core::ptr::null_mut() };
4010                         CResult_InitFeaturesDecodeErrorZPtr { result }
4011                 } else {
4012                         let err = unsafe { o.contents.err };
4013                         unsafe { o.contents.err = core::ptr::null_mut(); }
4014                         CResult_InitFeaturesDecodeErrorZPtr { err }
4015                 };
4016                 Self {
4017                         contents,
4018                         result_ok: o.result_ok,
4019                 }
4020         }
4021 }
4022 #[repr(C)]
4023 /// The contents of CResult_ChannelFeaturesDecodeErrorZ
4024 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
4025         /// A pointer to the contents in the success state.
4026         /// Reading from this pointer when `result_ok` is not set is undefined.
4027         pub result: *mut crate::lightning::ln::features::ChannelFeatures,
4028         /// A pointer to the contents in the error state.
4029         /// Reading from this pointer when `result_ok` is set is undefined.
4030         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4031 }
4032 #[repr(C)]
4033 /// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4034 /// containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4035 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4036 pub struct CResult_ChannelFeaturesDecodeErrorZ {
4037         /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4038         /// `err` or `result` depending on the state of `result_ok`.
4039         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
4040         /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4041         pub result_ok: bool,
4042 }
4043 #[no_mangle]
4044 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
4045 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
4046         CResult_ChannelFeaturesDecodeErrorZ {
4047                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4048                         result: Box::into_raw(Box::new(o)),
4049                 },
4050                 result_ok: true,
4051         }
4052 }
4053 #[no_mangle]
4054 /// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
4055 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
4056         CResult_ChannelFeaturesDecodeErrorZ {
4057                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
4058                         err: Box::into_raw(Box::new(e)),
4059                 },
4060                 result_ok: false,
4061         }
4062 }
4063 /// Checks if the given object is currently in the success state
4064 #[no_mangle]
4065 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool {
4066         o.result_ok
4067 }
4068 #[no_mangle]
4069 /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
4070 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
4071 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
4072         fn drop(&mut self) {
4073                 if self.result_ok {
4074                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4075                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4076                         }
4077                 } else {
4078                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4079                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4080                         }
4081                 }
4082         }
4083 }
4084 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
4085         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4086                 let contents = if o.result_ok {
4087                         let result = unsafe { o.contents.result };
4088                         unsafe { o.contents.result = core::ptr::null_mut() };
4089                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
4090                 } else {
4091                         let err = unsafe { o.contents.err };
4092                         unsafe { o.contents.err = core::ptr::null_mut(); }
4093                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
4094                 };
4095                 Self {
4096                         contents,
4097                         result_ok: o.result_ok,
4098                 }
4099         }
4100 }
4101 #[repr(C)]
4102 /// The contents of CResult_NodeFeaturesDecodeErrorZ
4103 pub union CResult_NodeFeaturesDecodeErrorZPtr {
4104         /// A pointer to the contents in the success state.
4105         /// Reading from this pointer when `result_ok` is not set is undefined.
4106         pub result: *mut crate::lightning::ln::features::NodeFeatures,
4107         /// A pointer to the contents in the error state.
4108         /// Reading from this pointer when `result_ok` is set is undefined.
4109         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4110 }
4111 #[repr(C)]
4112 /// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4113 /// containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4114 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4115 pub struct CResult_NodeFeaturesDecodeErrorZ {
4116         /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4117         /// `err` or `result` depending on the state of `result_ok`.
4118         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
4119         /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4120         pub result_ok: bool,
4121 }
4122 #[no_mangle]
4123 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
4124 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
4125         CResult_NodeFeaturesDecodeErrorZ {
4126                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4127                         result: Box::into_raw(Box::new(o)),
4128                 },
4129                 result_ok: true,
4130         }
4131 }
4132 #[no_mangle]
4133 /// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
4134 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
4135         CResult_NodeFeaturesDecodeErrorZ {
4136                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
4137                         err: Box::into_raw(Box::new(e)),
4138                 },
4139                 result_ok: false,
4140         }
4141 }
4142 /// Checks if the given object is currently in the success state
4143 #[no_mangle]
4144 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool {
4145         o.result_ok
4146 }
4147 #[no_mangle]
4148 /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
4149 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
4150 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
4151         fn drop(&mut self) {
4152                 if self.result_ok {
4153                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4154                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4155                         }
4156                 } else {
4157                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4158                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4159                         }
4160                 }
4161         }
4162 }
4163 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
4164         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::NodeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4165                 let contents = if o.result_ok {
4166                         let result = unsafe { o.contents.result };
4167                         unsafe { o.contents.result = core::ptr::null_mut() };
4168                         CResult_NodeFeaturesDecodeErrorZPtr { result }
4169                 } else {
4170                         let err = unsafe { o.contents.err };
4171                         unsafe { o.contents.err = core::ptr::null_mut(); }
4172                         CResult_NodeFeaturesDecodeErrorZPtr { err }
4173                 };
4174                 Self {
4175                         contents,
4176                         result_ok: o.result_ok,
4177                 }
4178         }
4179 }
4180 #[repr(C)]
4181 /// The contents of CResult_InvoiceFeaturesDecodeErrorZ
4182 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
4183         /// A pointer to the contents in the success state.
4184         /// Reading from this pointer when `result_ok` is not set is undefined.
4185         pub result: *mut crate::lightning::ln::features::InvoiceFeatures,
4186         /// A pointer to the contents in the error state.
4187         /// Reading from this pointer when `result_ok` is set is undefined.
4188         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4189 }
4190 #[repr(C)]
4191 /// A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4192 /// containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4193 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
4195         /// The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4196         /// `err` or `result` depending on the state of `result_ok`.
4197         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
4198         /// Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4199         pub result_ok: bool,
4200 }
4201 #[no_mangle]
4202 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
4203 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
4204         CResult_InvoiceFeaturesDecodeErrorZ {
4205                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4206                         result: Box::into_raw(Box::new(o)),
4207                 },
4208                 result_ok: true,
4209         }
4210 }
4211 #[no_mangle]
4212 /// Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
4213 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
4214         CResult_InvoiceFeaturesDecodeErrorZ {
4215                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
4216                         err: Box::into_raw(Box::new(e)),
4217                 },
4218                 result_ok: false,
4219         }
4220 }
4221 /// Checks if the given object is currently in the success state
4222 #[no_mangle]
4223 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool {
4224         o.result_ok
4225 }
4226 #[no_mangle]
4227 /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
4228 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
4229 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
4230         fn drop(&mut self) {
4231                 if self.result_ok {
4232                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4233                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4234                         }
4235                 } else {
4236                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4237                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4238                         }
4239                 }
4240         }
4241 }
4242 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
4243         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::InvoiceFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4244                 let contents = if o.result_ok {
4245                         let result = unsafe { o.contents.result };
4246                         unsafe { o.contents.result = core::ptr::null_mut() };
4247                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
4248                 } else {
4249                         let err = unsafe { o.contents.err };
4250                         unsafe { o.contents.err = core::ptr::null_mut(); }
4251                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
4252                 };
4253                 Self {
4254                         contents,
4255                         result_ok: o.result_ok,
4256                 }
4257         }
4258 }
4259 #[repr(C)]
4260 /// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4261 pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4262         /// A pointer to the contents in the success state.
4263         /// Reading from this pointer when `result_ok` is not set is undefined.
4264         pub result: *mut crate::lightning::ln::features::ChannelTypeFeatures,
4265         /// A pointer to the contents in the error state.
4266         /// Reading from this pointer when `result_ok` is set is undefined.
4267         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4268 }
4269 #[repr(C)]
4270 /// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4271 /// containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4272 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4273 pub struct CResult_ChannelTypeFeaturesDecodeErrorZ {
4274         /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4275         /// `err` or `result` depending on the state of `result_ok`.
4276         pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr,
4277         /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4278         pub result_ok: bool,
4279 }
4280 #[no_mangle]
4281 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
4282 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4283         CResult_ChannelTypeFeaturesDecodeErrorZ {
4284                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4285                         result: Box::into_raw(Box::new(o)),
4286                 },
4287                 result_ok: true,
4288         }
4289 }
4290 #[no_mangle]
4291 /// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
4292 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ {
4293         CResult_ChannelTypeFeaturesDecodeErrorZ {
4294                 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr {
4295                         err: Box::into_raw(Box::new(e)),
4296                 },
4297                 result_ok: false,
4298         }
4299 }
4300 /// Checks if the given object is currently in the success state
4301 #[no_mangle]
4302 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool {
4303         o.result_ok
4304 }
4305 #[no_mangle]
4306 /// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
4307 pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { }
4308 impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ {
4309         fn drop(&mut self) {
4310                 if self.result_ok {
4311                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4312                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4313                         }
4314                 } else {
4315                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4316                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4317                         }
4318                 }
4319         }
4320 }
4321 impl From<crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelTypeFeaturesDecodeErrorZ {
4322         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::features::ChannelTypeFeatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
4323                 let contents = if o.result_ok {
4324                         let result = unsafe { o.contents.result };
4325                         unsafe { o.contents.result = core::ptr::null_mut() };
4326                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { result }
4327                 } else {
4328                         let err = unsafe { o.contents.err };
4329                         unsafe { o.contents.err = core::ptr::null_mut(); }
4330                         CResult_ChannelTypeFeaturesDecodeErrorZPtr { err }
4331                 };
4332                 Self {
4333                         contents,
4334                         result_ok: o.result_ok,
4335                 }
4336         }
4337 }
4338 #[repr(C)]
4339 /// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4340 pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4341         /// A pointer to the contents in the success state.
4342         /// Reading from this pointer when `result_ok` is not set is undefined.
4343         pub result: *mut crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor,
4344         /// A pointer to the contents in the error state.
4345         /// Reading from this pointer when `result_ok` is set is undefined.
4346         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4347 }
4348 #[repr(C)]
4349 /// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4350 /// containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4351 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4352 pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4353         /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4354         /// `err` or `result` depending on the state of `result_ok`.
4355         pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr,
4356         /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4357         pub result_ok: bool,
4358 }
4359 #[no_mangle]
4360 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
4361 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4362         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4363                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4364                         result: Box::into_raw(Box::new(o)),
4365                 },
4366                 result_ok: true,
4367         }
4368 }
4369 #[no_mangle]
4370 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
4371 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4372         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4373                 contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4374                         err: Box::into_raw(Box::new(e)),
4375                 },
4376                 result_ok: false,
4377         }
4378 }
4379 /// Checks if the given object is currently in the success state
4380 #[no_mangle]
4381 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool {
4382         o.result_ok
4383 }
4384 #[no_mangle]
4385 /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
4386 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { }
4387 impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4388         fn drop(&mut self) {
4389                 if self.result_ok {
4390                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4391                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4392                         }
4393                 } else {
4394                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4395                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4396                         }
4397                 }
4398         }
4399 }
4400 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4401         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4402                 let contents = if o.result_ok {
4403                         let result = unsafe { o.contents.result };
4404                         unsafe { o.contents.result = core::ptr::null_mut() };
4405                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result }
4406                 } else {
4407                         let err = unsafe { o.contents.err };
4408                         unsafe { o.contents.err = core::ptr::null_mut(); }
4409                         CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err }
4410                 };
4411                 Self {
4412                         contents,
4413                         result_ok: o.result_ok,
4414                 }
4415         }
4416 }
4417 impl Clone for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4418         fn clone(&self) -> Self {
4419                 if self.result_ok {
4420                         Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4421                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4422                         } }
4423                 } else {
4424                         Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4425                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4426                         } }
4427                 }
4428         }
4429 }
4430 #[no_mangle]
4431 /// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4432 /// but with all dynamically-allocated buffers duplicated in new buffers.
4433 pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4434 #[repr(C)]
4435 /// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4436 pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4437         /// A pointer to the contents in the success state.
4438         /// Reading from this pointer when `result_ok` is not set is undefined.
4439         pub result: *mut crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor,
4440         /// A pointer to the contents in the error state.
4441         /// Reading from this pointer when `result_ok` is set is undefined.
4442         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4443 }
4444 #[repr(C)]
4445 /// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4446 /// containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4447 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4448 pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4449         /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4450         /// `err` or `result` depending on the state of `result_ok`.
4451         pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr,
4452         /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4453         pub result_ok: bool,
4454 }
4455 #[no_mangle]
4456 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
4457 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4458         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4459                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4460                         result: Box::into_raw(Box::new(o)),
4461                 },
4462                 result_ok: true,
4463         }
4464 }
4465 #[no_mangle]
4466 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
4467 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4468         CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4469                 contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4470                         err: Box::into_raw(Box::new(e)),
4471                 },
4472                 result_ok: false,
4473         }
4474 }
4475 /// Checks if the given object is currently in the success state
4476 #[no_mangle]
4477 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool {
4478         o.result_ok
4479 }
4480 #[no_mangle]
4481 /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
4482 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { }
4483 impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4484         fn drop(&mut self) {
4485                 if self.result_ok {
4486                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4487                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4488                         }
4489                 } else {
4490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4492                         }
4493                 }
4494         }
4495 }
4496 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4497         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4498                 let contents = if o.result_ok {
4499                         let result = unsafe { o.contents.result };
4500                         unsafe { o.contents.result = core::ptr::null_mut() };
4501                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result }
4502                 } else {
4503                         let err = unsafe { o.contents.err };
4504                         unsafe { o.contents.err = core::ptr::null_mut(); }
4505                         CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err }
4506                 };
4507                 Self {
4508                         contents,
4509                         result_ok: o.result_ok,
4510                 }
4511         }
4512 }
4513 impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4514         fn clone(&self) -> Self {
4515                 if self.result_ok {
4516                         Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4517                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4518                         } }
4519                 } else {
4520                         Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4521                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4522                         } }
4523                 }
4524         }
4525 }
4526 #[no_mangle]
4527 /// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
4528 /// but with all dynamically-allocated buffers duplicated in new buffers.
4529 pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4530 #[repr(C)]
4531 /// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4532 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4533         /// A pointer to the contents in the success state.
4534         /// Reading from this pointer when `result_ok` is not set is undefined.
4535         pub result: *mut crate::lightning::chain::keysinterface::SpendableOutputDescriptor,
4536         /// A pointer to the contents in the error state.
4537         /// Reading from this pointer when `result_ok` is set is undefined.
4538         pub err: *mut crate::lightning::ln::msgs::DecodeError,
4539 }
4540 #[repr(C)]
4541 /// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4542 /// containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4543 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4544 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
4545         /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4546         /// `err` or `result` depending on the state of `result_ok`.
4547         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
4548         /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4549         pub result_ok: bool,
4550 }
4551 #[no_mangle]
4552 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
4553 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4554         CResult_SpendableOutputDescriptorDecodeErrorZ {
4555                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4556                         result: Box::into_raw(Box::new(o)),
4557                 },
4558                 result_ok: true,
4559         }
4560 }
4561 #[no_mangle]
4562 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
4563 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
4564         CResult_SpendableOutputDescriptorDecodeErrorZ {
4565                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4566                         err: Box::into_raw(Box::new(e)),
4567                 },
4568                 result_ok: false,
4569         }
4570 }
4571 /// Checks if the given object is currently in the success state
4572 #[no_mangle]
4573 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool {
4574         o.result_ok
4575 }
4576 #[no_mangle]
4577 /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
4578 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
4579 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
4580         fn drop(&mut self) {
4581                 if self.result_ok {
4582                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4583                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4584                         }
4585                 } else {
4586                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4587                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4588                         }
4589                 }
4590         }
4591 }
4592 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
4593         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::SpendableOutputDescriptor, crate::lightning::ln::msgs::DecodeError>) -> Self {
4594                 let contents = if o.result_ok {
4595                         let result = unsafe { o.contents.result };
4596                         unsafe { o.contents.result = core::ptr::null_mut() };
4597                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
4598                 } else {
4599                         let err = unsafe { o.contents.err };
4600                         unsafe { o.contents.err = core::ptr::null_mut(); }
4601                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
4602                 };
4603                 Self {
4604                         contents,
4605                         result_ok: o.result_ok,
4606                 }
4607         }
4608 }
4609 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
4610         fn clone(&self) -> Self {
4611                 if self.result_ok {
4612                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4613                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
4614                         } }
4615                 } else {
4616                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
4617                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4618                         } }
4619                 }
4620         }
4621 }
4622 #[no_mangle]
4623 /// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
4624 /// but with all dynamically-allocated buffers duplicated in new buffers.
4625 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) }
4626 #[repr(C)]
4627 /// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4628 /// This corresponds to std::vector in C++
4629 pub struct CVec_PaymentPreimageZ {
4630         /// The elements in the array.
4631         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4632         pub data: *mut crate::c_types::ThirtyTwoBytes,
4633         /// The number of elements pointed to by `data`.
4634         pub datalen: usize
4635 }
4636 impl CVec_PaymentPreimageZ {
4637         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::ThirtyTwoBytes> {
4638                 if self.datalen == 0 { return Vec::new(); }
4639                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4640                 self.data = core::ptr::null_mut();
4641                 self.datalen = 0;
4642                 ret
4643         }
4644         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] {
4645                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
4646         }
4647 }
4648 impl From<Vec<crate::c_types::ThirtyTwoBytes>> for CVec_PaymentPreimageZ {
4649         fn from(v: Vec<crate::c_types::ThirtyTwoBytes>) -> Self {
4650                 let datalen = v.len();
4651                 let data = Box::into_raw(v.into_boxed_slice());
4652                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4653         }
4654 }
4655 #[no_mangle]
4656 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
4657 pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { }
4658 impl Drop for CVec_PaymentPreimageZ {
4659         fn drop(&mut self) {
4660                 if self.datalen == 0 { return; }
4661                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
4662         }
4663 }
4664 impl Clone for CVec_PaymentPreimageZ {
4665         fn clone(&self) -> Self {
4666                 let mut res = Vec::new();
4667                 if self.datalen == 0 { return Self::from(res); }
4668                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
4669                 Self::from(res)
4670         }
4671 }
4672 #[repr(C)]
4673 /// A tuple of 2 elements. See the individual fields for the types contained.
4674 pub struct C2Tuple_SignatureCVec_SignatureZZ {
4675         /// The element at position 0
4676         pub a: crate::c_types::Signature,
4677         /// The element at position 1
4678         pub b: crate::c_types::derived::CVec_SignatureZ,
4679 }
4680 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
4681         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
4682                 Self {
4683                         a: tup.0,
4684                         b: tup.1,
4685                 }
4686         }
4687 }
4688 impl C2Tuple_SignatureCVec_SignatureZZ {
4689         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
4690                 (self.a, self.b)
4691         }
4692 }
4693 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
4694         fn clone(&self) -> Self {
4695                 Self {
4696                         a: Clone::clone(&self.a),
4697                         b: Clone::clone(&self.b),
4698                 }
4699         }
4700 }
4701 #[no_mangle]
4702 /// Creates a new tuple which has the same data as `orig`
4703 /// but with all dynamically-allocated buffers duplicated in new buffers.
4704 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { Clone::clone(&orig) }
4705 /// Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
4706 #[no_mangle]
4707 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
4708         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
4709 }
4710
4711 #[no_mangle]
4712 /// Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
4713 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
4714 #[repr(C)]
4715 /// The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4716 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4717         /// A pointer to the contents in the success state.
4718         /// Reading from this pointer when `result_ok` is not set is undefined.
4719         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
4720         /// Note that this value is always NULL, as there are no contents in the Err variant
4721         pub err: *mut core::ffi::c_void,
4722 }
4723 #[repr(C)]
4724 /// A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4725 /// containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4726 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4727 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4728         /// The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4729         /// `err` or `result` depending on the state of `result_ok`.
4730         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
4731         /// Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4732         pub result_ok: bool,
4733 }
4734 #[no_mangle]
4735 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
4736 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4737         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4738                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4739                         result: Box::into_raw(Box::new(o)),
4740                 },
4741                 result_ok: true,
4742         }
4743 }
4744 #[no_mangle]
4745 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
4746 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4747         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4748                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4749                         err: core::ptr::null_mut(),
4750                 },
4751                 result_ok: false,
4752         }
4753 }
4754 /// Checks if the given object is currently in the success state
4755 #[no_mangle]
4756 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool {
4757         o.result_ok
4758 }
4759 #[no_mangle]
4760 /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
4761 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
4762 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4763         fn drop(&mut self) {
4764                 if self.result_ok {
4765                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4766                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4767                         }
4768                 } else {
4769                 }
4770         }
4771 }
4772 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4773         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, ()>) -> Self {
4774                 let contents = if o.result_ok {
4775                         let result = unsafe { o.contents.result };
4776                         unsafe { o.contents.result = core::ptr::null_mut() };
4777                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
4778                 } else {
4779                         let _ = unsafe { Box::from_raw(o.contents.err) };
4780                         o.contents.err = core::ptr::null_mut();
4781                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: core::ptr::null_mut() }
4782                 };
4783                 Self {
4784                         contents,
4785                         result_ok: o.result_ok,
4786                 }
4787         }
4788 }
4789 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4790         fn clone(&self) -> Self {
4791                 if self.result_ok {
4792                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4793                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4794                         } }
4795                 } else {
4796                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4797                                 err: core::ptr::null_mut()
4798                         } }
4799                 }
4800         }
4801 }
4802 #[no_mangle]
4803 /// Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
4804 /// but with all dynamically-allocated buffers duplicated in new buffers.
4805 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { Clone::clone(&orig) }
4806 #[repr(C)]
4807 /// The contents of CResult_SignatureNoneZ
4808 pub union CResult_SignatureNoneZPtr {
4809         /// A pointer to the contents in the success state.
4810         /// Reading from this pointer when `result_ok` is not set is undefined.
4811         pub result: *mut crate::c_types::Signature,
4812         /// Note that this value is always NULL, as there are no contents in the Err variant
4813         pub err: *mut core::ffi::c_void,
4814 }
4815 #[repr(C)]
4816 /// A CResult_SignatureNoneZ represents the result of a fallible operation,
4817 /// containing a crate::c_types::Signature on success and a () on failure.
4818 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4819 pub struct CResult_SignatureNoneZ {
4820         /// The contents of this CResult_SignatureNoneZ, accessible via either
4821         /// `err` or `result` depending on the state of `result_ok`.
4822         pub contents: CResult_SignatureNoneZPtr,
4823         /// Whether this CResult_SignatureNoneZ represents a success state.
4824         pub result_ok: bool,
4825 }
4826 #[no_mangle]
4827 /// Creates a new CResult_SignatureNoneZ in the success state.
4828 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4829         CResult_SignatureNoneZ {
4830                 contents: CResult_SignatureNoneZPtr {
4831                         result: Box::into_raw(Box::new(o)),
4832                 },
4833                 result_ok: true,
4834         }
4835 }
4836 #[no_mangle]
4837 /// Creates a new CResult_SignatureNoneZ in the error state.
4838 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4839         CResult_SignatureNoneZ {
4840                 contents: CResult_SignatureNoneZPtr {
4841                         err: core::ptr::null_mut(),
4842                 },
4843                 result_ok: false,
4844         }
4845 }
4846 /// Checks if the given object is currently in the success state
4847 #[no_mangle]
4848 pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool {
4849         o.result_ok
4850 }
4851 #[no_mangle]
4852 /// Frees any resources used by the CResult_SignatureNoneZ.
4853 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4854 impl Drop for CResult_SignatureNoneZ {
4855         fn drop(&mut self) {
4856                 if self.result_ok {
4857                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4858                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4859                         }
4860                 } else {
4861                 }
4862         }
4863 }
4864 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, ()>> for CResult_SignatureNoneZ {
4865         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, ()>) -> Self {
4866                 let contents = if o.result_ok {
4867                         let result = unsafe { o.contents.result };
4868                         unsafe { o.contents.result = core::ptr::null_mut() };
4869                         CResult_SignatureNoneZPtr { result }
4870                 } else {
4871                         let _ = unsafe { Box::from_raw(o.contents.err) };
4872                         o.contents.err = core::ptr::null_mut();
4873                         CResult_SignatureNoneZPtr { err: core::ptr::null_mut() }
4874                 };
4875                 Self {
4876                         contents,
4877                         result_ok: o.result_ok,
4878                 }
4879         }
4880 }
4881 impl Clone for CResult_SignatureNoneZ {
4882         fn clone(&self) -> Self {
4883                 if self.result_ok {
4884                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4885                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4886                         } }
4887                 } else {
4888                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4889                                 err: core::ptr::null_mut()
4890                         } }
4891                 }
4892         }
4893 }
4894 #[no_mangle]
4895 /// Creates a new CResult_SignatureNoneZ which has the same data as `orig`
4896 /// but with all dynamically-allocated buffers duplicated in new buffers.
4897 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { Clone::clone(&orig) }
4898 #[repr(C)]
4899 /// A tuple of 2 elements. See the individual fields for the types contained.
4900 pub struct C2Tuple_SignatureSignatureZ {
4901         /// The element at position 0
4902         pub a: crate::c_types::Signature,
4903         /// The element at position 1
4904         pub b: crate::c_types::Signature,
4905 }
4906 impl From<(crate::c_types::Signature, crate::c_types::Signature)> for C2Tuple_SignatureSignatureZ {
4907         fn from (tup: (crate::c_types::Signature, crate::c_types::Signature)) -> Self {
4908                 Self {
4909                         a: tup.0,
4910                         b: tup.1,
4911                 }
4912         }
4913 }
4914 impl C2Tuple_SignatureSignatureZ {
4915         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::Signature) {
4916                 (self.a, self.b)
4917         }
4918 }
4919 impl Clone for C2Tuple_SignatureSignatureZ {
4920         fn clone(&self) -> Self {
4921                 Self {
4922                         a: Clone::clone(&self.a),
4923                         b: Clone::clone(&self.b),
4924                 }
4925         }
4926 }
4927 #[no_mangle]
4928 /// Creates a new tuple which has the same data as `orig`
4929 /// but with all dynamically-allocated buffers duplicated in new buffers.
4930 pub extern "C" fn C2Tuple_SignatureSignatureZ_clone(orig: &C2Tuple_SignatureSignatureZ) -> C2Tuple_SignatureSignatureZ { Clone::clone(&orig) }
4931 /// Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
4932 #[no_mangle]
4933 pub extern "C" fn C2Tuple_SignatureSignatureZ_new(a: crate::c_types::Signature, b: crate::c_types::Signature) -> C2Tuple_SignatureSignatureZ {
4934         C2Tuple_SignatureSignatureZ { a, b, }
4935 }
4936
4937 #[no_mangle]
4938 /// Frees any resources used by the C2Tuple_SignatureSignatureZ.
4939 pub extern "C" fn C2Tuple_SignatureSignatureZ_free(_res: C2Tuple_SignatureSignatureZ) { }
4940 #[repr(C)]
4941 /// The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4942 pub union CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4943         /// A pointer to the contents in the success state.
4944         /// Reading from this pointer when `result_ok` is not set is undefined.
4945         pub result: *mut crate::c_types::derived::C2Tuple_SignatureSignatureZ,
4946         /// Note that this value is always NULL, as there are no contents in the Err variant
4947         pub err: *mut core::ffi::c_void,
4948 }
4949 #[repr(C)]
4950 /// A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4951 /// containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4952 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
4953 pub struct CResult_C2Tuple_SignatureSignatureZNoneZ {
4954         /// The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4955         /// `err` or `result` depending on the state of `result_ok`.
4956         pub contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr,
4957         /// Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4958         pub result_ok: bool,
4959 }
4960 #[no_mangle]
4961 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
4962 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureSignatureZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4963         CResult_C2Tuple_SignatureSignatureZNoneZ {
4964                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4965                         result: Box::into_raw(Box::new(o)),
4966                 },
4967                 result_ok: true,
4968         }
4969 }
4970 #[no_mangle]
4971 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
4972 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_err() -> CResult_C2Tuple_SignatureSignatureZNoneZ {
4973         CResult_C2Tuple_SignatureSignatureZNoneZ {
4974                 contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
4975                         err: core::ptr::null_mut(),
4976                 },
4977                 result_ok: false,
4978         }
4979 }
4980 /// Checks if the given object is currently in the success state
4981 #[no_mangle]
4982 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> bool {
4983         o.result_ok
4984 }
4985 #[no_mangle]
4986 /// Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
4987 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res: CResult_C2Tuple_SignatureSignatureZNoneZ) { }
4988 impl Drop for CResult_C2Tuple_SignatureSignatureZNoneZ {
4989         fn drop(&mut self) {
4990                 if self.result_ok {
4991                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4992                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4993                         }
4994                 } else {
4995                 }
4996         }
4997 }
4998 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>> for CResult_C2Tuple_SignatureSignatureZNoneZ {
4999         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureSignatureZ, ()>) -> Self {
5000                 let contents = if o.result_ok {
5001                         let result = unsafe { o.contents.result };
5002                         unsafe { o.contents.result = core::ptr::null_mut() };
5003                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { result }
5004                 } else {
5005                         let _ = unsafe { Box::from_raw(o.contents.err) };
5006                         o.contents.err = core::ptr::null_mut();
5007                         CResult_C2Tuple_SignatureSignatureZNoneZPtr { err: core::ptr::null_mut() }
5008                 };
5009                 Self {
5010                         contents,
5011                         result_ok: o.result_ok,
5012                 }
5013         }
5014 }
5015 impl Clone for CResult_C2Tuple_SignatureSignatureZNoneZ {
5016         fn clone(&self) -> Self {
5017                 if self.result_ok {
5018                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5019                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureSignatureZ>::clone(unsafe { &*self.contents.result })))
5020                         } }
5021                 } else {
5022                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureSignatureZNoneZPtr {
5023                                 err: core::ptr::null_mut()
5024                         } }
5025                 }
5026         }
5027 }
5028 #[no_mangle]
5029 /// Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
5030 /// but with all dynamically-allocated buffers duplicated in new buffers.
5031 pub extern "C" fn CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig: &CResult_C2Tuple_SignatureSignatureZNoneZ) -> CResult_C2Tuple_SignatureSignatureZNoneZ { Clone::clone(&orig) }
5032 #[repr(C)]
5033 /// The contents of CResult_SecretKeyNoneZ
5034 pub union CResult_SecretKeyNoneZPtr {
5035         /// A pointer to the contents in the success state.
5036         /// Reading from this pointer when `result_ok` is not set is undefined.
5037         pub result: *mut crate::c_types::SecretKey,
5038         /// Note that this value is always NULL, as there are no contents in the Err variant
5039         pub err: *mut core::ffi::c_void,
5040 }
5041 #[repr(C)]
5042 /// A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5043 /// containing a crate::c_types::SecretKey on success and a () on failure.
5044 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5045 pub struct CResult_SecretKeyNoneZ {
5046         /// The contents of this CResult_SecretKeyNoneZ, accessible via either
5047         /// `err` or `result` depending on the state of `result_ok`.
5048         pub contents: CResult_SecretKeyNoneZPtr,
5049         /// Whether this CResult_SecretKeyNoneZ represents a success state.
5050         pub result_ok: bool,
5051 }
5052 #[no_mangle]
5053 /// Creates a new CResult_SecretKeyNoneZ in the success state.
5054 pub extern "C" fn CResult_SecretKeyNoneZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyNoneZ {
5055         CResult_SecretKeyNoneZ {
5056                 contents: CResult_SecretKeyNoneZPtr {
5057                         result: Box::into_raw(Box::new(o)),
5058                 },
5059                 result_ok: true,
5060         }
5061 }
5062 #[no_mangle]
5063 /// Creates a new CResult_SecretKeyNoneZ in the error state.
5064 pub extern "C" fn CResult_SecretKeyNoneZ_err() -> CResult_SecretKeyNoneZ {
5065         CResult_SecretKeyNoneZ {
5066                 contents: CResult_SecretKeyNoneZPtr {
5067                         err: core::ptr::null_mut(),
5068                 },
5069                 result_ok: false,
5070         }
5071 }
5072 /// Checks if the given object is currently in the success state
5073 #[no_mangle]
5074 pub extern "C" fn CResult_SecretKeyNoneZ_is_ok(o: &CResult_SecretKeyNoneZ) -> bool {
5075         o.result_ok
5076 }
5077 #[no_mangle]
5078 /// Frees any resources used by the CResult_SecretKeyNoneZ.
5079 pub extern "C" fn CResult_SecretKeyNoneZ_free(_res: CResult_SecretKeyNoneZ) { }
5080 impl Drop for CResult_SecretKeyNoneZ {
5081         fn drop(&mut self) {
5082                 if self.result_ok {
5083                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5084                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5085                         }
5086                 } else {
5087                 }
5088         }
5089 }
5090 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>> for CResult_SecretKeyNoneZ {
5091         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, ()>) -> Self {
5092                 let contents = if o.result_ok {
5093                         let result = unsafe { o.contents.result };
5094                         unsafe { o.contents.result = core::ptr::null_mut() };
5095                         CResult_SecretKeyNoneZPtr { result }
5096                 } else {
5097                         let _ = unsafe { Box::from_raw(o.contents.err) };
5098                         o.contents.err = core::ptr::null_mut();
5099                         CResult_SecretKeyNoneZPtr { err: core::ptr::null_mut() }
5100                 };
5101                 Self {
5102                         contents,
5103                         result_ok: o.result_ok,
5104                 }
5105         }
5106 }
5107 #[repr(C)]
5108 /// The contents of CResult_SignDecodeErrorZ
5109 pub union CResult_SignDecodeErrorZPtr {
5110         /// A pointer to the contents in the success state.
5111         /// Reading from this pointer when `result_ok` is not set is undefined.
5112         pub result: *mut crate::lightning::chain::keysinterface::Sign,
5113         /// A pointer to the contents in the error state.
5114         /// Reading from this pointer when `result_ok` is set is undefined.
5115         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5116 }
5117 #[repr(C)]
5118 /// A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5119 /// containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5120 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121 pub struct CResult_SignDecodeErrorZ {
5122         /// The contents of this CResult_SignDecodeErrorZ, accessible via either
5123         /// `err` or `result` depending on the state of `result_ok`.
5124         pub contents: CResult_SignDecodeErrorZPtr,
5125         /// Whether this CResult_SignDecodeErrorZ represents a success state.
5126         pub result_ok: bool,
5127 }
5128 #[no_mangle]
5129 /// Creates a new CResult_SignDecodeErrorZ in the success state.
5130 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
5131         CResult_SignDecodeErrorZ {
5132                 contents: CResult_SignDecodeErrorZPtr {
5133                         result: Box::into_raw(Box::new(o)),
5134                 },
5135                 result_ok: true,
5136         }
5137 }
5138 #[no_mangle]
5139 /// Creates a new CResult_SignDecodeErrorZ in the error state.
5140 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
5141         CResult_SignDecodeErrorZ {
5142                 contents: CResult_SignDecodeErrorZPtr {
5143                         err: Box::into_raw(Box::new(e)),
5144                 },
5145                 result_ok: false,
5146         }
5147 }
5148 /// Checks if the given object is currently in the success state
5149 #[no_mangle]
5150 pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool {
5151         o.result_ok
5152 }
5153 #[no_mangle]
5154 /// Frees any resources used by the CResult_SignDecodeErrorZ.
5155 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
5156 impl Drop for CResult_SignDecodeErrorZ {
5157         fn drop(&mut self) {
5158                 if self.result_ok {
5159                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5160                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5161                         }
5162                 } else {
5163                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5164                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5165                         }
5166                 }
5167         }
5168 }
5169 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
5170         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::Sign, crate::lightning::ln::msgs::DecodeError>) -> Self {
5171                 let contents = if o.result_ok {
5172                         let result = unsafe { o.contents.result };
5173                         unsafe { o.contents.result = core::ptr::null_mut() };
5174                         CResult_SignDecodeErrorZPtr { result }
5175                 } else {
5176                         let err = unsafe { o.contents.err };
5177                         unsafe { o.contents.err = core::ptr::null_mut(); }
5178                         CResult_SignDecodeErrorZPtr { err }
5179                 };
5180                 Self {
5181                         contents,
5182                         result_ok: o.result_ok,
5183                 }
5184         }
5185 }
5186 impl Clone for CResult_SignDecodeErrorZ {
5187         fn clone(&self) -> Self {
5188                 if self.result_ok {
5189                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
5190                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
5191                         } }
5192                 } else {
5193                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
5194                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5195                         } }
5196                 }
5197         }
5198 }
5199 #[no_mangle]
5200 /// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
5201 /// but with all dynamically-allocated buffers duplicated in new buffers.
5202 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) }
5203 #[repr(C)]
5204 /// A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5205 /// This corresponds to std::vector in C++
5206 pub struct CVec_u5Z {
5207         /// The elements in the array.
5208         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5209         pub data: *mut crate::c_types::u5,
5210         /// The number of elements pointed to by `data`.
5211         pub datalen: usize
5212 }
5213 impl CVec_u5Z {
5214         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::u5> {
5215                 if self.datalen == 0 { return Vec::new(); }
5216                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5217                 self.data = core::ptr::null_mut();
5218                 self.datalen = 0;
5219                 ret
5220         }
5221         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] {
5222                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5223         }
5224 }
5225 impl From<Vec<crate::c_types::u5>> for CVec_u5Z {
5226         fn from(v: Vec<crate::c_types::u5>) -> Self {
5227                 let datalen = v.len();
5228                 let data = Box::into_raw(v.into_boxed_slice());
5229                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5230         }
5231 }
5232 #[no_mangle]
5233 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5234 pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { }
5235 impl Drop for CVec_u5Z {
5236         fn drop(&mut self) {
5237                 if self.datalen == 0 { return; }
5238                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5239         }
5240 }
5241 impl Clone for CVec_u5Z {
5242         fn clone(&self) -> Self {
5243                 let mut res = Vec::new();
5244                 if self.datalen == 0 { return Self::from(res); }
5245                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5246                 Self::from(res)
5247         }
5248 }
5249 #[repr(C)]
5250 /// The contents of CResult_RecoverableSignatureNoneZ
5251 pub union CResult_RecoverableSignatureNoneZPtr {
5252         /// A pointer to the contents in the success state.
5253         /// Reading from this pointer when `result_ok` is not set is undefined.
5254         pub result: *mut crate::c_types::RecoverableSignature,
5255         /// Note that this value is always NULL, as there are no contents in the Err variant
5256         pub err: *mut core::ffi::c_void,
5257 }
5258 #[repr(C)]
5259 /// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5260 /// containing a crate::c_types::RecoverableSignature on success and a () on failure.
5261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5262 pub struct CResult_RecoverableSignatureNoneZ {
5263         /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5264         /// `err` or `result` depending on the state of `result_ok`.
5265         pub contents: CResult_RecoverableSignatureNoneZPtr,
5266         /// Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5267         pub result_ok: bool,
5268 }
5269 #[no_mangle]
5270 /// Creates a new CResult_RecoverableSignatureNoneZ in the success state.
5271 pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ {
5272         CResult_RecoverableSignatureNoneZ {
5273                 contents: CResult_RecoverableSignatureNoneZPtr {
5274                         result: Box::into_raw(Box::new(o)),
5275                 },
5276                 result_ok: true,
5277         }
5278 }
5279 #[no_mangle]
5280 /// Creates a new CResult_RecoverableSignatureNoneZ in the error state.
5281 pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ {
5282         CResult_RecoverableSignatureNoneZ {
5283                 contents: CResult_RecoverableSignatureNoneZPtr {
5284                         err: core::ptr::null_mut(),
5285                 },
5286                 result_ok: false,
5287         }
5288 }
5289 /// Checks if the given object is currently in the success state
5290 #[no_mangle]
5291 pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool {
5292         o.result_ok
5293 }
5294 #[no_mangle]
5295 /// Frees any resources used by the CResult_RecoverableSignatureNoneZ.
5296 pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { }
5297 impl Drop for CResult_RecoverableSignatureNoneZ {
5298         fn drop(&mut self) {
5299                 if self.result_ok {
5300                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5301                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5302                         }
5303                 } else {
5304                 }
5305         }
5306 }
5307 impl From<crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>> for CResult_RecoverableSignatureNoneZ {
5308         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::RecoverableSignature, ()>) -> Self {
5309                 let contents = if o.result_ok {
5310                         let result = unsafe { o.contents.result };
5311                         unsafe { o.contents.result = core::ptr::null_mut() };
5312                         CResult_RecoverableSignatureNoneZPtr { result }
5313                 } else {
5314                         let _ = unsafe { Box::from_raw(o.contents.err) };
5315                         o.contents.err = core::ptr::null_mut();
5316                         CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() }
5317                 };
5318                 Self {
5319                         contents,
5320                         result_ok: o.result_ok,
5321                 }
5322         }
5323 }
5324 impl Clone for CResult_RecoverableSignatureNoneZ {
5325         fn clone(&self) -> Self {
5326                 if self.result_ok {
5327                         Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr {
5328                                 result: Box::into_raw(Box::new(<crate::c_types::RecoverableSignature>::clone(unsafe { &*self.contents.result })))
5329                         } }
5330                 } else {
5331                         Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr {
5332                                 err: core::ptr::null_mut()
5333                         } }
5334                 }
5335         }
5336 }
5337 #[no_mangle]
5338 /// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
5339 /// but with all dynamically-allocated buffers duplicated in new buffers.
5340 pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) }
5341 #[repr(C)]
5342 /// A dynamically-allocated array of u8s of arbitrary size.
5343 /// This corresponds to std::vector in C++
5344 pub struct CVec_u8Z {
5345         /// The elements in the array.
5346         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5347         pub data: *mut u8,
5348         /// The number of elements pointed to by `data`.
5349         pub datalen: usize
5350 }
5351 impl CVec_u8Z {
5352         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
5353                 if self.datalen == 0 { return Vec::new(); }
5354                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5355                 self.data = core::ptr::null_mut();
5356                 self.datalen = 0;
5357                 ret
5358         }
5359         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
5360                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5361         }
5362 }
5363 impl From<Vec<u8>> for CVec_u8Z {
5364         fn from(v: Vec<u8>) -> Self {
5365                 let datalen = v.len();
5366                 let data = Box::into_raw(v.into_boxed_slice());
5367                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5368         }
5369 }
5370 #[no_mangle]
5371 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5372 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
5373 impl Drop for CVec_u8Z {
5374         fn drop(&mut self) {
5375                 if self.datalen == 0 { return; }
5376                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5377         }
5378 }
5379 impl Clone for CVec_u8Z {
5380         fn clone(&self) -> Self {
5381                 let mut res = Vec::new();
5382                 if self.datalen == 0 { return Self::from(res); }
5383                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5384                 Self::from(res)
5385         }
5386 }
5387 #[repr(C)]
5388 /// A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5389 /// This corresponds to std::vector in C++
5390 pub struct CVec_CVec_u8ZZ {
5391         /// The elements in the array.
5392         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5393         pub data: *mut crate::c_types::derived::CVec_u8Z,
5394         /// The number of elements pointed to by `data`.
5395         pub datalen: usize
5396 }
5397 impl CVec_CVec_u8ZZ {
5398         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
5399                 if self.datalen == 0 { return Vec::new(); }
5400                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5401                 self.data = core::ptr::null_mut();
5402                 self.datalen = 0;
5403                 ret
5404         }
5405         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
5406                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5407         }
5408 }
5409 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
5410         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
5411                 let datalen = v.len();
5412                 let data = Box::into_raw(v.into_boxed_slice());
5413                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5414         }
5415 }
5416 #[no_mangle]
5417 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5418 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
5419 impl Drop for CVec_CVec_u8ZZ {
5420         fn drop(&mut self) {
5421                 if self.datalen == 0 { return; }
5422                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5423         }
5424 }
5425 impl Clone for CVec_CVec_u8ZZ {
5426         fn clone(&self) -> Self {
5427                 let mut res = Vec::new();
5428                 if self.datalen == 0 { return Self::from(res); }
5429                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5430                 Self::from(res)
5431         }
5432 }
5433 #[repr(C)]
5434 /// The contents of CResult_CVec_CVec_u8ZZNoneZ
5435 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
5436         /// A pointer to the contents in the success state.
5437         /// Reading from this pointer when `result_ok` is not set is undefined.
5438         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
5439         /// Note that this value is always NULL, as there are no contents in the Err variant
5440         pub err: *mut core::ffi::c_void,
5441 }
5442 #[repr(C)]
5443 /// A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5444 /// containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5445 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5446 pub struct CResult_CVec_CVec_u8ZZNoneZ {
5447         /// The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5448         /// `err` or `result` depending on the state of `result_ok`.
5449         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
5450         /// Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5451         pub result_ok: bool,
5452 }
5453 #[no_mangle]
5454 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
5455 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
5456         CResult_CVec_CVec_u8ZZNoneZ {
5457                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5458                         result: Box::into_raw(Box::new(o)),
5459                 },
5460                 result_ok: true,
5461         }
5462 }
5463 #[no_mangle]
5464 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
5465 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
5466         CResult_CVec_CVec_u8ZZNoneZ {
5467                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5468                         err: core::ptr::null_mut(),
5469                 },
5470                 result_ok: false,
5471         }
5472 }
5473 /// Checks if the given object is currently in the success state
5474 #[no_mangle]
5475 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool {
5476         o.result_ok
5477 }
5478 #[no_mangle]
5479 /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
5480 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
5481 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
5482         fn drop(&mut self) {
5483                 if self.result_ok {
5484                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5485                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5486                         }
5487                 } else {
5488                 }
5489         }
5490 }
5491 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>> for CResult_CVec_CVec_u8ZZNoneZ {
5492         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, ()>) -> Self {
5493                 let contents = if o.result_ok {
5494                         let result = unsafe { o.contents.result };
5495                         unsafe { o.contents.result = core::ptr::null_mut() };
5496                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
5497                 } else {
5498                         let _ = unsafe { Box::from_raw(o.contents.err) };
5499                         o.contents.err = core::ptr::null_mut();
5500                         CResult_CVec_CVec_u8ZZNoneZPtr { err: core::ptr::null_mut() }
5501                 };
5502                 Self {
5503                         contents,
5504                         result_ok: o.result_ok,
5505                 }
5506         }
5507 }
5508 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
5509         fn clone(&self) -> Self {
5510                 if self.result_ok {
5511                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5512                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
5513                         } }
5514                 } else {
5515                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
5516                                 err: core::ptr::null_mut()
5517                         } }
5518                 }
5519         }
5520 }
5521 #[no_mangle]
5522 /// Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
5523 /// but with all dynamically-allocated buffers duplicated in new buffers.
5524 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { Clone::clone(&orig) }
5525 #[repr(C)]
5526 /// The contents of CResult_InMemorySignerDecodeErrorZ
5527 pub union CResult_InMemorySignerDecodeErrorZPtr {
5528         /// A pointer to the contents in the success state.
5529         /// Reading from this pointer when `result_ok` is not set is undefined.
5530         pub result: *mut crate::lightning::chain::keysinterface::InMemorySigner,
5531         /// A pointer to the contents in the error state.
5532         /// Reading from this pointer when `result_ok` is set is undefined.
5533         pub err: *mut crate::lightning::ln::msgs::DecodeError,
5534 }
5535 #[repr(C)]
5536 /// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5537 /// containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5538 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5539 pub struct CResult_InMemorySignerDecodeErrorZ {
5540         /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5541         /// `err` or `result` depending on the state of `result_ok`.
5542         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
5543         /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5544         pub result_ok: bool,
5545 }
5546 #[no_mangle]
5547 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
5548 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
5549         CResult_InMemorySignerDecodeErrorZ {
5550                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5551                         result: Box::into_raw(Box::new(o)),
5552                 },
5553                 result_ok: true,
5554         }
5555 }
5556 #[no_mangle]
5557 /// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
5558 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
5559         CResult_InMemorySignerDecodeErrorZ {
5560                 contents: CResult_InMemorySignerDecodeErrorZPtr {
5561                         err: Box::into_raw(Box::new(e)),
5562                 },
5563                 result_ok: false,
5564         }
5565 }
5566 /// Checks if the given object is currently in the success state
5567 #[no_mangle]
5568 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool {
5569         o.result_ok
5570 }
5571 #[no_mangle]
5572 /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
5573 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
5574 impl Drop for CResult_InMemorySignerDecodeErrorZ {
5575         fn drop(&mut self) {
5576                 if self.result_ok {
5577                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5578                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5579                         }
5580                 } else {
5581                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5582                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5583                         }
5584                 }
5585         }
5586 }
5587 impl From<crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
5588         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::keysinterface::InMemorySigner, crate::lightning::ln::msgs::DecodeError>) -> Self {
5589                 let contents = if o.result_ok {
5590                         let result = unsafe { o.contents.result };
5591                         unsafe { o.contents.result = core::ptr::null_mut() };
5592                         CResult_InMemorySignerDecodeErrorZPtr { result }
5593                 } else {
5594                         let err = unsafe { o.contents.err };
5595                         unsafe { o.contents.err = core::ptr::null_mut(); }
5596                         CResult_InMemorySignerDecodeErrorZPtr { err }
5597                 };
5598                 Self {
5599                         contents,
5600                         result_ok: o.result_ok,
5601                 }
5602         }
5603 }
5604 impl Clone for CResult_InMemorySignerDecodeErrorZ {
5605         fn clone(&self) -> Self {
5606                 if self.result_ok {
5607                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
5608                                 result: Box::into_raw(Box::new(<crate::lightning::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
5609                         } }
5610                 } else {
5611                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
5612                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5613                         } }
5614                 }
5615         }
5616 }
5617 #[no_mangle]
5618 /// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
5619 /// but with all dynamically-allocated buffers duplicated in new buffers.
5620 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) }
5621 #[repr(C)]
5622 /// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5623 /// This corresponds to std::vector in C++
5624 pub struct CVec_TxOutZ {
5625         /// The elements in the array.
5626         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5627         pub data: *mut crate::c_types::TxOut,
5628         /// The number of elements pointed to by `data`.
5629         pub datalen: usize
5630 }
5631 impl CVec_TxOutZ {
5632         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
5633                 if self.datalen == 0 { return Vec::new(); }
5634                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5635                 self.data = core::ptr::null_mut();
5636                 self.datalen = 0;
5637                 ret
5638         }
5639         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
5640                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5641         }
5642 }
5643 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
5644         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
5645                 let datalen = v.len();
5646                 let data = Box::into_raw(v.into_boxed_slice());
5647                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5648         }
5649 }
5650 #[no_mangle]
5651 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5652 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
5653 impl Drop for CVec_TxOutZ {
5654         fn drop(&mut self) {
5655                 if self.datalen == 0 { return; }
5656                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5657         }
5658 }
5659 impl Clone for CVec_TxOutZ {
5660         fn clone(&self) -> Self {
5661                 let mut res = Vec::new();
5662                 if self.datalen == 0 { return Self::from(res); }
5663                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
5664                 Self::from(res)
5665         }
5666 }
5667 #[repr(C)]
5668 /// The contents of CResult_TransactionNoneZ
5669 pub union CResult_TransactionNoneZPtr {
5670         /// A pointer to the contents in the success state.
5671         /// Reading from this pointer when `result_ok` is not set is undefined.
5672         pub result: *mut crate::c_types::Transaction,
5673         /// Note that this value is always NULL, as there are no contents in the Err variant
5674         pub err: *mut core::ffi::c_void,
5675 }
5676 #[repr(C)]
5677 /// A CResult_TransactionNoneZ represents the result of a fallible operation,
5678 /// containing a crate::c_types::Transaction on success and a () on failure.
5679 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5680 pub struct CResult_TransactionNoneZ {
5681         /// The contents of this CResult_TransactionNoneZ, accessible via either
5682         /// `err` or `result` depending on the state of `result_ok`.
5683         pub contents: CResult_TransactionNoneZPtr,
5684         /// Whether this CResult_TransactionNoneZ represents a success state.
5685         pub result_ok: bool,
5686 }
5687 #[no_mangle]
5688 /// Creates a new CResult_TransactionNoneZ in the success state.
5689 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
5690         CResult_TransactionNoneZ {
5691                 contents: CResult_TransactionNoneZPtr {
5692                         result: Box::into_raw(Box::new(o)),
5693                 },
5694                 result_ok: true,
5695         }
5696 }
5697 #[no_mangle]
5698 /// Creates a new CResult_TransactionNoneZ in the error state.
5699 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
5700         CResult_TransactionNoneZ {
5701                 contents: CResult_TransactionNoneZPtr {
5702                         err: core::ptr::null_mut(),
5703                 },
5704                 result_ok: false,
5705         }
5706 }
5707 /// Checks if the given object is currently in the success state
5708 #[no_mangle]
5709 pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool {
5710         o.result_ok
5711 }
5712 #[no_mangle]
5713 /// Frees any resources used by the CResult_TransactionNoneZ.
5714 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
5715 impl Drop for CResult_TransactionNoneZ {
5716         fn drop(&mut self) {
5717                 if self.result_ok {
5718                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5719                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5720                         }
5721                 } else {
5722                 }
5723         }
5724 }
5725 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, ()>> for CResult_TransactionNoneZ {
5726         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, ()>) -> Self {
5727                 let contents = if o.result_ok {
5728                         let result = unsafe { o.contents.result };
5729                         unsafe { o.contents.result = core::ptr::null_mut() };
5730                         CResult_TransactionNoneZPtr { result }
5731                 } else {
5732                         let _ = unsafe { Box::from_raw(o.contents.err) };
5733                         o.contents.err = core::ptr::null_mut();
5734                         CResult_TransactionNoneZPtr { err: core::ptr::null_mut() }
5735                 };
5736                 Self {
5737                         contents,
5738                         result_ok: o.result_ok,
5739                 }
5740         }
5741 }
5742 impl Clone for CResult_TransactionNoneZ {
5743         fn clone(&self) -> Self {
5744                 if self.result_ok {
5745                         Self { result_ok: true, contents: CResult_TransactionNoneZPtr {
5746                                 result: Box::into_raw(Box::new(<crate::c_types::Transaction>::clone(unsafe { &*self.contents.result })))
5747                         } }
5748                 } else {
5749                         Self { result_ok: false, contents: CResult_TransactionNoneZPtr {
5750                                 err: core::ptr::null_mut()
5751                         } }
5752                 }
5753         }
5754 }
5755 #[no_mangle]
5756 /// Creates a new CResult_TransactionNoneZ which has the same data as `orig`
5757 /// but with all dynamically-allocated buffers duplicated in new buffers.
5758 pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) }
5759 #[repr(C)]
5760 /// A tuple of 2 elements. See the individual fields for the types contained.
5761 pub struct C2Tuple_BlockHashChannelMonitorZ {
5762         /// The element at position 0
5763         pub a: crate::c_types::ThirtyTwoBytes,
5764         /// The element at position 1
5765         pub b: crate::lightning::chain::channelmonitor::ChannelMonitor,
5766 }
5767 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
5768         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self {
5769                 Self {
5770                         a: tup.0,
5771                         b: tup.1,
5772                 }
5773         }
5774 }
5775 impl C2Tuple_BlockHashChannelMonitorZ {
5776         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) {
5777                 (self.a, self.b)
5778         }
5779 }
5780 /// Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
5781 #[no_mangle]
5782 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
5783         C2Tuple_BlockHashChannelMonitorZ { a, b, }
5784 }
5785
5786 #[no_mangle]
5787 /// Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
5788 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
5789 #[repr(C)]
5790 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5791 /// This corresponds to std::vector in C++
5792 pub struct CVec_C2Tuple_BlockHashChannelMonitorZZ {
5793         /// The elements in the array.
5794         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5795         pub data: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
5796         /// The number of elements pointed to by `data`.
5797         pub datalen: usize
5798 }
5799 impl CVec_C2Tuple_BlockHashChannelMonitorZZ {
5800         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ> {
5801                 if self.datalen == 0 { return Vec::new(); }
5802                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5803                 self.data = core::ptr::null_mut();
5804                 self.datalen = 0;
5805                 ret
5806         }
5807         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ] {
5808                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
5809         }
5810 }
5811 impl From<Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>> for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5812         fn from(v: Vec<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ>) -> Self {
5813                 let datalen = v.len();
5814                 let data = Box::into_raw(v.into_boxed_slice());
5815                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5816         }
5817 }
5818 #[no_mangle]
5819 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
5820 pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple_BlockHashChannelMonitorZZ) { }
5821 impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ {
5822         fn drop(&mut self) {
5823                 if self.datalen == 0 { return; }
5824                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
5825         }
5826 }
5827 #[repr(C)]
5828 /// The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5829 pub union CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5830         /// A pointer to the contents in the success state.
5831         /// Reading from this pointer when `result_ok` is not set is undefined.
5832         pub result: *mut crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ,
5833         /// A pointer to the contents in the error state.
5834         /// Reading from this pointer when `result_ok` is set is undefined.
5835         pub err: *mut crate::c_types::IOError,
5836 }
5837 #[repr(C)]
5838 /// A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5839 /// containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5840 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5841 pub struct CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5842         /// The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5843         /// `err` or `result` depending on the state of `result_ok`.
5844         pub contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr,
5845         /// Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5846         pub result_ok: bool,
5847 }
5848 #[no_mangle]
5849 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
5850 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5851         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5852                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5853                         result: Box::into_raw(Box::new(o)),
5854                 },
5855                 result_ok: true,
5856         }
5857 }
5858 #[no_mangle]
5859 /// Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
5860 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5861         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5862                 contents: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5863                         err: Box::into_raw(Box::new(e)),
5864                 },
5865                 result_ok: false,
5866         }
5867 }
5868 /// Checks if the given object is currently in the success state
5869 #[no_mangle]
5870 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool {
5871         o.result_ok
5872 }
5873 #[no_mangle]
5874 /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
5875 pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { }
5876 impl Drop for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5877         fn drop(&mut self) {
5878                 if self.result_ok {
5879                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5880                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5881                         }
5882                 } else {
5883                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5884                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5885                         }
5886                 }
5887         }
5888 }
5889 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>> for CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5890         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ, crate::c_types::IOError>) -> Self {
5891                 let contents = if o.result_ok {
5892                         let result = unsafe { o.contents.result };
5893                         unsafe { o.contents.result = core::ptr::null_mut() };
5894                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { result }
5895                 } else {
5896                         let err = unsafe { o.contents.err };
5897                         unsafe { o.contents.err = core::ptr::null_mut(); }
5898                         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { err }
5899                 };
5900                 Self {
5901                         contents,
5902                         result_ok: o.result_ok,
5903                 }
5904         }
5905 }
5906 #[repr(C)]
5907 #[derive(Clone)]
5908 /// An enum which can either contain a u16 or not
5909 pub enum COption_u16Z {
5910         /// When we're in this state, this COption_u16Z contains a u16
5911         Some(u16),
5912         /// When we're in this state, this COption_u16Z contains nothing
5913         None
5914 }
5915 impl COption_u16Z {
5916         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
5917                 if let Self::None = self { false } else { true }
5918         }
5919         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
5920                 !self.is_some()
5921         }
5922         #[allow(unused)] pub(crate) fn take(mut self) -> u16 {
5923                 if let Self::Some(v) = self { v } else { unreachable!() }
5924         }
5925 }
5926 #[no_mangle]
5927 /// Constructs a new COption_u16Z containing a u16
5928 pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z {
5929         COption_u16Z::Some(o)
5930 }
5931 #[no_mangle]
5932 /// Constructs a new COption_u16Z containing nothing
5933 pub extern "C" fn COption_u16Z_none() -> COption_u16Z {
5934         COption_u16Z::None
5935 }
5936 #[no_mangle]
5937 /// Frees any resources associated with the u16, if we are in the Some state
5938 pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { }
5939 #[no_mangle]
5940 /// Creates a new COption_u16Z which has the same data as `orig`
5941 /// but with all dynamically-allocated buffers duplicated in new buffers.
5942 pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) }
5943 #[repr(C)]
5944 /// The contents of CResult_NoneAPIErrorZ
5945 pub union CResult_NoneAPIErrorZPtr {
5946         /// Note that this value is always NULL, as there are no contents in the OK variant
5947         pub result: *mut core::ffi::c_void,
5948         /// A pointer to the contents in the error state.
5949         /// Reading from this pointer when `result_ok` is set is undefined.
5950         pub err: *mut crate::lightning::util::errors::APIError,
5951 }
5952 #[repr(C)]
5953 /// A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5954 /// containing a () on success and a crate::lightning::util::errors::APIError on failure.
5955 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
5956 pub struct CResult_NoneAPIErrorZ {
5957         /// The contents of this CResult_NoneAPIErrorZ, accessible via either
5958         /// `err` or `result` depending on the state of `result_ok`.
5959         pub contents: CResult_NoneAPIErrorZPtr,
5960         /// Whether this CResult_NoneAPIErrorZ represents a success state.
5961         pub result_ok: bool,
5962 }
5963 #[no_mangle]
5964 /// Creates a new CResult_NoneAPIErrorZ in the success state.
5965 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
5966         CResult_NoneAPIErrorZ {
5967                 contents: CResult_NoneAPIErrorZPtr {
5968                         result: core::ptr::null_mut(),
5969                 },
5970                 result_ok: true,
5971         }
5972 }
5973 #[no_mangle]
5974 /// Creates a new CResult_NoneAPIErrorZ in the error state.
5975 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ {
5976         CResult_NoneAPIErrorZ {
5977                 contents: CResult_NoneAPIErrorZPtr {
5978                         err: Box::into_raw(Box::new(e)),
5979                 },
5980                 result_ok: false,
5981         }
5982 }
5983 /// Checks if the given object is currently in the success state
5984 #[no_mangle]
5985 pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool {
5986         o.result_ok
5987 }
5988 #[no_mangle]
5989 /// Frees any resources used by the CResult_NoneAPIErrorZ.
5990 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
5991 impl Drop for CResult_NoneAPIErrorZ {
5992         fn drop(&mut self) {
5993                 if self.result_ok {
5994                 } else {
5995                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5996                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5997                         }
5998                 }
5999         }
6000 }
6001 impl From<crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>> for CResult_NoneAPIErrorZ {
6002         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self {
6003                 let contents = if o.result_ok {
6004                         let _ = unsafe { Box::from_raw(o.contents.result) };
6005                         o.contents.result = core::ptr::null_mut();
6006                         CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() }
6007                 } else {
6008                         let err = unsafe { o.contents.err };
6009                         unsafe { o.contents.err = core::ptr::null_mut(); }
6010                         CResult_NoneAPIErrorZPtr { err }
6011                 };
6012                 Self {
6013                         contents,
6014                         result_ok: o.result_ok,
6015                 }
6016         }
6017 }
6018 impl Clone for CResult_NoneAPIErrorZ {
6019         fn clone(&self) -> Self {
6020                 if self.result_ok {
6021                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
6022                                 result: core::ptr::null_mut()
6023                         } }
6024                 } else {
6025                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
6026                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6027                         } }
6028                 }
6029         }
6030 }
6031 #[no_mangle]
6032 /// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
6033 /// but with all dynamically-allocated buffers duplicated in new buffers.
6034 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) }
6035 #[repr(C)]
6036 /// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6037 /// This corresponds to std::vector in C++
6038 pub struct CVec_CResult_NoneAPIErrorZZ {
6039         /// The elements in the array.
6040         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6041         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
6042         /// The number of elements pointed to by `data`.
6043         pub datalen: usize
6044 }
6045 impl CVec_CResult_NoneAPIErrorZZ {
6046         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
6047                 if self.datalen == 0 { return Vec::new(); }
6048                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6049                 self.data = core::ptr::null_mut();
6050                 self.datalen = 0;
6051                 ret
6052         }
6053         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
6054                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6055         }
6056 }
6057 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
6058         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
6059                 let datalen = v.len();
6060                 let data = Box::into_raw(v.into_boxed_slice());
6061                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6062         }
6063 }
6064 #[no_mangle]
6065 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6066 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
6067 impl Drop for CVec_CResult_NoneAPIErrorZZ {
6068         fn drop(&mut self) {
6069                 if self.datalen == 0 { return; }
6070                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6071         }
6072 }
6073 impl Clone for CVec_CResult_NoneAPIErrorZZ {
6074         fn clone(&self) -> Self {
6075                 let mut res = Vec::new();
6076                 if self.datalen == 0 { return Self::from(res); }
6077                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6078                 Self::from(res)
6079         }
6080 }
6081 #[repr(C)]
6082 /// A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6083 /// This corresponds to std::vector in C++
6084 pub struct CVec_APIErrorZ {
6085         /// The elements in the array.
6086         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6087         pub data: *mut crate::lightning::util::errors::APIError,
6088         /// The number of elements pointed to by `data`.
6089         pub datalen: usize
6090 }
6091 impl CVec_APIErrorZ {
6092         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::errors::APIError> {
6093                 if self.datalen == 0 { return Vec::new(); }
6094                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6095                 self.data = core::ptr::null_mut();
6096                 self.datalen = 0;
6097                 ret
6098         }
6099         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::errors::APIError] {
6100                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6101         }
6102 }
6103 impl From<Vec<crate::lightning::util::errors::APIError>> for CVec_APIErrorZ {
6104         fn from(v: Vec<crate::lightning::util::errors::APIError>) -> Self {
6105                 let datalen = v.len();
6106                 let data = Box::into_raw(v.into_boxed_slice());
6107                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6108         }
6109 }
6110 #[no_mangle]
6111 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6112 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
6113 impl Drop for CVec_APIErrorZ {
6114         fn drop(&mut self) {
6115                 if self.datalen == 0 { return; }
6116                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6117         }
6118 }
6119 impl Clone for CVec_APIErrorZ {
6120         fn clone(&self) -> Self {
6121                 let mut res = Vec::new();
6122                 if self.datalen == 0 { return Self::from(res); }
6123                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6124                 Self::from(res)
6125         }
6126 }
6127 #[repr(C)]
6128 /// The contents of CResult__u832APIErrorZ
6129 pub union CResult__u832APIErrorZPtr {
6130         /// A pointer to the contents in the success state.
6131         /// Reading from this pointer when `result_ok` is not set is undefined.
6132         pub result: *mut crate::c_types::ThirtyTwoBytes,
6133         /// A pointer to the contents in the error state.
6134         /// Reading from this pointer when `result_ok` is set is undefined.
6135         pub err: *mut crate::lightning::util::errors::APIError,
6136 }
6137 #[repr(C)]
6138 /// A CResult__u832APIErrorZ represents the result of a fallible operation,
6139 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6140 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6141 pub struct CResult__u832APIErrorZ {
6142         /// The contents of this CResult__u832APIErrorZ, accessible via either
6143         /// `err` or `result` depending on the state of `result_ok`.
6144         pub contents: CResult__u832APIErrorZPtr,
6145         /// Whether this CResult__u832APIErrorZ represents a success state.
6146         pub result_ok: bool,
6147 }
6148 #[no_mangle]
6149 /// Creates a new CResult__u832APIErrorZ in the success state.
6150 pub extern "C" fn CResult__u832APIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832APIErrorZ {
6151         CResult__u832APIErrorZ {
6152                 contents: CResult__u832APIErrorZPtr {
6153                         result: Box::into_raw(Box::new(o)),
6154                 },
6155                 result_ok: true,
6156         }
6157 }
6158 #[no_mangle]
6159 /// Creates a new CResult__u832APIErrorZ in the error state.
6160 pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult__u832APIErrorZ {
6161         CResult__u832APIErrorZ {
6162                 contents: CResult__u832APIErrorZPtr {
6163                         err: Box::into_raw(Box::new(e)),
6164                 },
6165                 result_ok: false,
6166         }
6167 }
6168 /// Checks if the given object is currently in the success state
6169 #[no_mangle]
6170 pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool {
6171         o.result_ok
6172 }
6173 #[no_mangle]
6174 /// Frees any resources used by the CResult__u832APIErrorZ.
6175 pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { }
6176 impl Drop for CResult__u832APIErrorZ {
6177         fn drop(&mut self) {
6178                 if self.result_ok {
6179                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6180                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6181                         }
6182                 } else {
6183                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6184                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6185                         }
6186                 }
6187         }
6188 }
6189 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult__u832APIErrorZ {
6190         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6191                 let contents = if o.result_ok {
6192                         let result = unsafe { o.contents.result };
6193                         unsafe { o.contents.result = core::ptr::null_mut() };
6194                         CResult__u832APIErrorZPtr { result }
6195                 } else {
6196                         let err = unsafe { o.contents.err };
6197                         unsafe { o.contents.err = core::ptr::null_mut(); }
6198                         CResult__u832APIErrorZPtr { err }
6199                 };
6200                 Self {
6201                         contents,
6202                         result_ok: o.result_ok,
6203                 }
6204         }
6205 }
6206 impl Clone for CResult__u832APIErrorZ {
6207         fn clone(&self) -> Self {
6208                 if self.result_ok {
6209                         Self { result_ok: true, contents: CResult__u832APIErrorZPtr {
6210                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6211                         } }
6212                 } else {
6213                         Self { result_ok: false, contents: CResult__u832APIErrorZPtr {
6214                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6215                         } }
6216                 }
6217         }
6218 }
6219 #[no_mangle]
6220 /// Creates a new CResult__u832APIErrorZ which has the same data as `orig`
6221 /// but with all dynamically-allocated buffers duplicated in new buffers.
6222 pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) }
6223 #[repr(C)]
6224 /// The contents of CResult_PaymentIdPaymentSendFailureZ
6225 pub union CResult_PaymentIdPaymentSendFailureZPtr {
6226         /// A pointer to the contents in the success state.
6227         /// Reading from this pointer when `result_ok` is not set is undefined.
6228         pub result: *mut crate::c_types::ThirtyTwoBytes,
6229         /// A pointer to the contents in the error state.
6230         /// Reading from this pointer when `result_ok` is set is undefined.
6231         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6232 }
6233 #[repr(C)]
6234 /// A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6235 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6236 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6237 pub struct CResult_PaymentIdPaymentSendFailureZ {
6238         /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6239         /// `err` or `result` depending on the state of `result_ok`.
6240         pub contents: CResult_PaymentIdPaymentSendFailureZPtr,
6241         /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6242         pub result_ok: bool,
6243 }
6244 #[no_mangle]
6245 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
6246 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ {
6247         CResult_PaymentIdPaymentSendFailureZ {
6248                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6249                         result: Box::into_raw(Box::new(o)),
6250                 },
6251                 result_ok: true,
6252         }
6253 }
6254 #[no_mangle]
6255 /// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
6256 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ {
6257         CResult_PaymentIdPaymentSendFailureZ {
6258                 contents: CResult_PaymentIdPaymentSendFailureZPtr {
6259                         err: Box::into_raw(Box::new(e)),
6260                 },
6261                 result_ok: false,
6262         }
6263 }
6264 /// Checks if the given object is currently in the success state
6265 #[no_mangle]
6266 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool {
6267         o.result_ok
6268 }
6269 #[no_mangle]
6270 /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
6271 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { }
6272 impl Drop for CResult_PaymentIdPaymentSendFailureZ {
6273         fn drop(&mut self) {
6274                 if self.result_ok {
6275                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6276                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6277                         }
6278                 } else {
6279                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6280                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6281                         }
6282                 }
6283         }
6284 }
6285 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_PaymentIdPaymentSendFailureZ {
6286         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6287                 let contents = if o.result_ok {
6288                         let result = unsafe { o.contents.result };
6289                         unsafe { o.contents.result = core::ptr::null_mut() };
6290                         CResult_PaymentIdPaymentSendFailureZPtr { result }
6291                 } else {
6292                         let err = unsafe { o.contents.err };
6293                         unsafe { o.contents.err = core::ptr::null_mut(); }
6294                         CResult_PaymentIdPaymentSendFailureZPtr { err }
6295                 };
6296                 Self {
6297                         contents,
6298                         result_ok: o.result_ok,
6299                 }
6300         }
6301 }
6302 impl Clone for CResult_PaymentIdPaymentSendFailureZ {
6303         fn clone(&self) -> Self {
6304                 if self.result_ok {
6305                         Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6306                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6307                         } }
6308                 } else {
6309                         Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr {
6310                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6311                         } }
6312                 }
6313         }
6314 }
6315 #[no_mangle]
6316 /// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
6317 /// but with all dynamically-allocated buffers duplicated in new buffers.
6318 pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) }
6319 #[repr(C)]
6320 /// The contents of CResult_NonePaymentSendFailureZ
6321 pub union CResult_NonePaymentSendFailureZPtr {
6322         /// Note that this value is always NULL, as there are no contents in the OK variant
6323         pub result: *mut core::ffi::c_void,
6324         /// A pointer to the contents in the error state.
6325         /// Reading from this pointer when `result_ok` is set is undefined.
6326         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6327 }
6328 #[repr(C)]
6329 /// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6330 /// containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6331 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6332 pub struct CResult_NonePaymentSendFailureZ {
6333         /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6334         /// `err` or `result` depending on the state of `result_ok`.
6335         pub contents: CResult_NonePaymentSendFailureZPtr,
6336         /// Whether this CResult_NonePaymentSendFailureZ represents a success state.
6337         pub result_ok: bool,
6338 }
6339 #[no_mangle]
6340 /// Creates a new CResult_NonePaymentSendFailureZ in the success state.
6341 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
6342         CResult_NonePaymentSendFailureZ {
6343                 contents: CResult_NonePaymentSendFailureZPtr {
6344                         result: core::ptr::null_mut(),
6345                 },
6346                 result_ok: true,
6347         }
6348 }
6349 #[no_mangle]
6350 /// Creates a new CResult_NonePaymentSendFailureZ in the error state.
6351 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
6352         CResult_NonePaymentSendFailureZ {
6353                 contents: CResult_NonePaymentSendFailureZPtr {
6354                         err: Box::into_raw(Box::new(e)),
6355                 },
6356                 result_ok: false,
6357         }
6358 }
6359 /// Checks if the given object is currently in the success state
6360 #[no_mangle]
6361 pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool {
6362         o.result_ok
6363 }
6364 #[no_mangle]
6365 /// Frees any resources used by the CResult_NonePaymentSendFailureZ.
6366 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
6367 impl Drop for CResult_NonePaymentSendFailureZ {
6368         fn drop(&mut self) {
6369                 if self.result_ok {
6370                 } else {
6371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6373                         }
6374                 }
6375         }
6376 }
6377 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
6378         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6379                 let contents = if o.result_ok {
6380                         let _ = unsafe { Box::from_raw(o.contents.result) };
6381                         o.contents.result = core::ptr::null_mut();
6382                         CResult_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() }
6383                 } else {
6384                         let err = unsafe { o.contents.err };
6385                         unsafe { o.contents.err = core::ptr::null_mut(); }
6386                         CResult_NonePaymentSendFailureZPtr { err }
6387                 };
6388                 Self {
6389                         contents,
6390                         result_ok: o.result_ok,
6391                 }
6392         }
6393 }
6394 impl Clone for CResult_NonePaymentSendFailureZ {
6395         fn clone(&self) -> Self {
6396                 if self.result_ok {
6397                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
6398                                 result: core::ptr::null_mut()
6399                         } }
6400                 } else {
6401                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
6402                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6403                         } }
6404                 }
6405         }
6406 }
6407 #[no_mangle]
6408 /// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
6409 /// but with all dynamically-allocated buffers duplicated in new buffers.
6410 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) }
6411 #[repr(C)]
6412 /// A tuple of 2 elements. See the individual fields for the types contained.
6413 pub struct C2Tuple_PaymentHashPaymentIdZ {
6414         /// The element at position 0
6415         pub a: crate::c_types::ThirtyTwoBytes,
6416         /// The element at position 1
6417         pub b: crate::c_types::ThirtyTwoBytes,
6418 }
6419 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ {
6420         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6421                 Self {
6422                         a: tup.0,
6423                         b: tup.1,
6424                 }
6425         }
6426 }
6427 impl C2Tuple_PaymentHashPaymentIdZ {
6428         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6429                 (self.a, self.b)
6430         }
6431 }
6432 impl Clone for C2Tuple_PaymentHashPaymentIdZ {
6433         fn clone(&self) -> Self {
6434                 Self {
6435                         a: Clone::clone(&self.a),
6436                         b: Clone::clone(&self.b),
6437                 }
6438         }
6439 }
6440 #[no_mangle]
6441 /// Creates a new tuple which has the same data as `orig`
6442 /// but with all dynamically-allocated buffers duplicated in new buffers.
6443 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_clone(orig: &C2Tuple_PaymentHashPaymentIdZ) -> C2Tuple_PaymentHashPaymentIdZ { Clone::clone(&orig) }
6444 /// Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
6445 #[no_mangle]
6446 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentIdZ {
6447         C2Tuple_PaymentHashPaymentIdZ { a, b, }
6448 }
6449
6450 #[no_mangle]
6451 /// Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
6452 pub extern "C" fn C2Tuple_PaymentHashPaymentIdZ_free(_res: C2Tuple_PaymentHashPaymentIdZ) { }
6453 #[repr(C)]
6454 /// The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6455 pub union CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6456         /// A pointer to the contents in the success state.
6457         /// Reading from this pointer when `result_ok` is not set is undefined.
6458         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ,
6459         /// A pointer to the contents in the error state.
6460         /// Reading from this pointer when `result_ok` is set is undefined.
6461         pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure,
6462 }
6463 #[repr(C)]
6464 /// A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6465 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6466 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6467 pub struct CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6468         /// The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6469         /// `err` or `result` depending on the state of `result_ok`.
6470         pub contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr,
6471         /// Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6472         pub result_ok: bool,
6473 }
6474 #[no_mangle]
6475 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
6476 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6477         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6478                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6479                         result: Box::into_raw(Box::new(o)),
6480                 },
6481                 result_ok: true,
6482         }
6483 }
6484 #[no_mangle]
6485 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
6486 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6487         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6488                 contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6489                         err: Box::into_raw(Box::new(e)),
6490                 },
6491                 result_ok: false,
6492         }
6493 }
6494 /// Checks if the given object is currently in the success state
6495 #[no_mangle]
6496 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool {
6497         o.result_ok
6498 }
6499 #[no_mangle]
6500 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
6501 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { }
6502 impl Drop for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6503         fn drop(&mut self) {
6504                 if self.result_ok {
6505                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6506                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6507                         }
6508                 } else {
6509                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6510                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6511                         }
6512                 }
6513         }
6514 }
6515 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>> for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6516         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ, crate::lightning::ln::channelmanager::PaymentSendFailure>) -> Self {
6517                 let contents = if o.result_ok {
6518                         let result = unsafe { o.contents.result };
6519                         unsafe { o.contents.result = core::ptr::null_mut() };
6520                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { result }
6521                 } else {
6522                         let err = unsafe { o.contents.err };
6523                         unsafe { o.contents.err = core::ptr::null_mut(); }
6524                         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { err }
6525                 };
6526                 Self {
6527                         contents,
6528                         result_ok: o.result_ok,
6529                 }
6530         }
6531 }
6532 impl Clone for CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6533         fn clone(&self) -> Self {
6534                 if self.result_ok {
6535                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6536                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ>::clone(unsafe { &*self.contents.result })))
6537                         } }
6538                 } else {
6539                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6540                                 err: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
6541                         } }
6542                 }
6543         }
6544 }
6545 #[no_mangle]
6546 /// Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
6547 /// but with all dynamically-allocated buffers duplicated in new buffers.
6548 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { Clone::clone(&orig) }
6549 #[repr(C)]
6550 /// A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6551 /// This corresponds to std::vector in C++
6552 pub struct CVec_NetAddressZ {
6553         /// The elements in the array.
6554         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6555         pub data: *mut crate::lightning::ln::msgs::NetAddress,
6556         /// The number of elements pointed to by `data`.
6557         pub datalen: usize
6558 }
6559 impl CVec_NetAddressZ {
6560         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NetAddress> {
6561                 if self.datalen == 0 { return Vec::new(); }
6562                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
6563                 self.data = core::ptr::null_mut();
6564                 self.datalen = 0;
6565                 ret
6566         }
6567         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NetAddress] {
6568                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
6569         }
6570 }
6571 impl From<Vec<crate::lightning::ln::msgs::NetAddress>> for CVec_NetAddressZ {
6572         fn from(v: Vec<crate::lightning::ln::msgs::NetAddress>) -> Self {
6573                 let datalen = v.len();
6574                 let data = Box::into_raw(v.into_boxed_slice());
6575                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
6576         }
6577 }
6578 #[no_mangle]
6579 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
6580 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
6581 impl Drop for CVec_NetAddressZ {
6582         fn drop(&mut self) {
6583                 if self.datalen == 0 { return; }
6584                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
6585         }
6586 }
6587 impl Clone for CVec_NetAddressZ {
6588         fn clone(&self) -> Self {
6589                 let mut res = Vec::new();
6590                 if self.datalen == 0 { return Self::from(res); }
6591                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
6592                 Self::from(res)
6593         }
6594 }
6595 #[repr(C)]
6596 /// A tuple of 2 elements. See the individual fields for the types contained.
6597 pub struct C2Tuple_PaymentHashPaymentSecretZ {
6598         /// The element at position 0
6599         pub a: crate::c_types::ThirtyTwoBytes,
6600         /// The element at position 1
6601         pub b: crate::c_types::ThirtyTwoBytes,
6602 }
6603 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentSecretZ {
6604         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self {
6605                 Self {
6606                         a: tup.0,
6607                         b: tup.1,
6608                 }
6609         }
6610 }
6611 impl C2Tuple_PaymentHashPaymentSecretZ {
6612         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) {
6613                 (self.a, self.b)
6614         }
6615 }
6616 impl Clone for C2Tuple_PaymentHashPaymentSecretZ {
6617         fn clone(&self) -> Self {
6618                 Self {
6619                         a: Clone::clone(&self.a),
6620                         b: Clone::clone(&self.b),
6621                 }
6622         }
6623 }
6624 #[no_mangle]
6625 /// Creates a new tuple which has the same data as `orig`
6626 /// but with all dynamically-allocated buffers duplicated in new buffers.
6627 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_clone(orig: &C2Tuple_PaymentHashPaymentSecretZ) -> C2Tuple_PaymentHashPaymentSecretZ { Clone::clone(&orig) }
6628 /// Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
6629 #[no_mangle]
6630 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_PaymentHashPaymentSecretZ {
6631         C2Tuple_PaymentHashPaymentSecretZ { a, b, }
6632 }
6633
6634 #[no_mangle]
6635 /// Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
6636 pub extern "C" fn C2Tuple_PaymentHashPaymentSecretZ_free(_res: C2Tuple_PaymentHashPaymentSecretZ) { }
6637 #[repr(C)]
6638 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6639 pub union CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6640         /// A pointer to the contents in the success state.
6641         /// Reading from this pointer when `result_ok` is not set is undefined.
6642         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6643         /// Note that this value is always NULL, as there are no contents in the Err variant
6644         pub err: *mut core::ffi::c_void,
6645 }
6646 #[repr(C)]
6647 /// A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6648 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6649 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6650 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6651         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6652         /// `err` or `result` depending on the state of `result_ok`.
6653         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr,
6654         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6655         pub result_ok: bool,
6656 }
6657 #[no_mangle]
6658 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
6659 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6660         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6661                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6662                         result: Box::into_raw(Box::new(o)),
6663                 },
6664                 result_ok: true,
6665         }
6666 }
6667 #[no_mangle]
6668 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
6669 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6670         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6671                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6672                         err: core::ptr::null_mut(),
6673                 },
6674                 result_ok: false,
6675         }
6676 }
6677 /// Checks if the given object is currently in the success state
6678 #[no_mangle]
6679 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> bool {
6680         o.result_ok
6681 }
6682 #[no_mangle]
6683 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
6684 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) { }
6685 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6686         fn drop(&mut self) {
6687                 if self.result_ok {
6688                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6689                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6690                         }
6691                 } else {
6692                 }
6693         }
6694 }
6695 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>> for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6696         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, ()>) -> Self {
6697                 let contents = if o.result_ok {
6698                         let result = unsafe { o.contents.result };
6699                         unsafe { o.contents.result = core::ptr::null_mut() };
6700                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { result }
6701                 } else {
6702                         let _ = unsafe { Box::from_raw(o.contents.err) };
6703                         o.contents.err = core::ptr::null_mut();
6704                         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { err: core::ptr::null_mut() }
6705                 };
6706                 Self {
6707                         contents,
6708                         result_ok: o.result_ok,
6709                 }
6710         }
6711 }
6712 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6713         fn clone(&self) -> Self {
6714                 if self.result_ok {
6715                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6716                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6717                         } }
6718                 } else {
6719                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6720                                 err: core::ptr::null_mut()
6721                         } }
6722                 }
6723         }
6724 }
6725 #[no_mangle]
6726 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
6727 /// but with all dynamically-allocated buffers duplicated in new buffers.
6728 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { Clone::clone(&orig) }
6729 #[repr(C)]
6730 /// The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6731 pub union CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6732         /// A pointer to the contents in the success state.
6733         /// Reading from this pointer when `result_ok` is not set is undefined.
6734         pub result: *mut crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ,
6735         /// A pointer to the contents in the error state.
6736         /// Reading from this pointer when `result_ok` is set is undefined.
6737         pub err: *mut crate::lightning::util::errors::APIError,
6738 }
6739 #[repr(C)]
6740 /// A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6741 /// containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6742 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6743 pub struct CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6744         /// The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6745         /// `err` or `result` depending on the state of `result_ok`.
6746         pub contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr,
6747         /// Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6748         pub result_ok: bool,
6749 }
6750 #[no_mangle]
6751 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
6752 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6753         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6754                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6755                         result: Box::into_raw(Box::new(o)),
6756                 },
6757                 result_ok: true,
6758         }
6759 }
6760 #[no_mangle]
6761 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
6762 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6763         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6764                 contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6765                         err: Box::into_raw(Box::new(e)),
6766                 },
6767                 result_ok: false,
6768         }
6769 }
6770 /// Checks if the given object is currently in the success state
6771 #[no_mangle]
6772 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> bool {
6773         o.result_ok
6774 }
6775 #[no_mangle]
6776 /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
6777 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) { }
6778 impl Drop for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6779         fn drop(&mut self) {
6780                 if self.result_ok {
6781                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6782                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6783                         }
6784                 } else {
6785                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6786                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6787                         }
6788                 }
6789         }
6790 }
6791 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>> for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6792         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ, crate::lightning::util::errors::APIError>) -> Self {
6793                 let contents = if o.result_ok {
6794                         let result = unsafe { o.contents.result };
6795                         unsafe { o.contents.result = core::ptr::null_mut() };
6796                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { result }
6797                 } else {
6798                         let err = unsafe { o.contents.err };
6799                         unsafe { o.contents.err = core::ptr::null_mut(); }
6800                         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { err }
6801                 };
6802                 Self {
6803                         contents,
6804                         result_ok: o.result_ok,
6805                 }
6806         }
6807 }
6808 impl Clone for CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6809         fn clone(&self) -> Self {
6810                 if self.result_ok {
6811                         Self { result_ok: true, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6812                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ>::clone(unsafe { &*self.contents.result })))
6813                         } }
6814                 } else {
6815                         Self { result_ok: false, contents: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6816                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
6817                         } }
6818                 }
6819         }
6820 }
6821 #[no_mangle]
6822 /// Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
6823 /// but with all dynamically-allocated buffers duplicated in new buffers.
6824 pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: &CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ) -> CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { Clone::clone(&orig) }
6825 #[repr(C)]
6826 /// The contents of CResult_PaymentSecretNoneZ
6827 pub union CResult_PaymentSecretNoneZPtr {
6828         /// A pointer to the contents in the success state.
6829         /// Reading from this pointer when `result_ok` is not set is undefined.
6830         pub result: *mut crate::c_types::ThirtyTwoBytes,
6831         /// Note that this value is always NULL, as there are no contents in the Err variant
6832         pub err: *mut core::ffi::c_void,
6833 }
6834 #[repr(C)]
6835 /// A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6836 /// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6838 pub struct CResult_PaymentSecretNoneZ {
6839         /// The contents of this CResult_PaymentSecretNoneZ, accessible via either
6840         /// `err` or `result` depending on the state of `result_ok`.
6841         pub contents: CResult_PaymentSecretNoneZPtr,
6842         /// Whether this CResult_PaymentSecretNoneZ represents a success state.
6843         pub result_ok: bool,
6844 }
6845 #[no_mangle]
6846 /// Creates a new CResult_PaymentSecretNoneZ in the success state.
6847 pub extern "C" fn CResult_PaymentSecretNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretNoneZ {
6848         CResult_PaymentSecretNoneZ {
6849                 contents: CResult_PaymentSecretNoneZPtr {
6850                         result: Box::into_raw(Box::new(o)),
6851                 },
6852                 result_ok: true,
6853         }
6854 }
6855 #[no_mangle]
6856 /// Creates a new CResult_PaymentSecretNoneZ in the error state.
6857 pub extern "C" fn CResult_PaymentSecretNoneZ_err() -> CResult_PaymentSecretNoneZ {
6858         CResult_PaymentSecretNoneZ {
6859                 contents: CResult_PaymentSecretNoneZPtr {
6860                         err: core::ptr::null_mut(),
6861                 },
6862                 result_ok: false,
6863         }
6864 }
6865 /// Checks if the given object is currently in the success state
6866 #[no_mangle]
6867 pub extern "C" fn CResult_PaymentSecretNoneZ_is_ok(o: &CResult_PaymentSecretNoneZ) -> bool {
6868         o.result_ok
6869 }
6870 #[no_mangle]
6871 /// Frees any resources used by the CResult_PaymentSecretNoneZ.
6872 pub extern "C" fn CResult_PaymentSecretNoneZ_free(_res: CResult_PaymentSecretNoneZ) { }
6873 impl Drop for CResult_PaymentSecretNoneZ {
6874         fn drop(&mut self) {
6875                 if self.result_ok {
6876                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6877                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6878                         }
6879                 } else {
6880                 }
6881         }
6882 }
6883 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>> for CResult_PaymentSecretNoneZ {
6884         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, ()>) -> Self {
6885                 let contents = if o.result_ok {
6886                         let result = unsafe { o.contents.result };
6887                         unsafe { o.contents.result = core::ptr::null_mut() };
6888                         CResult_PaymentSecretNoneZPtr { result }
6889                 } else {
6890                         let _ = unsafe { Box::from_raw(o.contents.err) };
6891                         o.contents.err = core::ptr::null_mut();
6892                         CResult_PaymentSecretNoneZPtr { err: core::ptr::null_mut() }
6893                 };
6894                 Self {
6895                         contents,
6896                         result_ok: o.result_ok,
6897                 }
6898         }
6899 }
6900 impl Clone for CResult_PaymentSecretNoneZ {
6901         fn clone(&self) -> Self {
6902                 if self.result_ok {
6903                         Self { result_ok: true, contents: CResult_PaymentSecretNoneZPtr {
6904                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
6905                         } }
6906                 } else {
6907                         Self { result_ok: false, contents: CResult_PaymentSecretNoneZPtr {
6908                                 err: core::ptr::null_mut()
6909                         } }
6910                 }
6911         }
6912 }
6913 #[no_mangle]
6914 /// Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
6915 /// but with all dynamically-allocated buffers duplicated in new buffers.
6916 pub extern "C" fn CResult_PaymentSecretNoneZ_clone(orig: &CResult_PaymentSecretNoneZ) -> CResult_PaymentSecretNoneZ { Clone::clone(&orig) }
6917 #[repr(C)]
6918 /// The contents of CResult_PaymentSecretAPIErrorZ
6919 pub union CResult_PaymentSecretAPIErrorZPtr {
6920         /// A pointer to the contents in the success state.
6921         /// Reading from this pointer when `result_ok` is not set is undefined.
6922         pub result: *mut crate::c_types::ThirtyTwoBytes,
6923         /// A pointer to the contents in the error state.
6924         /// Reading from this pointer when `result_ok` is set is undefined.
6925         pub err: *mut crate::lightning::util::errors::APIError,
6926 }
6927 #[repr(C)]
6928 /// A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6929 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6930 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
6931 pub struct CResult_PaymentSecretAPIErrorZ {
6932         /// The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6933         /// `err` or `result` depending on the state of `result_ok`.
6934         pub contents: CResult_PaymentSecretAPIErrorZPtr,
6935         /// Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6936         pub result_ok: bool,
6937 }
6938 #[no_mangle]
6939 /// Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
6940 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentSecretAPIErrorZ {
6941         CResult_PaymentSecretAPIErrorZ {
6942                 contents: CResult_PaymentSecretAPIErrorZPtr {
6943                         result: Box::into_raw(Box::new(o)),
6944                 },
6945                 result_ok: true,
6946         }
6947 }
6948 #[no_mangle]
6949 /// Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
6950 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentSecretAPIErrorZ {
6951         CResult_PaymentSecretAPIErrorZ {
6952                 contents: CResult_PaymentSecretAPIErrorZPtr {
6953                         err: Box::into_raw(Box::new(e)),
6954                 },
6955                 result_ok: false,
6956         }
6957 }
6958 /// Checks if the given object is currently in the success state
6959 #[no_mangle]
6960 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool {
6961         o.result_ok
6962 }
6963 #[no_mangle]
6964 /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
6965 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { }
6966 impl Drop for CResult_PaymentSecretAPIErrorZ {
6967         fn drop(&mut self) {
6968                 if self.result_ok {
6969                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6970                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6971                         }
6972                 } else {
6973                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6974                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6975                         }
6976                 }
6977         }
6978 }
6979 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentSecretAPIErrorZ {
6980         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
6981                 let contents = if o.result_ok {
6982                         let result = unsafe { o.contents.result };
6983                         unsafe { o.contents.result = core::ptr::null_mut() };
6984                         CResult_PaymentSecretAPIErrorZPtr { result }
6985                 } else {
6986                         let err = unsafe { o.contents.err };
6987                         unsafe { o.contents.err = core::ptr::null_mut(); }
6988                         CResult_PaymentSecretAPIErrorZPtr { err }
6989                 };
6990                 Self {
6991                         contents,
6992                         result_ok: o.result_ok,
6993                 }
6994         }
6995 }
6996 impl Clone for CResult_PaymentSecretAPIErrorZ {
6997         fn clone(&self) -> Self {
6998                 if self.result_ok {
6999                         Self { result_ok: true, contents: CResult_PaymentSecretAPIErrorZPtr {
7000                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7001                         } }
7002                 } else {
7003                         Self { result_ok: false, contents: CResult_PaymentSecretAPIErrorZPtr {
7004                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7005                         } }
7006                 }
7007         }
7008 }
7009 #[no_mangle]
7010 /// Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
7011 /// but with all dynamically-allocated buffers duplicated in new buffers.
7012 pub extern "C" fn CResult_PaymentSecretAPIErrorZ_clone(orig: &CResult_PaymentSecretAPIErrorZ) -> CResult_PaymentSecretAPIErrorZ { Clone::clone(&orig) }
7013 #[repr(C)]
7014 /// The contents of CResult_PaymentPreimageAPIErrorZ
7015 pub union CResult_PaymentPreimageAPIErrorZPtr {
7016         /// A pointer to the contents in the success state.
7017         /// Reading from this pointer when `result_ok` is not set is undefined.
7018         pub result: *mut crate::c_types::ThirtyTwoBytes,
7019         /// A pointer to the contents in the error state.
7020         /// Reading from this pointer when `result_ok` is set is undefined.
7021         pub err: *mut crate::lightning::util::errors::APIError,
7022 }
7023 #[repr(C)]
7024 /// A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7025 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7026 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7027 pub struct CResult_PaymentPreimageAPIErrorZ {
7028         /// The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7029         /// `err` or `result` depending on the state of `result_ok`.
7030         pub contents: CResult_PaymentPreimageAPIErrorZPtr,
7031         /// Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7032         pub result_ok: bool,
7033 }
7034 #[no_mangle]
7035 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
7036 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentPreimageAPIErrorZ {
7037         CResult_PaymentPreimageAPIErrorZ {
7038                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7039                         result: Box::into_raw(Box::new(o)),
7040                 },
7041                 result_ok: true,
7042         }
7043 }
7044 #[no_mangle]
7045 /// Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
7046 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_PaymentPreimageAPIErrorZ {
7047         CResult_PaymentPreimageAPIErrorZ {
7048                 contents: CResult_PaymentPreimageAPIErrorZPtr {
7049                         err: Box::into_raw(Box::new(e)),
7050                 },
7051                 result_ok: false,
7052         }
7053 }
7054 /// Checks if the given object is currently in the success state
7055 #[no_mangle]
7056 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_is_ok(o: &CResult_PaymentPreimageAPIErrorZ) -> bool {
7057         o.result_ok
7058 }
7059 #[no_mangle]
7060 /// Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
7061 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_free(_res: CResult_PaymentPreimageAPIErrorZ) { }
7062 impl Drop for CResult_PaymentPreimageAPIErrorZ {
7063         fn drop(&mut self) {
7064                 if self.result_ok {
7065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7067                         }
7068                 } else {
7069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7071                         }
7072                 }
7073         }
7074 }
7075 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>> for CResult_PaymentPreimageAPIErrorZ {
7076         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning::util::errors::APIError>) -> Self {
7077                 let contents = if o.result_ok {
7078                         let result = unsafe { o.contents.result };
7079                         unsafe { o.contents.result = core::ptr::null_mut() };
7080                         CResult_PaymentPreimageAPIErrorZPtr { result }
7081                 } else {
7082                         let err = unsafe { o.contents.err };
7083                         unsafe { o.contents.err = core::ptr::null_mut(); }
7084                         CResult_PaymentPreimageAPIErrorZPtr { err }
7085                 };
7086                 Self {
7087                         contents,
7088                         result_ok: o.result_ok,
7089                 }
7090         }
7091 }
7092 impl Clone for CResult_PaymentPreimageAPIErrorZ {
7093         fn clone(&self) -> Self {
7094                 if self.result_ok {
7095                         Self { result_ok: true, contents: CResult_PaymentPreimageAPIErrorZPtr {
7096                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
7097                         } }
7098                 } else {
7099                         Self { result_ok: false, contents: CResult_PaymentPreimageAPIErrorZPtr {
7100                                 err: Box::into_raw(Box::new(<crate::lightning::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
7101                         } }
7102                 }
7103         }
7104 }
7105 #[no_mangle]
7106 /// Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
7107 /// but with all dynamically-allocated buffers duplicated in new buffers.
7108 pub extern "C" fn CResult_PaymentPreimageAPIErrorZ_clone(orig: &CResult_PaymentPreimageAPIErrorZ) -> CResult_PaymentPreimageAPIErrorZ { Clone::clone(&orig) }
7109 #[repr(C)]
7110 /// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7111 pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7112         /// A pointer to the contents in the success state.
7113         /// Reading from this pointer when `result_ok` is not set is undefined.
7114         pub result: *mut crate::lightning::ln::channelmanager::CounterpartyForwardingInfo,
7115         /// A pointer to the contents in the error state.
7116         /// Reading from this pointer when `result_ok` is set is undefined.
7117         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7118 }
7119 #[repr(C)]
7120 /// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7121 /// containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7122 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7123 pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ {
7124         /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7125         /// `err` or `result` depending on the state of `result_ok`.
7126         pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr,
7127         /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7128         pub result_ok: bool,
7129 }
7130 #[no_mangle]
7131 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
7132 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7133         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7134                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7135                         result: Box::into_raw(Box::new(o)),
7136                 },
7137                 result_ok: true,
7138         }
7139 }
7140 #[no_mangle]
7141 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
7142 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ {
7143         CResult_CounterpartyForwardingInfoDecodeErrorZ {
7144                 contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7145                         err: Box::into_raw(Box::new(e)),
7146                 },
7147                 result_ok: false,
7148         }
7149 }
7150 /// Checks if the given object is currently in the success state
7151 #[no_mangle]
7152 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool {
7153         o.result_ok
7154 }
7155 #[no_mangle]
7156 /// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
7157 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { }
7158 impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7159         fn drop(&mut self) {
7160                 if self.result_ok {
7161                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7162                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7163                         }
7164                 } else {
7165                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7166                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7167                         }
7168                 }
7169         }
7170 }
7171 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7172         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
7173                 let contents = if o.result_ok {
7174                         let result = unsafe { o.contents.result };
7175                         unsafe { o.contents.result = core::ptr::null_mut() };
7176                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result }
7177                 } else {
7178                         let err = unsafe { o.contents.err };
7179                         unsafe { o.contents.err = core::ptr::null_mut(); }
7180                         CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err }
7181                 };
7182                 Self {
7183                         contents,
7184                         result_ok: o.result_ok,
7185                 }
7186         }
7187 }
7188 impl Clone for CResult_CounterpartyForwardingInfoDecodeErrorZ {
7189         fn clone(&self) -> Self {
7190                 if self.result_ok {
7191                         Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7192                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::CounterpartyForwardingInfo>::clone(unsafe { &*self.contents.result })))
7193                         } }
7194                 } else {
7195                         Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7196                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7197                         } }
7198                 }
7199         }
7200 }
7201 #[no_mangle]
7202 /// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
7203 /// but with all dynamically-allocated buffers duplicated in new buffers.
7204 pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) }
7205 #[repr(C)]
7206 /// The contents of CResult_ChannelCounterpartyDecodeErrorZ
7207 pub union CResult_ChannelCounterpartyDecodeErrorZPtr {
7208         /// A pointer to the contents in the success state.
7209         /// Reading from this pointer when `result_ok` is not set is undefined.
7210         pub result: *mut crate::lightning::ln::channelmanager::ChannelCounterparty,
7211         /// A pointer to the contents in the error state.
7212         /// Reading from this pointer when `result_ok` is set is undefined.
7213         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7214 }
7215 #[repr(C)]
7216 /// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7217 /// containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7219 pub struct CResult_ChannelCounterpartyDecodeErrorZ {
7220         /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7221         /// `err` or `result` depending on the state of `result_ok`.
7222         pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr,
7223         /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7224         pub result_ok: bool,
7225 }
7226 #[no_mangle]
7227 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
7228 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ {
7229         CResult_ChannelCounterpartyDecodeErrorZ {
7230                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7231                         result: Box::into_raw(Box::new(o)),
7232                 },
7233                 result_ok: true,
7234         }
7235 }
7236 #[no_mangle]
7237 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
7238 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ {
7239         CResult_ChannelCounterpartyDecodeErrorZ {
7240                 contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7241                         err: Box::into_raw(Box::new(e)),
7242                 },
7243                 result_ok: false,
7244         }
7245 }
7246 /// Checks if the given object is currently in the success state
7247 #[no_mangle]
7248 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool {
7249         o.result_ok
7250 }
7251 #[no_mangle]
7252 /// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
7253 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { }
7254 impl Drop for CResult_ChannelCounterpartyDecodeErrorZ {
7255         fn drop(&mut self) {
7256                 if self.result_ok {
7257                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7258                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7259                         }
7260                 } else {
7261                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7262                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7263                         }
7264                 }
7265         }
7266 }
7267 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelCounterpartyDecodeErrorZ {
7268         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelCounterparty, crate::lightning::ln::msgs::DecodeError>) -> Self {
7269                 let contents = if o.result_ok {
7270                         let result = unsafe { o.contents.result };
7271                         unsafe { o.contents.result = core::ptr::null_mut() };
7272                         CResult_ChannelCounterpartyDecodeErrorZPtr { result }
7273                 } else {
7274                         let err = unsafe { o.contents.err };
7275                         unsafe { o.contents.err = core::ptr::null_mut(); }
7276                         CResult_ChannelCounterpartyDecodeErrorZPtr { err }
7277                 };
7278                 Self {
7279                         contents,
7280                         result_ok: o.result_ok,
7281                 }
7282         }
7283 }
7284 impl Clone for CResult_ChannelCounterpartyDecodeErrorZ {
7285         fn clone(&self) -> Self {
7286                 if self.result_ok {
7287                         Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7288                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelCounterparty>::clone(unsafe { &*self.contents.result })))
7289                         } }
7290                 } else {
7291                         Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr {
7292                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7293                         } }
7294                 }
7295         }
7296 }
7297 #[no_mangle]
7298 /// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
7299 /// but with all dynamically-allocated buffers duplicated in new buffers.
7300 pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) }
7301 #[repr(C)]
7302 /// The contents of CResult_ChannelDetailsDecodeErrorZ
7303 pub union CResult_ChannelDetailsDecodeErrorZPtr {
7304         /// A pointer to the contents in the success state.
7305         /// Reading from this pointer when `result_ok` is not set is undefined.
7306         pub result: *mut crate::lightning::ln::channelmanager::ChannelDetails,
7307         /// A pointer to the contents in the error state.
7308         /// Reading from this pointer when `result_ok` is set is undefined.
7309         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7310 }
7311 #[repr(C)]
7312 /// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7313 /// containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7314 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7315 pub struct CResult_ChannelDetailsDecodeErrorZ {
7316         /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7317         /// `err` or `result` depending on the state of `result_ok`.
7318         pub contents: CResult_ChannelDetailsDecodeErrorZPtr,
7319         /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7320         pub result_ok: bool,
7321 }
7322 #[no_mangle]
7323 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
7324 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ {
7325         CResult_ChannelDetailsDecodeErrorZ {
7326                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7327                         result: Box::into_raw(Box::new(o)),
7328                 },
7329                 result_ok: true,
7330         }
7331 }
7332 #[no_mangle]
7333 /// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
7334 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ {
7335         CResult_ChannelDetailsDecodeErrorZ {
7336                 contents: CResult_ChannelDetailsDecodeErrorZPtr {
7337                         err: Box::into_raw(Box::new(e)),
7338                 },
7339                 result_ok: false,
7340         }
7341 }
7342 /// Checks if the given object is currently in the success state
7343 #[no_mangle]
7344 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool {
7345         o.result_ok
7346 }
7347 #[no_mangle]
7348 /// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
7349 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { }
7350 impl Drop for CResult_ChannelDetailsDecodeErrorZ {
7351         fn drop(&mut self) {
7352                 if self.result_ok {
7353                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7354                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7355                         }
7356                 } else {
7357                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7358                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7359                         }
7360                 }
7361         }
7362 }
7363 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelDetailsDecodeErrorZ {
7364         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::ChannelDetails, crate::lightning::ln::msgs::DecodeError>) -> Self {
7365                 let contents = if o.result_ok {
7366                         let result = unsafe { o.contents.result };
7367                         unsafe { o.contents.result = core::ptr::null_mut() };
7368                         CResult_ChannelDetailsDecodeErrorZPtr { result }
7369                 } else {
7370                         let err = unsafe { o.contents.err };
7371                         unsafe { o.contents.err = core::ptr::null_mut(); }
7372                         CResult_ChannelDetailsDecodeErrorZPtr { err }
7373                 };
7374                 Self {
7375                         contents,
7376                         result_ok: o.result_ok,
7377                 }
7378         }
7379 }
7380 impl Clone for CResult_ChannelDetailsDecodeErrorZ {
7381         fn clone(&self) -> Self {
7382                 if self.result_ok {
7383                         Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7384                                 result: Box::into_raw(Box::new(<crate::lightning::ln::channelmanager::ChannelDetails>::clone(unsafe { &*self.contents.result })))
7385                         } }
7386                 } else {
7387                         Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr {
7388                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7389                         } }
7390                 }
7391         }
7392 }
7393 #[no_mangle]
7394 /// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
7395 /// but with all dynamically-allocated buffers duplicated in new buffers.
7396 pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) }
7397 #[repr(C)]
7398 /// The contents of CResult_PhantomRouteHintsDecodeErrorZ
7399 pub union CResult_PhantomRouteHintsDecodeErrorZPtr {
7400         /// A pointer to the contents in the success state.
7401         /// Reading from this pointer when `result_ok` is not set is undefined.
7402         pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
7403         /// A pointer to the contents in the error state.
7404         /// Reading from this pointer when `result_ok` is set is undefined.
7405         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7406 }
7407 #[repr(C)]
7408 /// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7409 /// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7410 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7411 pub struct CResult_PhantomRouteHintsDecodeErrorZ {
7412         /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7413         /// `err` or `result` depending on the state of `result_ok`.
7414         pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr,
7415         /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7416         pub result_ok: bool,
7417 }
7418 #[no_mangle]
7419 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
7420 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ {
7421         CResult_PhantomRouteHintsDecodeErrorZ {
7422                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7423                         result: Box::into_raw(Box::new(o)),
7424                 },
7425                 result_ok: true,
7426         }
7427 }
7428 #[no_mangle]
7429 /// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
7430 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ {
7431         CResult_PhantomRouteHintsDecodeErrorZ {
7432                 contents: CResult_PhantomRouteHintsDecodeErrorZPtr {
7433                         err: Box::into_raw(Box::new(e)),
7434                 },
7435                 result_ok: false,
7436         }
7437 }
7438 /// Checks if the given object is currently in the success state
7439 #[no_mangle]
7440 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool {
7441         o.result_ok
7442 }
7443 #[no_mangle]
7444 /// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
7445 pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { }
7446 impl Drop for CResult_PhantomRouteHintsDecodeErrorZ {
7447         fn drop(&mut self) {
7448                 if self.result_ok {
7449                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7450                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7451                         }
7452                 } else {
7453                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7454                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7455                         }
7456                 }
7457         }
7458 }
7459 impl From<crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>> for CResult_PhantomRouteHintsDecodeErrorZ {
7460         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::channelmanager::PhantomRouteHints, crate::lightning::ln::msgs::DecodeError>) -> Self {
7461                 let contents = if o.result_ok {
7462                         let result = unsafe { o.contents.result };
7463                         unsafe { o.contents.result = core::ptr::null_mut() };
7464                         CResult_PhantomRouteHintsDecodeErrorZPtr { result }
7465                 } else {
7466                         let err = unsafe { o.contents.err };
7467                         unsafe { o.contents.err = core::ptr::null_mut(); }
7468                         CResult_PhantomRouteHintsDecodeErrorZPtr { err }
7469                 };
7470                 Self {
7471                         contents,
7472                         result_ok: o.result_ok,
7473                 }
7474         }
7475 }
7476 #[repr(C)]
7477 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7478 /// This corresponds to std::vector in C++
7479 pub struct CVec_ChannelMonitorZ {
7480         /// The elements in the array.
7481         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7482         pub data: *mut crate::lightning::chain::channelmonitor::ChannelMonitor,
7483         /// The number of elements pointed to by `data`.
7484         pub datalen: usize
7485 }
7486 impl CVec_ChannelMonitorZ {
7487         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::ChannelMonitor> {
7488                 if self.datalen == 0 { return Vec::new(); }
7489                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
7490                 self.data = core::ptr::null_mut();
7491                 self.datalen = 0;
7492                 ret
7493         }
7494         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::ChannelMonitor] {
7495                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
7496         }
7497 }
7498 impl From<Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
7499         fn from(v: Vec<crate::lightning::chain::channelmonitor::ChannelMonitor>) -> Self {
7500                 let datalen = v.len();
7501                 let data = Box::into_raw(v.into_boxed_slice());
7502                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
7503         }
7504 }
7505 #[no_mangle]
7506 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
7507 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
7508 impl Drop for CVec_ChannelMonitorZ {
7509         fn drop(&mut self) {
7510                 if self.datalen == 0 { return; }
7511                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
7512         }
7513 }
7514 #[repr(C)]
7515 /// A tuple of 2 elements. See the individual fields for the types contained.
7516 pub struct C2Tuple_BlockHashChannelManagerZ {
7517         /// The element at position 0
7518         pub a: crate::c_types::ThirtyTwoBytes,
7519         /// The element at position 1
7520         pub b: crate::lightning::ln::channelmanager::ChannelManager,
7521 }
7522 impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
7523         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self {
7524                 Self {
7525                         a: tup.0,
7526                         b: tup.1,
7527                 }
7528         }
7529 }
7530 impl C2Tuple_BlockHashChannelManagerZ {
7531         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) {
7532                 (self.a, self.b)
7533         }
7534 }
7535 /// Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
7536 #[no_mangle]
7537 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
7538         C2Tuple_BlockHashChannelManagerZ { a, b, }
7539 }
7540
7541 #[no_mangle]
7542 /// Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
7543 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
7544 #[repr(C)]
7545 /// The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7546 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7547         /// A pointer to the contents in the success state.
7548         /// Reading from this pointer when `result_ok` is not set is undefined.
7549         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
7550         /// A pointer to the contents in the error state.
7551         /// Reading from this pointer when `result_ok` is set is undefined.
7552         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7553 }
7554 #[repr(C)]
7555 /// A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7556 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7557 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7558 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7559         /// The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7560         /// `err` or `result` depending on the state of `result_ok`.
7561         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
7562         /// Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7563         pub result_ok: bool,
7564 }
7565 #[no_mangle]
7566 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
7567 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7568         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7569                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7570                         result: Box::into_raw(Box::new(o)),
7571                 },
7572                 result_ok: true,
7573         }
7574 }
7575 #[no_mangle]
7576 /// Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
7577 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7578         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7579                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7580                         err: Box::into_raw(Box::new(e)),
7581                 },
7582                 result_ok: false,
7583         }
7584 }
7585 /// Checks if the given object is currently in the success state
7586 #[no_mangle]
7587 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool {
7588         o.result_ok
7589 }
7590 #[no_mangle]
7591 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
7592 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
7593 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7594         fn drop(&mut self) {
7595                 if self.result_ok {
7596                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7597                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7598                         }
7599                 } else {
7600                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7601                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7602                         }
7603                 }
7604         }
7605 }
7606 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7607         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7608                 let contents = if o.result_ok {
7609                         let result = unsafe { o.contents.result };
7610                         unsafe { o.contents.result = core::ptr::null_mut() };
7611                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
7612                 } else {
7613                         let err = unsafe { o.contents.err };
7614                         unsafe { o.contents.err = core::ptr::null_mut(); }
7615                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
7616                 };
7617                 Self {
7618                         contents,
7619                         result_ok: o.result_ok,
7620                 }
7621         }
7622 }
7623 #[repr(C)]
7624 /// The contents of CResult_ChannelConfigDecodeErrorZ
7625 pub union CResult_ChannelConfigDecodeErrorZPtr {
7626         /// A pointer to the contents in the success state.
7627         /// Reading from this pointer when `result_ok` is not set is undefined.
7628         pub result: *mut crate::lightning::util::config::ChannelConfig,
7629         /// A pointer to the contents in the error state.
7630         /// Reading from this pointer when `result_ok` is set is undefined.
7631         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7632 }
7633 #[repr(C)]
7634 /// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7635 /// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7636 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7637 pub struct CResult_ChannelConfigDecodeErrorZ {
7638         /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7639         /// `err` or `result` depending on the state of `result_ok`.
7640         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
7641         /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7642         pub result_ok: bool,
7643 }
7644 #[no_mangle]
7645 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7646 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
7647         CResult_ChannelConfigDecodeErrorZ {
7648                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7649                         result: Box::into_raw(Box::new(o)),
7650                 },
7651                 result_ok: true,
7652         }
7653 }
7654 #[no_mangle]
7655 /// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7656 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
7657         CResult_ChannelConfigDecodeErrorZ {
7658                 contents: CResult_ChannelConfigDecodeErrorZPtr {
7659                         err: Box::into_raw(Box::new(e)),
7660                 },
7661                 result_ok: false,
7662         }
7663 }
7664 /// Checks if the given object is currently in the success state
7665 #[no_mangle]
7666 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool {
7667         o.result_ok
7668 }
7669 #[no_mangle]
7670 /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7671 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
7672 impl Drop for CResult_ChannelConfigDecodeErrorZ {
7673         fn drop(&mut self) {
7674                 if self.result_ok {
7675                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7676                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7677                         }
7678                 } else {
7679                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7680                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7681                         }
7682                 }
7683         }
7684 }
7685 impl From<crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
7686         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::util::config::ChannelConfig, crate::lightning::ln::msgs::DecodeError>) -> Self {
7687                 let contents = if o.result_ok {
7688                         let result = unsafe { o.contents.result };
7689                         unsafe { o.contents.result = core::ptr::null_mut() };
7690                         CResult_ChannelConfigDecodeErrorZPtr { result }
7691                 } else {
7692                         let err = unsafe { o.contents.err };
7693                         unsafe { o.contents.err = core::ptr::null_mut(); }
7694                         CResult_ChannelConfigDecodeErrorZPtr { err }
7695                 };
7696                 Self {
7697                         contents,
7698                         result_ok: o.result_ok,
7699                 }
7700         }
7701 }
7702 impl Clone for CResult_ChannelConfigDecodeErrorZ {
7703         fn clone(&self) -> Self {
7704                 if self.result_ok {
7705                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
7706                                 result: Box::into_raw(Box::new(<crate::lightning::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
7707                         } }
7708                 } else {
7709                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
7710                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7711                         } }
7712                 }
7713         }
7714 }
7715 #[no_mangle]
7716 /// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7717 /// but with all dynamically-allocated buffers duplicated in new buffers.
7718 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) }
7719 #[repr(C)]
7720 /// The contents of CResult_OutPointDecodeErrorZ
7721 pub union CResult_OutPointDecodeErrorZPtr {
7722         /// A pointer to the contents in the success state.
7723         /// Reading from this pointer when `result_ok` is not set is undefined.
7724         pub result: *mut crate::lightning::chain::transaction::OutPoint,
7725         /// A pointer to the contents in the error state.
7726         /// Reading from this pointer when `result_ok` is set is undefined.
7727         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7728 }
7729 #[repr(C)]
7730 /// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7731 /// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7732 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7733 pub struct CResult_OutPointDecodeErrorZ {
7734         /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7735         /// `err` or `result` depending on the state of `result_ok`.
7736         pub contents: CResult_OutPointDecodeErrorZPtr,
7737         /// Whether this CResult_OutPointDecodeErrorZ represents a success state.
7738         pub result_ok: bool,
7739 }
7740 #[no_mangle]
7741 /// Creates a new CResult_OutPointDecodeErrorZ in the success state.
7742 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
7743         CResult_OutPointDecodeErrorZ {
7744                 contents: CResult_OutPointDecodeErrorZPtr {
7745                         result: Box::into_raw(Box::new(o)),
7746                 },
7747                 result_ok: true,
7748         }
7749 }
7750 #[no_mangle]
7751 /// Creates a new CResult_OutPointDecodeErrorZ in the error state.
7752 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
7753         CResult_OutPointDecodeErrorZ {
7754                 contents: CResult_OutPointDecodeErrorZPtr {
7755                         err: Box::into_raw(Box::new(e)),
7756                 },
7757                 result_ok: false,
7758         }
7759 }
7760 /// Checks if the given object is currently in the success state
7761 #[no_mangle]
7762 pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool {
7763         o.result_ok
7764 }
7765 #[no_mangle]
7766 /// Frees any resources used by the CResult_OutPointDecodeErrorZ.
7767 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
7768 impl Drop for CResult_OutPointDecodeErrorZ {
7769         fn drop(&mut self) {
7770                 if self.result_ok {
7771                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7772                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7773                         }
7774                 } else {
7775                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7776                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7777                         }
7778                 }
7779         }
7780 }
7781 impl From<crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
7782         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::msgs::DecodeError>) -> Self {
7783                 let contents = if o.result_ok {
7784                         let result = unsafe { o.contents.result };
7785                         unsafe { o.contents.result = core::ptr::null_mut() };
7786                         CResult_OutPointDecodeErrorZPtr { result }
7787                 } else {
7788                         let err = unsafe { o.contents.err };
7789                         unsafe { o.contents.err = core::ptr::null_mut(); }
7790                         CResult_OutPointDecodeErrorZPtr { err }
7791                 };
7792                 Self {
7793                         contents,
7794                         result_ok: o.result_ok,
7795                 }
7796         }
7797 }
7798 impl Clone for CResult_OutPointDecodeErrorZ {
7799         fn clone(&self) -> Self {
7800                 if self.result_ok {
7801                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
7802                                 result: Box::into_raw(Box::new(<crate::lightning::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
7803                         } }
7804                 } else {
7805                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
7806                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7807                         } }
7808                 }
7809         }
7810 }
7811 #[no_mangle]
7812 /// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7813 /// but with all dynamically-allocated buffers duplicated in new buffers.
7814 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) }
7815 #[repr(C)]
7816 /// An enum which can either contain a crate::lightning::ln::wire::Type or not
7817 pub enum COption_TypeZ {
7818         /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7819         Some(crate::lightning::ln::wire::Type),
7820         /// When we're in this state, this COption_TypeZ contains nothing
7821         None
7822 }
7823 impl COption_TypeZ {
7824         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
7825                 if let Self::None = self { false } else { true }
7826         }
7827         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
7828                 !self.is_some()
7829         }
7830         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type {
7831                 if let Self::Some(v) = self { v } else { unreachable!() }
7832         }
7833 }
7834 #[no_mangle]
7835 /// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
7836 pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ {
7837         COption_TypeZ::Some(o)
7838 }
7839 #[no_mangle]
7840 /// Constructs a new COption_TypeZ containing nothing
7841 pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ {
7842         COption_TypeZ::None
7843 }
7844 #[no_mangle]
7845 /// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
7846 pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { }
7847 #[repr(C)]
7848 /// The contents of CResult_COption_TypeZDecodeErrorZ
7849 pub union CResult_COption_TypeZDecodeErrorZPtr {
7850         /// A pointer to the contents in the success state.
7851         /// Reading from this pointer when `result_ok` is not set is undefined.
7852         pub result: *mut crate::c_types::derived::COption_TypeZ,
7853         /// A pointer to the contents in the error state.
7854         /// Reading from this pointer when `result_ok` is set is undefined.
7855         pub err: *mut crate::lightning::ln::msgs::DecodeError,
7856 }
7857 #[repr(C)]
7858 /// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7859 /// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7860 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7861 pub struct CResult_COption_TypeZDecodeErrorZ {
7862         /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7863         /// `err` or `result` depending on the state of `result_ok`.
7864         pub contents: CResult_COption_TypeZDecodeErrorZPtr,
7865         /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7866         pub result_ok: bool,
7867 }
7868 #[no_mangle]
7869 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
7870 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ {
7871         CResult_COption_TypeZDecodeErrorZ {
7872                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7873                         result: Box::into_raw(Box::new(o)),
7874                 },
7875                 result_ok: true,
7876         }
7877 }
7878 #[no_mangle]
7879 /// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
7880 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ {
7881         CResult_COption_TypeZDecodeErrorZ {
7882                 contents: CResult_COption_TypeZDecodeErrorZPtr {
7883                         err: Box::into_raw(Box::new(e)),
7884                 },
7885                 result_ok: false,
7886         }
7887 }
7888 /// Checks if the given object is currently in the success state
7889 #[no_mangle]
7890 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool {
7891         o.result_ok
7892 }
7893 #[no_mangle]
7894 /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
7895 pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { }
7896 impl Drop for CResult_COption_TypeZDecodeErrorZ {
7897         fn drop(&mut self) {
7898                 if self.result_ok {
7899                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7900                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7901                         }
7902                 } else {
7903                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7904                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7905                         }
7906                 }
7907         }
7908 }
7909 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_TypeZDecodeErrorZ {
7910         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_TypeZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
7911                 let contents = if o.result_ok {
7912                         let result = unsafe { o.contents.result };
7913                         unsafe { o.contents.result = core::ptr::null_mut() };
7914                         CResult_COption_TypeZDecodeErrorZPtr { result }
7915                 } else {
7916                         let err = unsafe { o.contents.err };
7917                         unsafe { o.contents.err = core::ptr::null_mut(); }
7918                         CResult_COption_TypeZDecodeErrorZPtr { err }
7919                 };
7920                 Self {
7921                         contents,
7922                         result_ok: o.result_ok,
7923                 }
7924         }
7925 }
7926 #[repr(C)]
7927 /// The contents of CResult_PaymentIdPaymentErrorZ
7928 pub union CResult_PaymentIdPaymentErrorZPtr {
7929         /// A pointer to the contents in the success state.
7930         /// Reading from this pointer when `result_ok` is not set is undefined.
7931         pub result: *mut crate::c_types::ThirtyTwoBytes,
7932         /// A pointer to the contents in the error state.
7933         /// Reading from this pointer when `result_ok` is set is undefined.
7934         pub err: *mut crate::lightning_invoice::payment::PaymentError,
7935 }
7936 #[repr(C)]
7937 /// A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7938 /// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7939 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
7940 pub struct CResult_PaymentIdPaymentErrorZ {
7941         /// The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7942         /// `err` or `result` depending on the state of `result_ok`.
7943         pub contents: CResult_PaymentIdPaymentErrorZPtr,
7944         /// Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7945         pub result_ok: bool,
7946 }
7947 #[no_mangle]
7948 /// Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
7949 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentErrorZ {
7950         CResult_PaymentIdPaymentErrorZ {
7951                 contents: CResult_PaymentIdPaymentErrorZPtr {
7952                         result: Box::into_raw(Box::new(o)),
7953                 },
7954                 result_ok: true,
7955         }
7956 }
7957 #[no_mangle]
7958 /// Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
7959 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_PaymentIdPaymentErrorZ {
7960         CResult_PaymentIdPaymentErrorZ {
7961                 contents: CResult_PaymentIdPaymentErrorZPtr {
7962                         err: Box::into_raw(Box::new(e)),
7963                 },
7964                 result_ok: false,
7965         }
7966 }
7967 /// Checks if the given object is currently in the success state
7968 #[no_mangle]
7969 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool {
7970         o.result_ok
7971 }
7972 #[no_mangle]
7973 /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
7974 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { }
7975 impl Drop for CResult_PaymentIdPaymentErrorZ {
7976         fn drop(&mut self) {
7977                 if self.result_ok {
7978                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7979                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7980                         }
7981                 } else {
7982                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7983                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7984                         }
7985                 }
7986         }
7987 }
7988 impl From<crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>> for CResult_PaymentIdPaymentErrorZ {
7989         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::payment::PaymentError>) -> Self {
7990                 let contents = if o.result_ok {
7991                         let result = unsafe { o.contents.result };
7992                         unsafe { o.contents.result = core::ptr::null_mut() };
7993                         CResult_PaymentIdPaymentErrorZPtr { result }
7994                 } else {
7995                         let err = unsafe { o.contents.err };
7996                         unsafe { o.contents.err = core::ptr::null_mut(); }
7997                         CResult_PaymentIdPaymentErrorZPtr { err }
7998                 };
7999                 Self {
8000                         contents,
8001                         result_ok: o.result_ok,
8002                 }
8003         }
8004 }
8005 impl Clone for CResult_PaymentIdPaymentErrorZ {
8006         fn clone(&self) -> Self {
8007                 if self.result_ok {
8008                         Self { result_ok: true, contents: CResult_PaymentIdPaymentErrorZPtr {
8009                                 result: Box::into_raw(Box::new(<crate::c_types::ThirtyTwoBytes>::clone(unsafe { &*self.contents.result })))
8010                         } }
8011                 } else {
8012                         Self { result_ok: false, contents: CResult_PaymentIdPaymentErrorZPtr {
8013                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::payment::PaymentError>::clone(unsafe { &*self.contents.err })))
8014                         } }
8015                 }
8016         }
8017 }
8018 #[no_mangle]
8019 /// Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
8020 /// but with all dynamically-allocated buffers duplicated in new buffers.
8021 pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) }
8022 #[repr(C)]
8023 /// The contents of CResult_SiPrefixNoneZ
8024 pub union CResult_SiPrefixNoneZPtr {
8025         /// A pointer to the contents in the success state.
8026         /// Reading from this pointer when `result_ok` is not set is undefined.
8027         pub result: *mut crate::lightning_invoice::SiPrefix,
8028         /// Note that this value is always NULL, as there are no contents in the Err variant
8029         pub err: *mut core::ffi::c_void,
8030 }
8031 #[repr(C)]
8032 /// A CResult_SiPrefixNoneZ represents the result of a fallible operation,
8033 /// containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
8034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8035 pub struct CResult_SiPrefixNoneZ {
8036         /// The contents of this CResult_SiPrefixNoneZ, accessible via either
8037         /// `err` or `result` depending on the state of `result_ok`.
8038         pub contents: CResult_SiPrefixNoneZPtr,
8039         /// Whether this CResult_SiPrefixNoneZ represents a success state.
8040         pub result_ok: bool,
8041 }
8042 #[no_mangle]
8043 /// Creates a new CResult_SiPrefixNoneZ in the success state.
8044 pub extern "C" fn CResult_SiPrefixNoneZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixNoneZ {
8045         CResult_SiPrefixNoneZ {
8046                 contents: CResult_SiPrefixNoneZPtr {
8047                         result: Box::into_raw(Box::new(o)),
8048                 },
8049                 result_ok: true,
8050         }
8051 }
8052 #[no_mangle]
8053 /// Creates a new CResult_SiPrefixNoneZ in the error state.
8054 pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ {
8055         CResult_SiPrefixNoneZ {
8056                 contents: CResult_SiPrefixNoneZPtr {
8057                         err: core::ptr::null_mut(),
8058                 },
8059                 result_ok: false,
8060         }
8061 }
8062 /// Checks if the given object is currently in the success state
8063 #[no_mangle]
8064 pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool {
8065         o.result_ok
8066 }
8067 #[no_mangle]
8068 /// Frees any resources used by the CResult_SiPrefixNoneZ.
8069 pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { }
8070 impl Drop for CResult_SiPrefixNoneZ {
8071         fn drop(&mut self) {
8072                 if self.result_ok {
8073                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8074                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8075                         }
8076                 } else {
8077                 }
8078         }
8079 }
8080 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>> for CResult_SiPrefixNoneZ {
8081         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SiPrefix, ()>) -> Self {
8082                 let contents = if o.result_ok {
8083                         let result = unsafe { o.contents.result };
8084                         unsafe { o.contents.result = core::ptr::null_mut() };
8085                         CResult_SiPrefixNoneZPtr { result }
8086                 } else {
8087                         let _ = unsafe { Box::from_raw(o.contents.err) };
8088                         o.contents.err = core::ptr::null_mut();
8089                         CResult_SiPrefixNoneZPtr { err: core::ptr::null_mut() }
8090                 };
8091                 Self {
8092                         contents,
8093                         result_ok: o.result_ok,
8094                 }
8095         }
8096 }
8097 impl Clone for CResult_SiPrefixNoneZ {
8098         fn clone(&self) -> Self {
8099                 if self.result_ok {
8100                         Self { result_ok: true, contents: CResult_SiPrefixNoneZPtr {
8101                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SiPrefix>::clone(unsafe { &*self.contents.result })))
8102                         } }
8103                 } else {
8104                         Self { result_ok: false, contents: CResult_SiPrefixNoneZPtr {
8105                                 err: core::ptr::null_mut()
8106                         } }
8107                 }
8108         }
8109 }
8110 #[no_mangle]
8111 /// Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
8112 /// but with all dynamically-allocated buffers duplicated in new buffers.
8113 pub extern "C" fn CResult_SiPrefixNoneZ_clone(orig: &CResult_SiPrefixNoneZ) -> CResult_SiPrefixNoneZ { Clone::clone(&orig) }
8114 #[repr(C)]
8115 /// The contents of CResult_InvoiceNoneZ
8116 pub union CResult_InvoiceNoneZPtr {
8117         /// A pointer to the contents in the success state.
8118         /// Reading from this pointer when `result_ok` is not set is undefined.
8119         pub result: *mut crate::lightning_invoice::Invoice,
8120         /// Note that this value is always NULL, as there are no contents in the Err variant
8121         pub err: *mut core::ffi::c_void,
8122 }
8123 #[repr(C)]
8124 /// A CResult_InvoiceNoneZ represents the result of a fallible operation,
8125 /// containing a crate::lightning_invoice::Invoice on success and a () on failure.
8126 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8127 pub struct CResult_InvoiceNoneZ {
8128         /// The contents of this CResult_InvoiceNoneZ, accessible via either
8129         /// `err` or `result` depending on the state of `result_ok`.
8130         pub contents: CResult_InvoiceNoneZPtr,
8131         /// Whether this CResult_InvoiceNoneZ represents a success state.
8132         pub result_ok: bool,
8133 }
8134 #[no_mangle]
8135 /// Creates a new CResult_InvoiceNoneZ in the success state.
8136 pub extern "C" fn CResult_InvoiceNoneZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceNoneZ {
8137         CResult_InvoiceNoneZ {
8138                 contents: CResult_InvoiceNoneZPtr {
8139                         result: Box::into_raw(Box::new(o)),
8140                 },
8141                 result_ok: true,
8142         }
8143 }
8144 #[no_mangle]
8145 /// Creates a new CResult_InvoiceNoneZ in the error state.
8146 pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ {
8147         CResult_InvoiceNoneZ {
8148                 contents: CResult_InvoiceNoneZPtr {
8149                         err: core::ptr::null_mut(),
8150                 },
8151                 result_ok: false,
8152         }
8153 }
8154 /// Checks if the given object is currently in the success state
8155 #[no_mangle]
8156 pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool {
8157         o.result_ok
8158 }
8159 #[no_mangle]
8160 /// Frees any resources used by the CResult_InvoiceNoneZ.
8161 pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { }
8162 impl Drop for CResult_InvoiceNoneZ {
8163         fn drop(&mut self) {
8164                 if self.result_ok {
8165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8167                         }
8168                 } else {
8169                 }
8170         }
8171 }
8172 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>> for CResult_InvoiceNoneZ {
8173         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, ()>) -> Self {
8174                 let contents = if o.result_ok {
8175                         let result = unsafe { o.contents.result };
8176                         unsafe { o.contents.result = core::ptr::null_mut() };
8177                         CResult_InvoiceNoneZPtr { result }
8178                 } else {
8179                         let _ = unsafe { Box::from_raw(o.contents.err) };
8180                         o.contents.err = core::ptr::null_mut();
8181                         CResult_InvoiceNoneZPtr { err: core::ptr::null_mut() }
8182                 };
8183                 Self {
8184                         contents,
8185                         result_ok: o.result_ok,
8186                 }
8187         }
8188 }
8189 impl Clone for CResult_InvoiceNoneZ {
8190         fn clone(&self) -> Self {
8191                 if self.result_ok {
8192                         Self { result_ok: true, contents: CResult_InvoiceNoneZPtr {
8193                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8194                         } }
8195                 } else {
8196                         Self { result_ok: false, contents: CResult_InvoiceNoneZPtr {
8197                                 err: core::ptr::null_mut()
8198                         } }
8199                 }
8200         }
8201 }
8202 #[no_mangle]
8203 /// Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
8204 /// but with all dynamically-allocated buffers duplicated in new buffers.
8205 pub extern "C" fn CResult_InvoiceNoneZ_clone(orig: &CResult_InvoiceNoneZ) -> CResult_InvoiceNoneZ { Clone::clone(&orig) }
8206 #[repr(C)]
8207 /// The contents of CResult_SignedRawInvoiceNoneZ
8208 pub union CResult_SignedRawInvoiceNoneZPtr {
8209         /// A pointer to the contents in the success state.
8210         /// Reading from this pointer when `result_ok` is not set is undefined.
8211         pub result: *mut crate::lightning_invoice::SignedRawInvoice,
8212         /// Note that this value is always NULL, as there are no contents in the Err variant
8213         pub err: *mut core::ffi::c_void,
8214 }
8215 #[repr(C)]
8216 /// A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
8217 /// containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
8218 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8219 pub struct CResult_SignedRawInvoiceNoneZ {
8220         /// The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
8221         /// `err` or `result` depending on the state of `result_ok`.
8222         pub contents: CResult_SignedRawInvoiceNoneZPtr,
8223         /// Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
8224         pub result_ok: bool,
8225 }
8226 #[no_mangle]
8227 /// Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
8228 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceNoneZ {
8229         CResult_SignedRawInvoiceNoneZ {
8230                 contents: CResult_SignedRawInvoiceNoneZPtr {
8231                         result: Box::into_raw(Box::new(o)),
8232                 },
8233                 result_ok: true,
8234         }
8235 }
8236 #[no_mangle]
8237 /// Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
8238 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoiceNoneZ {
8239         CResult_SignedRawInvoiceNoneZ {
8240                 contents: CResult_SignedRawInvoiceNoneZPtr {
8241                         err: core::ptr::null_mut(),
8242                 },
8243                 result_ok: false,
8244         }
8245 }
8246 /// Checks if the given object is currently in the success state
8247 #[no_mangle]
8248 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool {
8249         o.result_ok
8250 }
8251 #[no_mangle]
8252 /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
8253 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { }
8254 impl Drop for CResult_SignedRawInvoiceNoneZ {
8255         fn drop(&mut self) {
8256                 if self.result_ok {
8257                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8258                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8259                         }
8260                 } else {
8261                 }
8262         }
8263 }
8264 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>> for CResult_SignedRawInvoiceNoneZ {
8265         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::SignedRawInvoice, ()>) -> Self {
8266                 let contents = if o.result_ok {
8267                         let result = unsafe { o.contents.result };
8268                         unsafe { o.contents.result = core::ptr::null_mut() };
8269                         CResult_SignedRawInvoiceNoneZPtr { result }
8270                 } else {
8271                         let _ = unsafe { Box::from_raw(o.contents.err) };
8272                         o.contents.err = core::ptr::null_mut();
8273                         CResult_SignedRawInvoiceNoneZPtr { err: core::ptr::null_mut() }
8274                 };
8275                 Self {
8276                         contents,
8277                         result_ok: o.result_ok,
8278                 }
8279         }
8280 }
8281 impl Clone for CResult_SignedRawInvoiceNoneZ {
8282         fn clone(&self) -> Self {
8283                 if self.result_ok {
8284                         Self { result_ok: true, contents: CResult_SignedRawInvoiceNoneZPtr {
8285                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::SignedRawInvoice>::clone(unsafe { &*self.contents.result })))
8286                         } }
8287                 } else {
8288                         Self { result_ok: false, contents: CResult_SignedRawInvoiceNoneZPtr {
8289                                 err: core::ptr::null_mut()
8290                         } }
8291                 }
8292         }
8293 }
8294 #[no_mangle]
8295 /// Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
8296 /// but with all dynamically-allocated buffers duplicated in new buffers.
8297 pub extern "C" fn CResult_SignedRawInvoiceNoneZ_clone(orig: &CResult_SignedRawInvoiceNoneZ) -> CResult_SignedRawInvoiceNoneZ { Clone::clone(&orig) }
8298 #[repr(C)]
8299 /// A tuple of 3 elements. See the individual fields for the types contained.
8300 pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8301         /// The element at position 0
8302         pub a: crate::lightning_invoice::RawInvoice,
8303         /// The element at position 1
8304         pub b: crate::c_types::ThirtyTwoBytes,
8305         /// The element at position 2
8306         pub c: crate::lightning_invoice::InvoiceSignature,
8307 }
8308 impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8309         fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self {
8310                 Self {
8311                         a: tup.0,
8312                         b: tup.1,
8313                         c: tup.2,
8314                 }
8315         }
8316 }
8317 impl C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8318         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) {
8319                 (self.a, self.b, self.c)
8320         }
8321 }
8322 impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ {
8323         fn clone(&self) -> Self {
8324                 Self {
8325                         a: Clone::clone(&self.a),
8326                         b: Clone::clone(&self.b),
8327                         c: Clone::clone(&self.c),
8328                 }
8329         }
8330 }
8331 #[no_mangle]
8332 /// Creates a new tuple which has the same data as `orig`
8333 /// but with all dynamically-allocated buffers duplicated in new buffers.
8334 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) }
8335 /// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
8336 #[no_mangle]
8337 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 {
8338         C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, }
8339 }
8340
8341 #[no_mangle]
8342 /// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
8343 pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { }
8344 #[repr(C)]
8345 /// The contents of CResult_PayeePubKeyErrorZ
8346 pub union CResult_PayeePubKeyErrorZPtr {
8347         /// A pointer to the contents in the success state.
8348         /// Reading from this pointer when `result_ok` is not set is undefined.
8349         pub result: *mut crate::lightning_invoice::PayeePubKey,
8350         /// A pointer to the contents in the error state.
8351         /// Reading from this pointer when `result_ok` is set is undefined.
8352         pub err: *mut crate::c_types::Secp256k1Error,
8353 }
8354 #[repr(C)]
8355 /// A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8356 /// containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8358 pub struct CResult_PayeePubKeyErrorZ {
8359         /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8360         /// `err` or `result` depending on the state of `result_ok`.
8361         pub contents: CResult_PayeePubKeyErrorZPtr,
8362         /// Whether this CResult_PayeePubKeyErrorZ represents a success state.
8363         pub result_ok: bool,
8364 }
8365 #[no_mangle]
8366 /// Creates a new CResult_PayeePubKeyErrorZ in the success state.
8367 pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ {
8368         CResult_PayeePubKeyErrorZ {
8369                 contents: CResult_PayeePubKeyErrorZPtr {
8370                         result: Box::into_raw(Box::new(o)),
8371                 },
8372                 result_ok: true,
8373         }
8374 }
8375 #[no_mangle]
8376 /// Creates a new CResult_PayeePubKeyErrorZ in the error state.
8377 pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ {
8378         CResult_PayeePubKeyErrorZ {
8379                 contents: CResult_PayeePubKeyErrorZPtr {
8380                         err: Box::into_raw(Box::new(e)),
8381                 },
8382                 result_ok: false,
8383         }
8384 }
8385 /// Checks if the given object is currently in the success state
8386 #[no_mangle]
8387 pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool {
8388         o.result_ok
8389 }
8390 #[no_mangle]
8391 /// Frees any resources used by the CResult_PayeePubKeyErrorZ.
8392 pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { }
8393 impl Drop for CResult_PayeePubKeyErrorZ {
8394         fn drop(&mut self) {
8395                 if self.result_ok {
8396                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8397                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8398                         }
8399                 } else {
8400                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8401                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8402                         }
8403                 }
8404         }
8405 }
8406 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>> for CResult_PayeePubKeyErrorZ {
8407         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PayeePubKey, crate::c_types::Secp256k1Error>) -> Self {
8408                 let contents = if o.result_ok {
8409                         let result = unsafe { o.contents.result };
8410                         unsafe { o.contents.result = core::ptr::null_mut() };
8411                         CResult_PayeePubKeyErrorZPtr { result }
8412                 } else {
8413                         let err = unsafe { o.contents.err };
8414                         unsafe { o.contents.err = core::ptr::null_mut(); }
8415                         CResult_PayeePubKeyErrorZPtr { err }
8416                 };
8417                 Self {
8418                         contents,
8419                         result_ok: o.result_ok,
8420                 }
8421         }
8422 }
8423 impl Clone for CResult_PayeePubKeyErrorZ {
8424         fn clone(&self) -> Self {
8425                 if self.result_ok {
8426                         Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr {
8427                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PayeePubKey>::clone(unsafe { &*self.contents.result })))
8428                         } }
8429                 } else {
8430                         Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr {
8431                                 err: Box::into_raw(Box::new(<crate::c_types::Secp256k1Error>::clone(unsafe { &*self.contents.err })))
8432                         } }
8433                 }
8434         }
8435 }
8436 #[no_mangle]
8437 /// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
8438 /// but with all dynamically-allocated buffers duplicated in new buffers.
8439 pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) }
8440 #[repr(C)]
8441 /// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8442 /// This corresponds to std::vector in C++
8443 pub struct CVec_PrivateRouteZ {
8444         /// The elements in the array.
8445         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8446         pub data: *mut crate::lightning_invoice::PrivateRoute,
8447         /// The number of elements pointed to by `data`.
8448         pub datalen: usize
8449 }
8450 impl CVec_PrivateRouteZ {
8451         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning_invoice::PrivateRoute> {
8452                 if self.datalen == 0 { return Vec::new(); }
8453                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
8454                 self.data = core::ptr::null_mut();
8455                 self.datalen = 0;
8456                 ret
8457         }
8458         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] {
8459                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
8460         }
8461 }
8462 impl From<Vec<crate::lightning_invoice::PrivateRoute>> for CVec_PrivateRouteZ {
8463         fn from(v: Vec<crate::lightning_invoice::PrivateRoute>) -> Self {
8464                 let datalen = v.len();
8465                 let data = Box::into_raw(v.into_boxed_slice());
8466                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
8467         }
8468 }
8469 #[no_mangle]
8470 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
8471 pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { }
8472 impl Drop for CVec_PrivateRouteZ {
8473         fn drop(&mut self) {
8474                 if self.datalen == 0 { return; }
8475                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
8476         }
8477 }
8478 impl Clone for CVec_PrivateRouteZ {
8479         fn clone(&self) -> Self {
8480                 let mut res = Vec::new();
8481                 if self.datalen == 0 { return Self::from(res); }
8482                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
8483                 Self::from(res)
8484         }
8485 }
8486 #[repr(C)]
8487 /// The contents of CResult_PositiveTimestampCreationErrorZ
8488 pub union CResult_PositiveTimestampCreationErrorZPtr {
8489         /// A pointer to the contents in the success state.
8490         /// Reading from this pointer when `result_ok` is not set is undefined.
8491         pub result: *mut crate::lightning_invoice::PositiveTimestamp,
8492         /// A pointer to the contents in the error state.
8493         /// Reading from this pointer when `result_ok` is set is undefined.
8494         pub err: *mut crate::lightning_invoice::CreationError,
8495 }
8496 #[repr(C)]
8497 /// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8498 /// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8499 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8500 pub struct CResult_PositiveTimestampCreationErrorZ {
8501         /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8502         /// `err` or `result` depending on the state of `result_ok`.
8503         pub contents: CResult_PositiveTimestampCreationErrorZPtr,
8504         /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8505         pub result_ok: bool,
8506 }
8507 #[no_mangle]
8508 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
8509 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ {
8510         CResult_PositiveTimestampCreationErrorZ {
8511                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8512                         result: Box::into_raw(Box::new(o)),
8513                 },
8514                 result_ok: true,
8515         }
8516 }
8517 #[no_mangle]
8518 /// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
8519 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ {
8520         CResult_PositiveTimestampCreationErrorZ {
8521                 contents: CResult_PositiveTimestampCreationErrorZPtr {
8522                         err: Box::into_raw(Box::new(e)),
8523                 },
8524                 result_ok: false,
8525         }
8526 }
8527 /// Checks if the given object is currently in the success state
8528 #[no_mangle]
8529 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool {
8530         o.result_ok
8531 }
8532 #[no_mangle]
8533 /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
8534 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { }
8535 impl Drop for CResult_PositiveTimestampCreationErrorZ {
8536         fn drop(&mut self) {
8537                 if self.result_ok {
8538                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8539                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8540                         }
8541                 } else {
8542                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8543                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8544                         }
8545                 }
8546         }
8547 }
8548 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>> for CResult_PositiveTimestampCreationErrorZ {
8549         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PositiveTimestamp, crate::lightning_invoice::CreationError>) -> Self {
8550                 let contents = if o.result_ok {
8551                         let result = unsafe { o.contents.result };
8552                         unsafe { o.contents.result = core::ptr::null_mut() };
8553                         CResult_PositiveTimestampCreationErrorZPtr { result }
8554                 } else {
8555                         let err = unsafe { o.contents.err };
8556                         unsafe { o.contents.err = core::ptr::null_mut(); }
8557                         CResult_PositiveTimestampCreationErrorZPtr { err }
8558                 };
8559                 Self {
8560                         contents,
8561                         result_ok: o.result_ok,
8562                 }
8563         }
8564 }
8565 impl Clone for CResult_PositiveTimestampCreationErrorZ {
8566         fn clone(&self) -> Self {
8567                 if self.result_ok {
8568                         Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr {
8569                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PositiveTimestamp>::clone(unsafe { &*self.contents.result })))
8570                         } }
8571                 } else {
8572                         Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr {
8573                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8574                         } }
8575                 }
8576         }
8577 }
8578 #[no_mangle]
8579 /// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
8580 /// but with all dynamically-allocated buffers duplicated in new buffers.
8581 pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) }
8582 #[repr(C)]
8583 /// The contents of CResult_NoneSemanticErrorZ
8584 pub union CResult_NoneSemanticErrorZPtr {
8585         /// Note that this value is always NULL, as there are no contents in the OK variant
8586         pub result: *mut core::ffi::c_void,
8587         /// A pointer to the contents in the error state.
8588         /// Reading from this pointer when `result_ok` is set is undefined.
8589         pub err: *mut crate::lightning_invoice::SemanticError,
8590 }
8591 #[repr(C)]
8592 /// A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8593 /// containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8594 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8595 pub struct CResult_NoneSemanticErrorZ {
8596         /// The contents of this CResult_NoneSemanticErrorZ, accessible via either
8597         /// `err` or `result` depending on the state of `result_ok`.
8598         pub contents: CResult_NoneSemanticErrorZPtr,
8599         /// Whether this CResult_NoneSemanticErrorZ represents a success state.
8600         pub result_ok: bool,
8601 }
8602 #[no_mangle]
8603 /// Creates a new CResult_NoneSemanticErrorZ in the success state.
8604 pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ {
8605         CResult_NoneSemanticErrorZ {
8606                 contents: CResult_NoneSemanticErrorZPtr {
8607                         result: core::ptr::null_mut(),
8608                 },
8609                 result_ok: true,
8610         }
8611 }
8612 #[no_mangle]
8613 /// Creates a new CResult_NoneSemanticErrorZ in the error state.
8614 pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ {
8615         CResult_NoneSemanticErrorZ {
8616                 contents: CResult_NoneSemanticErrorZPtr {
8617                         err: Box::into_raw(Box::new(e)),
8618                 },
8619                 result_ok: false,
8620         }
8621 }
8622 /// Checks if the given object is currently in the success state
8623 #[no_mangle]
8624 pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool {
8625         o.result_ok
8626 }
8627 #[no_mangle]
8628 /// Frees any resources used by the CResult_NoneSemanticErrorZ.
8629 pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { }
8630 impl Drop for CResult_NoneSemanticErrorZ {
8631         fn drop(&mut self) {
8632                 if self.result_ok {
8633                 } else {
8634                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8635                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8636                         }
8637                 }
8638         }
8639 }
8640 impl From<crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>> for CResult_NoneSemanticErrorZ {
8641         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self {
8642                 let contents = if o.result_ok {
8643                         let _ = unsafe { Box::from_raw(o.contents.result) };
8644                         o.contents.result = core::ptr::null_mut();
8645                         CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() }
8646                 } else {
8647                         let err = unsafe { o.contents.err };
8648                         unsafe { o.contents.err = core::ptr::null_mut(); }
8649                         CResult_NoneSemanticErrorZPtr { err }
8650                 };
8651                 Self {
8652                         contents,
8653                         result_ok: o.result_ok,
8654                 }
8655         }
8656 }
8657 impl Clone for CResult_NoneSemanticErrorZ {
8658         fn clone(&self) -> Self {
8659                 if self.result_ok {
8660                         Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr {
8661                                 result: core::ptr::null_mut()
8662                         } }
8663                 } else {
8664                         Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr {
8665                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8666                         } }
8667                 }
8668         }
8669 }
8670 #[no_mangle]
8671 /// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
8672 /// but with all dynamically-allocated buffers duplicated in new buffers.
8673 pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) }
8674 #[repr(C)]
8675 /// The contents of CResult_InvoiceSemanticErrorZ
8676 pub union CResult_InvoiceSemanticErrorZPtr {
8677         /// A pointer to the contents in the success state.
8678         /// Reading from this pointer when `result_ok` is not set is undefined.
8679         pub result: *mut crate::lightning_invoice::Invoice,
8680         /// A pointer to the contents in the error state.
8681         /// Reading from this pointer when `result_ok` is set is undefined.
8682         pub err: *mut crate::lightning_invoice::SemanticError,
8683 }
8684 #[repr(C)]
8685 /// A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8686 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8687 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8688 pub struct CResult_InvoiceSemanticErrorZ {
8689         /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8690         /// `err` or `result` depending on the state of `result_ok`.
8691         pub contents: CResult_InvoiceSemanticErrorZPtr,
8692         /// Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8693         pub result_ok: bool,
8694 }
8695 #[no_mangle]
8696 /// Creates a new CResult_InvoiceSemanticErrorZ in the success state.
8697 pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ {
8698         CResult_InvoiceSemanticErrorZ {
8699                 contents: CResult_InvoiceSemanticErrorZPtr {
8700                         result: Box::into_raw(Box::new(o)),
8701                 },
8702                 result_ok: true,
8703         }
8704 }
8705 #[no_mangle]
8706 /// Creates a new CResult_InvoiceSemanticErrorZ in the error state.
8707 pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ {
8708         CResult_InvoiceSemanticErrorZ {
8709                 contents: CResult_InvoiceSemanticErrorZPtr {
8710                         err: Box::into_raw(Box::new(e)),
8711                 },
8712                 result_ok: false,
8713         }
8714 }
8715 /// Checks if the given object is currently in the success state
8716 #[no_mangle]
8717 pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool {
8718         o.result_ok
8719 }
8720 #[no_mangle]
8721 /// Frees any resources used by the CResult_InvoiceSemanticErrorZ.
8722 pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { }
8723 impl Drop for CResult_InvoiceSemanticErrorZ {
8724         fn drop(&mut self) {
8725                 if self.result_ok {
8726                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8727                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8728                         }
8729                 } else {
8730                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8731                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8732                         }
8733                 }
8734         }
8735 }
8736 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>> for CResult_InvoiceSemanticErrorZ {
8737         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SemanticError>) -> Self {
8738                 let contents = if o.result_ok {
8739                         let result = unsafe { o.contents.result };
8740                         unsafe { o.contents.result = core::ptr::null_mut() };
8741                         CResult_InvoiceSemanticErrorZPtr { result }
8742                 } else {
8743                         let err = unsafe { o.contents.err };
8744                         unsafe { o.contents.err = core::ptr::null_mut(); }
8745                         CResult_InvoiceSemanticErrorZPtr { err }
8746                 };
8747                 Self {
8748                         contents,
8749                         result_ok: o.result_ok,
8750                 }
8751         }
8752 }
8753 impl Clone for CResult_InvoiceSemanticErrorZ {
8754         fn clone(&self) -> Self {
8755                 if self.result_ok {
8756                         Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr {
8757                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
8758                         } }
8759                 } else {
8760                         Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr {
8761                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SemanticError>::clone(unsafe { &*self.contents.err })))
8762                         } }
8763                 }
8764         }
8765 }
8766 #[no_mangle]
8767 /// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
8768 /// but with all dynamically-allocated buffers duplicated in new buffers.
8769 pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) }
8770 #[repr(C)]
8771 /// The contents of CResult_DescriptionCreationErrorZ
8772 pub union CResult_DescriptionCreationErrorZPtr {
8773         /// A pointer to the contents in the success state.
8774         /// Reading from this pointer when `result_ok` is not set is undefined.
8775         pub result: *mut crate::lightning_invoice::Description,
8776         /// A pointer to the contents in the error state.
8777         /// Reading from this pointer when `result_ok` is set is undefined.
8778         pub err: *mut crate::lightning_invoice::CreationError,
8779 }
8780 #[repr(C)]
8781 /// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8782 /// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8783 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8784 pub struct CResult_DescriptionCreationErrorZ {
8785         /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8786         /// `err` or `result` depending on the state of `result_ok`.
8787         pub contents: CResult_DescriptionCreationErrorZPtr,
8788         /// Whether this CResult_DescriptionCreationErrorZ represents a success state.
8789         pub result_ok: bool,
8790 }
8791 #[no_mangle]
8792 /// Creates a new CResult_DescriptionCreationErrorZ in the success state.
8793 pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ {
8794         CResult_DescriptionCreationErrorZ {
8795                 contents: CResult_DescriptionCreationErrorZPtr {
8796                         result: Box::into_raw(Box::new(o)),
8797                 },
8798                 result_ok: true,
8799         }
8800 }
8801 #[no_mangle]
8802 /// Creates a new CResult_DescriptionCreationErrorZ in the error state.
8803 pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ {
8804         CResult_DescriptionCreationErrorZ {
8805                 contents: CResult_DescriptionCreationErrorZPtr {
8806                         err: Box::into_raw(Box::new(e)),
8807                 },
8808                 result_ok: false,
8809         }
8810 }
8811 /// Checks if the given object is currently in the success state
8812 #[no_mangle]
8813 pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool {
8814         o.result_ok
8815 }
8816 #[no_mangle]
8817 /// Frees any resources used by the CResult_DescriptionCreationErrorZ.
8818 pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { }
8819 impl Drop for CResult_DescriptionCreationErrorZ {
8820         fn drop(&mut self) {
8821                 if self.result_ok {
8822                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8823                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8824                         }
8825                 } else {
8826                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8827                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8828                         }
8829                 }
8830         }
8831 }
8832 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>> for CResult_DescriptionCreationErrorZ {
8833         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Description, crate::lightning_invoice::CreationError>) -> Self {
8834                 let contents = if o.result_ok {
8835                         let result = unsafe { o.contents.result };
8836                         unsafe { o.contents.result = core::ptr::null_mut() };
8837                         CResult_DescriptionCreationErrorZPtr { result }
8838                 } else {
8839                         let err = unsafe { o.contents.err };
8840                         unsafe { o.contents.err = core::ptr::null_mut(); }
8841                         CResult_DescriptionCreationErrorZPtr { err }
8842                 };
8843                 Self {
8844                         contents,
8845                         result_ok: o.result_ok,
8846                 }
8847         }
8848 }
8849 impl Clone for CResult_DescriptionCreationErrorZ {
8850         fn clone(&self) -> Self {
8851                 if self.result_ok {
8852                         Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr {
8853                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Description>::clone(unsafe { &*self.contents.result })))
8854                         } }
8855                 } else {
8856                         Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr {
8857                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8858                         } }
8859                 }
8860         }
8861 }
8862 #[no_mangle]
8863 /// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
8864 /// but with all dynamically-allocated buffers duplicated in new buffers.
8865 pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) }
8866 #[repr(C)]
8867 /// The contents of CResult_PrivateRouteCreationErrorZ
8868 pub union CResult_PrivateRouteCreationErrorZPtr {
8869         /// A pointer to the contents in the success state.
8870         /// Reading from this pointer when `result_ok` is not set is undefined.
8871         pub result: *mut crate::lightning_invoice::PrivateRoute,
8872         /// A pointer to the contents in the error state.
8873         /// Reading from this pointer when `result_ok` is set is undefined.
8874         pub err: *mut crate::lightning_invoice::CreationError,
8875 }
8876 #[repr(C)]
8877 /// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8878 /// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8879 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8880 pub struct CResult_PrivateRouteCreationErrorZ {
8881         /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8882         /// `err` or `result` depending on the state of `result_ok`.
8883         pub contents: CResult_PrivateRouteCreationErrorZPtr,
8884         /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8885         pub result_ok: bool,
8886 }
8887 #[no_mangle]
8888 /// Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
8889 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ {
8890         CResult_PrivateRouteCreationErrorZ {
8891                 contents: CResult_PrivateRouteCreationErrorZPtr {
8892                         result: Box::into_raw(Box::new(o)),
8893                 },
8894                 result_ok: true,
8895         }
8896 }
8897 #[no_mangle]
8898 /// Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
8899 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ {
8900         CResult_PrivateRouteCreationErrorZ {
8901                 contents: CResult_PrivateRouteCreationErrorZPtr {
8902                         err: Box::into_raw(Box::new(e)),
8903                 },
8904                 result_ok: false,
8905         }
8906 }
8907 /// Checks if the given object is currently in the success state
8908 #[no_mangle]
8909 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool {
8910         o.result_ok
8911 }
8912 #[no_mangle]
8913 /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
8914 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { }
8915 impl Drop for CResult_PrivateRouteCreationErrorZ {
8916         fn drop(&mut self) {
8917                 if self.result_ok {
8918                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
8919                                 let _ = unsafe { Box::from_raw(self.contents.result) };
8920                         }
8921                 } else {
8922                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
8923                                 let _ = unsafe { Box::from_raw(self.contents.err) };
8924                         }
8925                 }
8926         }
8927 }
8928 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>> for CResult_PrivateRouteCreationErrorZ {
8929         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::PrivateRoute, crate::lightning_invoice::CreationError>) -> Self {
8930                 let contents = if o.result_ok {
8931                         let result = unsafe { o.contents.result };
8932                         unsafe { o.contents.result = core::ptr::null_mut() };
8933                         CResult_PrivateRouteCreationErrorZPtr { result }
8934                 } else {
8935                         let err = unsafe { o.contents.err };
8936                         unsafe { o.contents.err = core::ptr::null_mut(); }
8937                         CResult_PrivateRouteCreationErrorZPtr { err }
8938                 };
8939                 Self {
8940                         contents,
8941                         result_ok: o.result_ok,
8942                 }
8943         }
8944 }
8945 impl Clone for CResult_PrivateRouteCreationErrorZ {
8946         fn clone(&self) -> Self {
8947                 if self.result_ok {
8948                         Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr {
8949                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::PrivateRoute>::clone(unsafe { &*self.contents.result })))
8950                         } }
8951                 } else {
8952                         Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr {
8953                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::CreationError>::clone(unsafe { &*self.contents.err })))
8954                         } }
8955                 }
8956         }
8957 }
8958 #[no_mangle]
8959 /// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
8960 /// but with all dynamically-allocated buffers duplicated in new buffers.
8961 pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) }
8962 #[repr(C)]
8963 /// The contents of CResult_StringErrorZ
8964 pub union CResult_StringErrorZPtr {
8965         /// A pointer to the contents in the success state.
8966         /// Reading from this pointer when `result_ok` is not set is undefined.
8967         pub result: *mut crate::c_types::Str,
8968         /// A pointer to the contents in the error state.
8969         /// Reading from this pointer when `result_ok` is set is undefined.
8970         pub err: *mut crate::c_types::Secp256k1Error,
8971 }
8972 #[repr(C)]
8973 /// A CResult_StringErrorZ represents the result of a fallible operation,
8974 /// containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8975 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
8976 pub struct CResult_StringErrorZ {
8977         /// The contents of this CResult_StringErrorZ, accessible via either
8978         /// `err` or `result` depending on the state of `result_ok`.
8979         pub contents: CResult_StringErrorZPtr,
8980         /// Whether this CResult_StringErrorZ represents a success state.
8981         pub result_ok: bool,
8982 }
8983 #[no_mangle]
8984 /// Creates a new CResult_StringErrorZ in the success state.
8985 pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ {
8986         CResult_StringErrorZ {
8987                 contents: CResult_StringErrorZPtr {
8988                         result: Box::into_raw(Box::new(o)),
8989                 },
8990                 result_ok: true,
8991         }
8992 }
8993 #[no_mangle]
8994 /// Creates a new CResult_StringErrorZ in the error state.
8995 pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ {
8996         CResult_StringErrorZ {
8997                 contents: CResult_StringErrorZPtr {
8998                         err: Box::into_raw(Box::new(e)),
8999                 },
9000                 result_ok: false,
9001         }
9002 }
9003 /// Checks if the given object is currently in the success state
9004 #[no_mangle]
9005 pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool {
9006         o.result_ok
9007 }
9008 #[no_mangle]
9009 /// Frees any resources used by the CResult_StringErrorZ.
9010 pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { }
9011 impl Drop for CResult_StringErrorZ {
9012         fn drop(&mut self) {
9013                 if self.result_ok {
9014                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9015                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9016                         }
9017                 } else {
9018                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9019                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9020                         }
9021                 }
9022         }
9023 }
9024 impl From<crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>> for CResult_StringErrorZ {
9025         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Str, crate::c_types::Secp256k1Error>) -> Self {
9026                 let contents = if o.result_ok {
9027                         let result = unsafe { o.contents.result };
9028                         unsafe { o.contents.result = core::ptr::null_mut() };
9029                         CResult_StringErrorZPtr { result }
9030                 } else {
9031                         let err = unsafe { o.contents.err };
9032                         unsafe { o.contents.err = core::ptr::null_mut(); }
9033                         CResult_StringErrorZPtr { err }
9034                 };
9035                 Self {
9036                         contents,
9037                         result_ok: o.result_ok,
9038                 }
9039         }
9040 }
9041 #[repr(C)]
9042 /// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
9043 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9044         /// A pointer to the contents in the success state.
9045         /// Reading from this pointer when `result_ok` is not set is undefined.
9046         pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate,
9047         /// A pointer to the contents in the error state.
9048         /// Reading from this pointer when `result_ok` is set is undefined.
9049         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9050 }
9051 #[repr(C)]
9052 /// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
9053 /// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9054 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9055 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
9056         /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
9057         /// `err` or `result` depending on the state of `result_ok`.
9058         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
9059         /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
9060         pub result_ok: bool,
9061 }
9062 #[no_mangle]
9063 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
9064 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9065         CResult_ChannelMonitorUpdateDecodeErrorZ {
9066                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9067                         result: Box::into_raw(Box::new(o)),
9068                 },
9069                 result_ok: true,
9070         }
9071 }
9072 #[no_mangle]
9073 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
9074 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
9075         CResult_ChannelMonitorUpdateDecodeErrorZ {
9076                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9077                         err: Box::into_raw(Box::new(e)),
9078                 },
9079                 result_ok: false,
9080         }
9081 }
9082 /// Checks if the given object is currently in the success state
9083 #[no_mangle]
9084 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool {
9085         o.result_ok
9086 }
9087 #[no_mangle]
9088 /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
9089 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
9090 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
9091         fn drop(&mut self) {
9092                 if self.result_ok {
9093                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9094                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9095                         }
9096                 } else {
9097                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9098                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9099                         }
9100                 }
9101         }
9102 }
9103 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
9104         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9105                 let contents = if o.result_ok {
9106                         let result = unsafe { o.contents.result };
9107                         unsafe { o.contents.result = core::ptr::null_mut() };
9108                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
9109                 } else {
9110                         let err = unsafe { o.contents.err };
9111                         unsafe { o.contents.err = core::ptr::null_mut(); }
9112                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
9113                 };
9114                 Self {
9115                         contents,
9116                         result_ok: o.result_ok,
9117                 }
9118         }
9119 }
9120 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
9121         fn clone(&self) -> Self {
9122                 if self.result_ok {
9123                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9124                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
9125                         } }
9126                 } else {
9127                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
9128                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9129                         } }
9130                 }
9131         }
9132 }
9133 #[no_mangle]
9134 /// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
9135 /// but with all dynamically-allocated buffers duplicated in new buffers.
9136 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) }
9137 #[repr(C)]
9138 #[derive(Clone)]
9139 /// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
9140 pub enum COption_MonitorEventZ {
9141         /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
9142         Some(crate::lightning::chain::channelmonitor::MonitorEvent),
9143         /// When we're in this state, this COption_MonitorEventZ contains nothing
9144         None
9145 }
9146 impl COption_MonitorEventZ {
9147         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
9148                 if let Self::None = self { false } else { true }
9149         }
9150         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
9151                 !self.is_some()
9152         }
9153         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent {
9154                 if let Self::Some(v) = self { v } else { unreachable!() }
9155         }
9156 }
9157 #[no_mangle]
9158 /// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
9159 pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ {
9160         COption_MonitorEventZ::Some(o)
9161 }
9162 #[no_mangle]
9163 /// Constructs a new COption_MonitorEventZ containing nothing
9164 pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ {
9165         COption_MonitorEventZ::None
9166 }
9167 #[no_mangle]
9168 /// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
9169 pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { }
9170 #[no_mangle]
9171 /// Creates a new COption_MonitorEventZ which has the same data as `orig`
9172 /// but with all dynamically-allocated buffers duplicated in new buffers.
9173 pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) }
9174 #[repr(C)]
9175 /// The contents of CResult_COption_MonitorEventZDecodeErrorZ
9176 pub union CResult_COption_MonitorEventZDecodeErrorZPtr {
9177         /// A pointer to the contents in the success state.
9178         /// Reading from this pointer when `result_ok` is not set is undefined.
9179         pub result: *mut crate::c_types::derived::COption_MonitorEventZ,
9180         /// A pointer to the contents in the error state.
9181         /// Reading from this pointer when `result_ok` is set is undefined.
9182         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9183 }
9184 #[repr(C)]
9185 /// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
9186 /// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9187 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9188 pub struct CResult_COption_MonitorEventZDecodeErrorZ {
9189         /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
9190         /// `err` or `result` depending on the state of `result_ok`.
9191         pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr,
9192         /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
9193         pub result_ok: bool,
9194 }
9195 #[no_mangle]
9196 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
9197 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ {
9198         CResult_COption_MonitorEventZDecodeErrorZ {
9199                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9200                         result: Box::into_raw(Box::new(o)),
9201                 },
9202                 result_ok: true,
9203         }
9204 }
9205 #[no_mangle]
9206 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
9207 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ {
9208         CResult_COption_MonitorEventZDecodeErrorZ {
9209                 contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9210                         err: Box::into_raw(Box::new(e)),
9211                 },
9212                 result_ok: false,
9213         }
9214 }
9215 /// Checks if the given object is currently in the success state
9216 #[no_mangle]
9217 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool {
9218         o.result_ok
9219 }
9220 #[no_mangle]
9221 /// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
9222 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { }
9223 impl Drop for CResult_COption_MonitorEventZDecodeErrorZ {
9224         fn drop(&mut self) {
9225                 if self.result_ok {
9226                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9227                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9228                         }
9229                 } else {
9230                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9231                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9232                         }
9233                 }
9234         }
9235 }
9236 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_MonitorEventZDecodeErrorZ {
9237         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_MonitorEventZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9238                 let contents = if o.result_ok {
9239                         let result = unsafe { o.contents.result };
9240                         unsafe { o.contents.result = core::ptr::null_mut() };
9241                         CResult_COption_MonitorEventZDecodeErrorZPtr { result }
9242                 } else {
9243                         let err = unsafe { o.contents.err };
9244                         unsafe { o.contents.err = core::ptr::null_mut(); }
9245                         CResult_COption_MonitorEventZDecodeErrorZPtr { err }
9246                 };
9247                 Self {
9248                         contents,
9249                         result_ok: o.result_ok,
9250                 }
9251         }
9252 }
9253 impl Clone for CResult_COption_MonitorEventZDecodeErrorZ {
9254         fn clone(&self) -> Self {
9255                 if self.result_ok {
9256                         Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9257                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_MonitorEventZ>::clone(unsafe { &*self.contents.result })))
9258                         } }
9259                 } else {
9260                         Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr {
9261                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9262                         } }
9263                 }
9264         }
9265 }
9266 #[no_mangle]
9267 /// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
9268 /// but with all dynamically-allocated buffers duplicated in new buffers.
9269 pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) }
9270 #[repr(C)]
9271 /// The contents of CResult_HTLCUpdateDecodeErrorZ
9272 pub union CResult_HTLCUpdateDecodeErrorZPtr {
9273         /// A pointer to the contents in the success state.
9274         /// Reading from this pointer when `result_ok` is not set is undefined.
9275         pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate,
9276         /// A pointer to the contents in the error state.
9277         /// Reading from this pointer when `result_ok` is set is undefined.
9278         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9279 }
9280 #[repr(C)]
9281 /// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
9282 /// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9283 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9284 pub struct CResult_HTLCUpdateDecodeErrorZ {
9285         /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
9286         /// `err` or `result` depending on the state of `result_ok`.
9287         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
9288         /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
9289         pub result_ok: bool,
9290 }
9291 #[no_mangle]
9292 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
9293 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
9294         CResult_HTLCUpdateDecodeErrorZ {
9295                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9296                         result: Box::into_raw(Box::new(o)),
9297                 },
9298                 result_ok: true,
9299         }
9300 }
9301 #[no_mangle]
9302 /// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
9303 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
9304         CResult_HTLCUpdateDecodeErrorZ {
9305                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
9306                         err: Box::into_raw(Box::new(e)),
9307                 },
9308                 result_ok: false,
9309         }
9310 }
9311 /// Checks if the given object is currently in the success state
9312 #[no_mangle]
9313 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool {
9314         o.result_ok
9315 }
9316 #[no_mangle]
9317 /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
9318 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
9319 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
9320         fn drop(&mut self) {
9321                 if self.result_ok {
9322                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9323                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9324                         }
9325                 } else {
9326                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9327                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9328                         }
9329                 }
9330         }
9331 }
9332 impl From<crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
9333         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::channelmonitor::HTLCUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
9334                 let contents = if o.result_ok {
9335                         let result = unsafe { o.contents.result };
9336                         unsafe { o.contents.result = core::ptr::null_mut() };
9337                         CResult_HTLCUpdateDecodeErrorZPtr { result }
9338                 } else {
9339                         let err = unsafe { o.contents.err };
9340                         unsafe { o.contents.err = core::ptr::null_mut(); }
9341                         CResult_HTLCUpdateDecodeErrorZPtr { err }
9342                 };
9343                 Self {
9344                         contents,
9345                         result_ok: o.result_ok,
9346                 }
9347         }
9348 }
9349 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
9350         fn clone(&self) -> Self {
9351                 if self.result_ok {
9352                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9353                                 result: Box::into_raw(Box::new(<crate::lightning::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
9354                         } }
9355                 } else {
9356                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
9357                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
9358                         } }
9359                 }
9360         }
9361 }
9362 #[no_mangle]
9363 /// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
9364 /// but with all dynamically-allocated buffers duplicated in new buffers.
9365 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) }
9366 #[repr(C)]
9367 /// A tuple of 2 elements. See the individual fields for the types contained.
9368 pub struct C2Tuple_OutPointScriptZ {
9369         /// The element at position 0
9370         pub a: crate::lightning::chain::transaction::OutPoint,
9371         /// The element at position 1
9372         pub b: crate::c_types::derived::CVec_u8Z,
9373 }
9374 impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
9375         fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
9376                 Self {
9377                         a: tup.0,
9378                         b: tup.1,
9379                 }
9380         }
9381 }
9382 impl C2Tuple_OutPointScriptZ {
9383         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
9384                 (self.a, self.b)
9385         }
9386 }
9387 impl Clone for C2Tuple_OutPointScriptZ {
9388         fn clone(&self) -> Self {
9389                 Self {
9390                         a: Clone::clone(&self.a),
9391                         b: Clone::clone(&self.b),
9392                 }
9393         }
9394 }
9395 #[no_mangle]
9396 /// Creates a new tuple which has the same data as `orig`
9397 /// but with all dynamically-allocated buffers duplicated in new buffers.
9398 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) }
9399 /// Creates a new C2Tuple_OutPointScriptZ from the contained elements.
9400 #[no_mangle]
9401 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
9402         C2Tuple_OutPointScriptZ { a, b, }
9403 }
9404
9405 #[no_mangle]
9406 /// Frees any resources used by the C2Tuple_OutPointScriptZ.
9407 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
9408 #[repr(C)]
9409 /// A tuple of 2 elements. See the individual fields for the types contained.
9410 pub struct C2Tuple_u32ScriptZ {
9411         /// The element at position 0
9412         pub a: u32,
9413         /// The element at position 1
9414         pub b: crate::c_types::derived::CVec_u8Z,
9415 }
9416 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
9417         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
9418                 Self {
9419                         a: tup.0,
9420                         b: tup.1,
9421                 }
9422         }
9423 }
9424 impl C2Tuple_u32ScriptZ {
9425         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
9426                 (self.a, self.b)
9427         }
9428 }
9429 impl Clone for C2Tuple_u32ScriptZ {
9430         fn clone(&self) -> Self {
9431                 Self {
9432                         a: Clone::clone(&self.a),
9433                         b: Clone::clone(&self.b),
9434                 }
9435         }
9436 }
9437 #[no_mangle]
9438 /// Creates a new tuple which has the same data as `orig`
9439 /// but with all dynamically-allocated buffers duplicated in new buffers.
9440 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) }
9441 /// Creates a new C2Tuple_u32ScriptZ from the contained elements.
9442 #[no_mangle]
9443 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
9444         C2Tuple_u32ScriptZ { a, b, }
9445 }
9446
9447 #[no_mangle]
9448 /// Frees any resources used by the C2Tuple_u32ScriptZ.
9449 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
9450 #[repr(C)]
9451 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9452 /// This corresponds to std::vector in C++
9453 pub struct CVec_C2Tuple_u32ScriptZZ {
9454         /// The elements in the array.
9455         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9456         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
9457         /// The number of elements pointed to by `data`.
9458         pub datalen: usize
9459 }
9460 impl CVec_C2Tuple_u32ScriptZZ {
9461         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
9462                 if self.datalen == 0 { return Vec::new(); }
9463                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9464                 self.data = core::ptr::null_mut();
9465                 self.datalen = 0;
9466                 ret
9467         }
9468         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
9469                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9470         }
9471 }
9472 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
9473         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
9474                 let datalen = v.len();
9475                 let data = Box::into_raw(v.into_boxed_slice());
9476                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9477         }
9478 }
9479 #[no_mangle]
9480 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9481 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
9482 impl Drop for CVec_C2Tuple_u32ScriptZZ {
9483         fn drop(&mut self) {
9484                 if self.datalen == 0 { return; }
9485                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9486         }
9487 }
9488 impl Clone for CVec_C2Tuple_u32ScriptZZ {
9489         fn clone(&self) -> Self {
9490                 let mut res = Vec::new();
9491                 if self.datalen == 0 { return Self::from(res); }
9492                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9493                 Self::from(res)
9494         }
9495 }
9496 #[repr(C)]
9497 /// A tuple of 2 elements. See the individual fields for the types contained.
9498 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9499         /// The element at position 0
9500         pub a: crate::c_types::ThirtyTwoBytes,
9501         /// The element at position 1
9502         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
9503 }
9504 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9505         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
9506                 Self {
9507                         a: tup.0,
9508                         b: tup.1,
9509                 }
9510         }
9511 }
9512 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9513         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
9514                 (self.a, self.b)
9515         }
9516 }
9517 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9518         fn clone(&self) -> Self {
9519                 Self {
9520                         a: Clone::clone(&self.a),
9521                         b: Clone::clone(&self.b),
9522                 }
9523         }
9524 }
9525 #[no_mangle]
9526 /// Creates a new tuple which has the same data as `orig`
9527 /// but with all dynamically-allocated buffers duplicated in new buffers.
9528 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) }
9529 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
9530 #[no_mangle]
9531 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 {
9532         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
9533 }
9534
9535 #[no_mangle]
9536 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
9537 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
9538 #[repr(C)]
9539 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9540 /// This corresponds to std::vector in C++
9541 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9542         /// The elements in the array.
9543         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9544         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
9545         /// The number of elements pointed to by `data`.
9546         pub datalen: usize
9547 }
9548 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9549         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
9550                 if self.datalen == 0 { return Vec::new(); }
9551                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9552                 self.data = core::ptr::null_mut();
9553                 self.datalen = 0;
9554                 ret
9555         }
9556         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
9557                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9558         }
9559 }
9560 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9561         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
9562                 let datalen = v.len();
9563                 let data = Box::into_raw(v.into_boxed_slice());
9564                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9565         }
9566 }
9567 #[no_mangle]
9568 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9569 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
9570 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9571         fn drop(&mut self) {
9572                 if self.datalen == 0 { return; }
9573                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9574         }
9575 }
9576 impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9577         fn clone(&self) -> Self {
9578                 let mut res = Vec::new();
9579                 if self.datalen == 0 { return Self::from(res); }
9580                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9581                 Self::from(res)
9582         }
9583 }
9584 #[repr(C)]
9585 /// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9586 /// This corresponds to std::vector in C++
9587 pub struct CVec_EventZ {
9588         /// The elements in the array.
9589         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9590         pub data: *mut crate::lightning::util::events::Event,
9591         /// The number of elements pointed to by `data`.
9592         pub datalen: usize
9593 }
9594 impl CVec_EventZ {
9595         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::util::events::Event> {
9596                 if self.datalen == 0 { return Vec::new(); }
9597                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9598                 self.data = core::ptr::null_mut();
9599                 self.datalen = 0;
9600                 ret
9601         }
9602         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] {
9603                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9604         }
9605 }
9606 impl From<Vec<crate::lightning::util::events::Event>> for CVec_EventZ {
9607         fn from(v: Vec<crate::lightning::util::events::Event>) -> Self {
9608                 let datalen = v.len();
9609                 let data = Box::into_raw(v.into_boxed_slice());
9610                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9611         }
9612 }
9613 #[no_mangle]
9614 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9615 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
9616 impl Drop for CVec_EventZ {
9617         fn drop(&mut self) {
9618                 if self.datalen == 0 { return; }
9619                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9620         }
9621 }
9622 impl Clone for CVec_EventZ {
9623         fn clone(&self) -> Self {
9624                 let mut res = Vec::new();
9625                 if self.datalen == 0 { return Self::from(res); }
9626                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9627                 Self::from(res)
9628         }
9629 }
9630 #[repr(C)]
9631 /// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9632 /// This corresponds to std::vector in C++
9633 pub struct CVec_TransactionZ {
9634         /// The elements in the array.
9635         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9636         pub data: *mut crate::c_types::Transaction,
9637         /// The number of elements pointed to by `data`.
9638         pub datalen: usize
9639 }
9640 impl CVec_TransactionZ {
9641         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
9642                 if self.datalen == 0 { return Vec::new(); }
9643                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9644                 self.data = core::ptr::null_mut();
9645                 self.datalen = 0;
9646                 ret
9647         }
9648         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
9649                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9650         }
9651 }
9652 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
9653         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
9654                 let datalen = v.len();
9655                 let data = Box::into_raw(v.into_boxed_slice());
9656                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9657         }
9658 }
9659 #[no_mangle]
9660 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9661 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
9662 impl Drop for CVec_TransactionZ {
9663         fn drop(&mut self) {
9664                 if self.datalen == 0 { return; }
9665                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9666         }
9667 }
9668 impl Clone for CVec_TransactionZ {
9669         fn clone(&self) -> Self {
9670                 let mut res = Vec::new();
9671                 if self.datalen == 0 { return Self::from(res); }
9672                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9673                 Self::from(res)
9674         }
9675 }
9676 #[repr(C)]
9677 /// A tuple of 2 elements. See the individual fields for the types contained.
9678 pub struct C2Tuple_u32TxOutZ {
9679         /// The element at position 0
9680         pub a: u32,
9681         /// The element at position 1
9682         pub b: crate::c_types::TxOut,
9683 }
9684 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
9685         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
9686                 Self {
9687                         a: tup.0,
9688                         b: tup.1,
9689                 }
9690         }
9691 }
9692 impl C2Tuple_u32TxOutZ {
9693         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
9694                 (self.a, self.b)
9695         }
9696 }
9697 impl Clone for C2Tuple_u32TxOutZ {
9698         fn clone(&self) -> Self {
9699                 Self {
9700                         a: Clone::clone(&self.a),
9701                         b: Clone::clone(&self.b),
9702                 }
9703         }
9704 }
9705 #[no_mangle]
9706 /// Creates a new tuple which has the same data as `orig`
9707 /// but with all dynamically-allocated buffers duplicated in new buffers.
9708 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) }
9709 /// Creates a new C2Tuple_u32TxOutZ from the contained elements.
9710 #[no_mangle]
9711 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
9712         C2Tuple_u32TxOutZ { a, b, }
9713 }
9714
9715 #[no_mangle]
9716 /// Frees any resources used by the C2Tuple_u32TxOutZ.
9717 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
9718 #[repr(C)]
9719 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9720 /// This corresponds to std::vector in C++
9721 pub struct CVec_C2Tuple_u32TxOutZZ {
9722         /// The elements in the array.
9723         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9724         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
9725         /// The number of elements pointed to by `data`.
9726         pub datalen: usize
9727 }
9728 impl CVec_C2Tuple_u32TxOutZZ {
9729         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
9730                 if self.datalen == 0 { return Vec::new(); }
9731                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9732                 self.data = core::ptr::null_mut();
9733                 self.datalen = 0;
9734                 ret
9735         }
9736         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
9737                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9738         }
9739 }
9740 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
9741         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
9742                 let datalen = v.len();
9743                 let data = Box::into_raw(v.into_boxed_slice());
9744                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9745         }
9746 }
9747 #[no_mangle]
9748 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9749 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
9750 impl Drop for CVec_C2Tuple_u32TxOutZZ {
9751         fn drop(&mut self) {
9752                 if self.datalen == 0 { return; }
9753                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9754         }
9755 }
9756 impl Clone for CVec_C2Tuple_u32TxOutZZ {
9757         fn clone(&self) -> Self {
9758                 let mut res = Vec::new();
9759                 if self.datalen == 0 { return Self::from(res); }
9760                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9761                 Self::from(res)
9762         }
9763 }
9764 #[repr(C)]
9765 /// A tuple of 2 elements. See the individual fields for the types contained.
9766 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9767         /// The element at position 0
9768         pub a: crate::c_types::ThirtyTwoBytes,
9769         /// The element at position 1
9770         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
9771 }
9772 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9773         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
9774                 Self {
9775                         a: tup.0,
9776                         b: tup.1,
9777                 }
9778         }
9779 }
9780 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9781         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
9782                 (self.a, self.b)
9783         }
9784 }
9785 impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9786         fn clone(&self) -> Self {
9787                 Self {
9788                         a: Clone::clone(&self.a),
9789                         b: Clone::clone(&self.b),
9790                 }
9791         }
9792 }
9793 #[no_mangle]
9794 /// Creates a new tuple which has the same data as `orig`
9795 /// but with all dynamically-allocated buffers duplicated in new buffers.
9796 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) }
9797 /// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
9798 #[no_mangle]
9799 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 {
9800         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
9801 }
9802
9803 #[no_mangle]
9804 /// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
9805 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
9806 #[repr(C)]
9807 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9808 /// This corresponds to std::vector in C++
9809 pub struct CVec_TransactionOutputsZ {
9810         /// The elements in the array.
9811         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9812         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
9813         /// The number of elements pointed to by `data`.
9814         pub datalen: usize
9815 }
9816 impl CVec_TransactionOutputsZ {
9817         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
9818                 if self.datalen == 0 { return Vec::new(); }
9819                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9820                 self.data = core::ptr::null_mut();
9821                 self.datalen = 0;
9822                 ret
9823         }
9824         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
9825                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9826         }
9827 }
9828 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_TransactionOutputsZ {
9829         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
9830                 let datalen = v.len();
9831                 let data = Box::into_raw(v.into_boxed_slice());
9832                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9833         }
9834 }
9835 #[no_mangle]
9836 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9837 pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { }
9838 impl Drop for CVec_TransactionOutputsZ {
9839         fn drop(&mut self) {
9840                 if self.datalen == 0 { return; }
9841                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9842         }
9843 }
9844 impl Clone for CVec_TransactionOutputsZ {
9845         fn clone(&self) -> Self {
9846                 let mut res = Vec::new();
9847                 if self.datalen == 0 { return Self::from(res); }
9848                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9849                 Self::from(res)
9850         }
9851 }
9852 #[repr(C)]
9853 /// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9854 /// This corresponds to std::vector in C++
9855 pub struct CVec_BalanceZ {
9856         /// The elements in the array.
9857         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9858         pub data: *mut crate::lightning::chain::channelmonitor::Balance,
9859         /// The number of elements pointed to by `data`.
9860         pub datalen: usize
9861 }
9862 impl CVec_BalanceZ {
9863         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::channelmonitor::Balance> {
9864                 if self.datalen == 0 { return Vec::new(); }
9865                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
9866                 self.data = core::ptr::null_mut();
9867                 self.datalen = 0;
9868                 ret
9869         }
9870         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] {
9871                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
9872         }
9873 }
9874 impl From<Vec<crate::lightning::chain::channelmonitor::Balance>> for CVec_BalanceZ {
9875         fn from(v: Vec<crate::lightning::chain::channelmonitor::Balance>) -> Self {
9876                 let datalen = v.len();
9877                 let data = Box::into_raw(v.into_boxed_slice());
9878                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
9879         }
9880 }
9881 #[no_mangle]
9882 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
9883 pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { }
9884 impl Drop for CVec_BalanceZ {
9885         fn drop(&mut self) {
9886                 if self.datalen == 0 { return; }
9887                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
9888         }
9889 }
9890 impl Clone for CVec_BalanceZ {
9891         fn clone(&self) -> Self {
9892                 let mut res = Vec::new();
9893                 if self.datalen == 0 { return Self::from(res); }
9894                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
9895                 Self::from(res)
9896         }
9897 }
9898 #[repr(C)]
9899 /// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9900 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9901         /// A pointer to the contents in the success state.
9902         /// Reading from this pointer when `result_ok` is not set is undefined.
9903         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
9904         /// A pointer to the contents in the error state.
9905         /// Reading from this pointer when `result_ok` is set is undefined.
9906         pub err: *mut crate::lightning::ln::msgs::DecodeError,
9907 }
9908 #[repr(C)]
9909 /// A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9910 /// containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9911 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9912 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9913         /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9914         /// `err` or `result` depending on the state of `result_ok`.
9915         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
9916         /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9917         pub result_ok: bool,
9918 }
9919 #[no_mangle]
9920 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
9921 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9922         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9923                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9924                         result: Box::into_raw(Box::new(o)),
9925                 },
9926                 result_ok: true,
9927         }
9928 }
9929 #[no_mangle]
9930 /// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
9931 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9932         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9933                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9934                         err: Box::into_raw(Box::new(e)),
9935                 },
9936                 result_ok: false,
9937         }
9938 }
9939 /// Checks if the given object is currently in the success state
9940 #[no_mangle]
9941 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool {
9942         o.result_ok
9943 }
9944 #[no_mangle]
9945 /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
9946 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
9947 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9948         fn drop(&mut self) {
9949                 if self.result_ok {
9950                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
9951                                 let _ = unsafe { Box::from_raw(self.contents.result) };
9952                         }
9953                 } else {
9954                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
9955                                 let _ = unsafe { Box::from_raw(self.contents.err) };
9956                         }
9957                 }
9958         }
9959 }
9960 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9961         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
9962                 let contents = if o.result_ok {
9963                         let result = unsafe { o.contents.result };
9964                         unsafe { o.contents.result = core::ptr::null_mut() };
9965                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
9966                 } else {
9967                         let err = unsafe { o.contents.err };
9968                         unsafe { o.contents.err = core::ptr::null_mut(); }
9969                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
9970                 };
9971                 Self {
9972                         contents,
9973                         result_ok: o.result_ok,
9974                 }
9975         }
9976 }
9977 #[repr(C)]
9978 /// The contents of CResult_NoneLightningErrorZ
9979 pub union CResult_NoneLightningErrorZPtr {
9980         /// Note that this value is always NULL, as there are no contents in the OK variant
9981         pub result: *mut core::ffi::c_void,
9982         /// A pointer to the contents in the error state.
9983         /// Reading from this pointer when `result_ok` is set is undefined.
9984         pub err: *mut crate::lightning::ln::msgs::LightningError,
9985 }
9986 #[repr(C)]
9987 /// A CResult_NoneLightningErrorZ represents the result of a fallible operation,
9988 /// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
9989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
9990 pub struct CResult_NoneLightningErrorZ {
9991         /// The contents of this CResult_NoneLightningErrorZ, accessible via either
9992         /// `err` or `result` depending on the state of `result_ok`.
9993         pub contents: CResult_NoneLightningErrorZPtr,
9994         /// Whether this CResult_NoneLightningErrorZ represents a success state.
9995         pub result_ok: bool,
9996 }
9997 #[no_mangle]
9998 /// Creates a new CResult_NoneLightningErrorZ in the success state.
9999 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
10000         CResult_NoneLightningErrorZ {
10001                 contents: CResult_NoneLightningErrorZPtr {
10002                         result: core::ptr::null_mut(),
10003                 },
10004                 result_ok: true,
10005         }
10006 }
10007 #[no_mangle]
10008 /// Creates a new CResult_NoneLightningErrorZ in the error state.
10009 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
10010         CResult_NoneLightningErrorZ {
10011                 contents: CResult_NoneLightningErrorZPtr {
10012                         err: Box::into_raw(Box::new(e)),
10013                 },
10014                 result_ok: false,
10015         }
10016 }
10017 /// Checks if the given object is currently in the success state
10018 #[no_mangle]
10019 pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool {
10020         o.result_ok
10021 }
10022 #[no_mangle]
10023 /// Frees any resources used by the CResult_NoneLightningErrorZ.
10024 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
10025 impl Drop for CResult_NoneLightningErrorZ {
10026         fn drop(&mut self) {
10027                 if self.result_ok {
10028                 } else {
10029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10031                         }
10032                 }
10033         }
10034 }
10035 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
10036         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self {
10037                 let contents = if o.result_ok {
10038                         let _ = unsafe { Box::from_raw(o.contents.result) };
10039                         o.contents.result = core::ptr::null_mut();
10040                         CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() }
10041                 } else {
10042                         let err = unsafe { o.contents.err };
10043                         unsafe { o.contents.err = core::ptr::null_mut(); }
10044                         CResult_NoneLightningErrorZPtr { err }
10045                 };
10046                 Self {
10047                         contents,
10048                         result_ok: o.result_ok,
10049                 }
10050         }
10051 }
10052 impl Clone for CResult_NoneLightningErrorZ {
10053         fn clone(&self) -> Self {
10054                 if self.result_ok {
10055                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
10056                                 result: core::ptr::null_mut()
10057                         } }
10058                 } else {
10059                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
10060                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10061                         } }
10062                 }
10063         }
10064 }
10065 #[no_mangle]
10066 /// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10067 /// but with all dynamically-allocated buffers duplicated in new buffers.
10068 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) }
10069 #[repr(C)]
10070 /// A tuple of 2 elements. See the individual fields for the types contained.
10071 pub struct C2Tuple_PublicKeyTypeZ {
10072         /// The element at position 0
10073         pub a: crate::c_types::PublicKey,
10074         /// The element at position 1
10075         pub b: crate::lightning::ln::wire::Type,
10076 }
10077 impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ {
10078         fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self {
10079                 Self {
10080                         a: tup.0,
10081                         b: tup.1,
10082                 }
10083         }
10084 }
10085 impl C2Tuple_PublicKeyTypeZ {
10086         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) {
10087                 (self.a, self.b)
10088         }
10089 }
10090 /// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
10091 #[no_mangle]
10092 pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ {
10093         C2Tuple_PublicKeyTypeZ { a, b, }
10094 }
10095
10096 #[no_mangle]
10097 /// Frees any resources used by the C2Tuple_PublicKeyTypeZ.
10098 pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { }
10099 #[repr(C)]
10100 /// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
10101 /// This corresponds to std::vector in C++
10102 pub struct CVec_C2Tuple_PublicKeyTypeZZ {
10103         /// The elements in the array.
10104         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10105         pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ,
10106         /// The number of elements pointed to by `data`.
10107         pub datalen: usize
10108 }
10109 impl CVec_C2Tuple_PublicKeyTypeZZ {
10110         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ> {
10111                 if self.datalen == 0 { return Vec::new(); }
10112                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10113                 self.data = core::ptr::null_mut();
10114                 self.datalen = 0;
10115                 ret
10116         }
10117         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] {
10118                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10119         }
10120 }
10121 impl From<Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>> for CVec_C2Tuple_PublicKeyTypeZZ {
10122         fn from(v: Vec<crate::c_types::derived::C2Tuple_PublicKeyTypeZ>) -> Self {
10123                 let datalen = v.len();
10124                 let data = Box::into_raw(v.into_boxed_slice());
10125                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10126         }
10127 }
10128 #[no_mangle]
10129 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10130 pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { }
10131 impl Drop for CVec_C2Tuple_PublicKeyTypeZZ {
10132         fn drop(&mut self) {
10133                 if self.datalen == 0 { return; }
10134                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10135         }
10136 }
10137 #[repr(C)]
10138 /// The contents of CResult_boolLightningErrorZ
10139 pub union CResult_boolLightningErrorZPtr {
10140         /// A pointer to the contents in the success state.
10141         /// Reading from this pointer when `result_ok` is not set is undefined.
10142         pub result: *mut bool,
10143         /// A pointer to the contents in the error state.
10144         /// Reading from this pointer when `result_ok` is set is undefined.
10145         pub err: *mut crate::lightning::ln::msgs::LightningError,
10146 }
10147 #[repr(C)]
10148 /// A CResult_boolLightningErrorZ represents the result of a fallible operation,
10149 /// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
10150 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10151 pub struct CResult_boolLightningErrorZ {
10152         /// The contents of this CResult_boolLightningErrorZ, accessible via either
10153         /// `err` or `result` depending on the state of `result_ok`.
10154         pub contents: CResult_boolLightningErrorZPtr,
10155         /// Whether this CResult_boolLightningErrorZ represents a success state.
10156         pub result_ok: bool,
10157 }
10158 #[no_mangle]
10159 /// Creates a new CResult_boolLightningErrorZ in the success state.
10160 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
10161         CResult_boolLightningErrorZ {
10162                 contents: CResult_boolLightningErrorZPtr {
10163                         result: Box::into_raw(Box::new(o)),
10164                 },
10165                 result_ok: true,
10166         }
10167 }
10168 #[no_mangle]
10169 /// Creates a new CResult_boolLightningErrorZ in the error state.
10170 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
10171         CResult_boolLightningErrorZ {
10172                 contents: CResult_boolLightningErrorZPtr {
10173                         err: Box::into_raw(Box::new(e)),
10174                 },
10175                 result_ok: false,
10176         }
10177 }
10178 /// Checks if the given object is currently in the success state
10179 #[no_mangle]
10180 pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool {
10181         o.result_ok
10182 }
10183 #[no_mangle]
10184 /// Frees any resources used by the CResult_boolLightningErrorZ.
10185 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
10186 impl Drop for CResult_boolLightningErrorZ {
10187         fn drop(&mut self) {
10188                 if self.result_ok {
10189                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10190                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10191                         }
10192                 } else {
10193                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10194                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10195                         }
10196                 }
10197         }
10198 }
10199 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
10200         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::msgs::LightningError>) -> Self {
10201                 let contents = if o.result_ok {
10202                         let result = unsafe { o.contents.result };
10203                         unsafe { o.contents.result = core::ptr::null_mut() };
10204                         CResult_boolLightningErrorZPtr { result }
10205                 } else {
10206                         let err = unsafe { o.contents.err };
10207                         unsafe { o.contents.err = core::ptr::null_mut(); }
10208                         CResult_boolLightningErrorZPtr { err }
10209                 };
10210                 Self {
10211                         contents,
10212                         result_ok: o.result_ok,
10213                 }
10214         }
10215 }
10216 impl Clone for CResult_boolLightningErrorZ {
10217         fn clone(&self) -> Self {
10218                 if self.result_ok {
10219                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
10220                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10221                         } }
10222                 } else {
10223                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
10224                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
10225                         } }
10226                 }
10227         }
10228 }
10229 #[no_mangle]
10230 /// Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10231 /// but with all dynamically-allocated buffers duplicated in new buffers.
10232 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) }
10233 #[repr(C)]
10234 /// A tuple of 3 elements. See the individual fields for the types contained.
10235 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10236         /// The element at position 0
10237         pub a: crate::lightning::ln::msgs::ChannelAnnouncement,
10238         /// The element at position 1
10239         pub b: crate::lightning::ln::msgs::ChannelUpdate,
10240         /// The element at position 2
10241         pub c: crate::lightning::ln::msgs::ChannelUpdate,
10242 }
10243 impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10244         fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self {
10245                 Self {
10246                         a: tup.0,
10247                         b: tup.1,
10248                         c: tup.2,
10249                 }
10250         }
10251 }
10252 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10253         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) {
10254                 (self.a, self.b, self.c)
10255         }
10256 }
10257 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
10258         fn clone(&self) -> Self {
10259                 Self {
10260                         a: Clone::clone(&self.a),
10261                         b: Clone::clone(&self.b),
10262                         c: Clone::clone(&self.c),
10263                 }
10264         }
10265 }
10266 #[no_mangle]
10267 /// Creates a new tuple which has the same data as `orig`
10268 /// but with all dynamically-allocated buffers duplicated in new buffers.
10269 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) }
10270 /// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10271 #[no_mangle]
10272 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 {
10273         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
10274 }
10275
10276 #[no_mangle]
10277 /// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10278 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
10279 #[repr(C)]
10280 /// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
10281 /// This corresponds to std::vector in C++
10282 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10283         /// The elements in the array.
10284         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10285         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
10286         /// The number of elements pointed to by `data`.
10287         pub datalen: usize
10288 }
10289 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10290         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
10291                 if self.datalen == 0 { return Vec::new(); }
10292                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10293                 self.data = core::ptr::null_mut();
10294                 self.datalen = 0;
10295                 ret
10296         }
10297         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
10298                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10299         }
10300 }
10301 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10302         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
10303                 let datalen = v.len();
10304                 let data = Box::into_raw(v.into_boxed_slice());
10305                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10306         }
10307 }
10308 #[no_mangle]
10309 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10310 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
10311 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10312         fn drop(&mut self) {
10313                 if self.datalen == 0 { return; }
10314                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10315         }
10316 }
10317 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
10318         fn clone(&self) -> Self {
10319                 let mut res = Vec::new();
10320                 if self.datalen == 0 { return Self::from(res); }
10321                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10322                 Self::from(res)
10323         }
10324 }
10325 #[repr(C)]
10326 /// A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
10327 /// This corresponds to std::vector in C++
10328 pub struct CVec_NodeAnnouncementZ {
10329         /// The elements in the array.
10330         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10331         pub data: *mut crate::lightning::ln::msgs::NodeAnnouncement,
10332         /// The number of elements pointed to by `data`.
10333         pub datalen: usize
10334 }
10335 impl CVec_NodeAnnouncementZ {
10336         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::NodeAnnouncement> {
10337                 if self.datalen == 0 { return Vec::new(); }
10338                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10339                 self.data = core::ptr::null_mut();
10340                 self.datalen = 0;
10341                 ret
10342         }
10343         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::NodeAnnouncement] {
10344                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10345         }
10346 }
10347 impl From<Vec<crate::lightning::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
10348         fn from(v: Vec<crate::lightning::ln::msgs::NodeAnnouncement>) -> Self {
10349                 let datalen = v.len();
10350                 let data = Box::into_raw(v.into_boxed_slice());
10351                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10352         }
10353 }
10354 #[no_mangle]
10355 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10356 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
10357 impl Drop for CVec_NodeAnnouncementZ {
10358         fn drop(&mut self) {
10359                 if self.datalen == 0 { return; }
10360                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10361         }
10362 }
10363 impl Clone for CVec_NodeAnnouncementZ {
10364         fn clone(&self) -> Self {
10365                 let mut res = Vec::new();
10366                 if self.datalen == 0 { return Self::from(res); }
10367                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10368                 Self::from(res)
10369         }
10370 }
10371 #[repr(C)]
10372 /// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
10373 /// This corresponds to std::vector in C++
10374 pub struct CVec_PublicKeyZ {
10375         /// The elements in the array.
10376         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10377         pub data: *mut crate::c_types::PublicKey,
10378         /// The number of elements pointed to by `data`.
10379         pub datalen: usize
10380 }
10381 impl CVec_PublicKeyZ {
10382         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
10383                 if self.datalen == 0 { return Vec::new(); }
10384                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
10385                 self.data = core::ptr::null_mut();
10386                 self.datalen = 0;
10387                 ret
10388         }
10389         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
10390                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
10391         }
10392 }
10393 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
10394         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
10395                 let datalen = v.len();
10396                 let data = Box::into_raw(v.into_boxed_slice());
10397                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
10398         }
10399 }
10400 #[no_mangle]
10401 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
10402 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
10403 impl Drop for CVec_PublicKeyZ {
10404         fn drop(&mut self) {
10405                 if self.datalen == 0 { return; }
10406                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
10407         }
10408 }
10409 impl Clone for CVec_PublicKeyZ {
10410         fn clone(&self) -> Self {
10411                 let mut res = Vec::new();
10412                 if self.datalen == 0 { return Self::from(res); }
10413                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
10414                 Self::from(res)
10415         }
10416 }
10417 #[repr(C)]
10418 /// The contents of CResult_CVec_u8ZPeerHandleErrorZ
10419 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
10420         /// A pointer to the contents in the success state.
10421         /// Reading from this pointer when `result_ok` is not set is undefined.
10422         pub result: *mut crate::c_types::derived::CVec_u8Z,
10423         /// A pointer to the contents in the error state.
10424         /// Reading from this pointer when `result_ok` is set is undefined.
10425         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10426 }
10427 #[repr(C)]
10428 /// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
10429 /// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10430 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10431 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
10432         /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
10433         /// `err` or `result` depending on the state of `result_ok`.
10434         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
10435         /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
10436         pub result_ok: bool,
10437 }
10438 #[no_mangle]
10439 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10440 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
10441         CResult_CVec_u8ZPeerHandleErrorZ {
10442                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10443                         result: Box::into_raw(Box::new(o)),
10444                 },
10445                 result_ok: true,
10446         }
10447 }
10448 #[no_mangle]
10449 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10450 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
10451         CResult_CVec_u8ZPeerHandleErrorZ {
10452                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10453                         err: Box::into_raw(Box::new(e)),
10454                 },
10455                 result_ok: false,
10456         }
10457 }
10458 /// Checks if the given object is currently in the success state
10459 #[no_mangle]
10460 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool {
10461         o.result_ok
10462 }
10463 #[no_mangle]
10464 /// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10465 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
10466 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
10467         fn drop(&mut self) {
10468                 if self.result_ok {
10469                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10470                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10471                         }
10472                 } else {
10473                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10474                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10475                         }
10476                 }
10477         }
10478 }
10479 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
10480         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10481                 let contents = if o.result_ok {
10482                         let result = unsafe { o.contents.result };
10483                         unsafe { o.contents.result = core::ptr::null_mut() };
10484                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
10485                 } else {
10486                         let err = unsafe { o.contents.err };
10487                         unsafe { o.contents.err = core::ptr::null_mut(); }
10488                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
10489                 };
10490                 Self {
10491                         contents,
10492                         result_ok: o.result_ok,
10493                 }
10494         }
10495 }
10496 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
10497         fn clone(&self) -> Self {
10498                 if self.result_ok {
10499                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10500                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
10501                         } }
10502                 } else {
10503                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
10504                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10505                         } }
10506                 }
10507         }
10508 }
10509 #[no_mangle]
10510 /// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10511 /// but with all dynamically-allocated buffers duplicated in new buffers.
10512 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) }
10513 #[repr(C)]
10514 /// The contents of CResult_NonePeerHandleErrorZ
10515 pub union CResult_NonePeerHandleErrorZPtr {
10516         /// Note that this value is always NULL, as there are no contents in the OK variant
10517         pub result: *mut core::ffi::c_void,
10518         /// A pointer to the contents in the error state.
10519         /// Reading from this pointer when `result_ok` is set is undefined.
10520         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10521 }
10522 #[repr(C)]
10523 /// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
10524 /// containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10525 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10526 pub struct CResult_NonePeerHandleErrorZ {
10527         /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either
10528         /// `err` or `result` depending on the state of `result_ok`.
10529         pub contents: CResult_NonePeerHandleErrorZPtr,
10530         /// Whether this CResult_NonePeerHandleErrorZ represents a success state.
10531         pub result_ok: bool,
10532 }
10533 #[no_mangle]
10534 /// Creates a new CResult_NonePeerHandleErrorZ in the success state.
10535 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
10536         CResult_NonePeerHandleErrorZ {
10537                 contents: CResult_NonePeerHandleErrorZPtr {
10538                         result: core::ptr::null_mut(),
10539                 },
10540                 result_ok: true,
10541         }
10542 }
10543 #[no_mangle]
10544 /// Creates a new CResult_NonePeerHandleErrorZ in the error state.
10545 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
10546         CResult_NonePeerHandleErrorZ {
10547                 contents: CResult_NonePeerHandleErrorZPtr {
10548                         err: Box::into_raw(Box::new(e)),
10549                 },
10550                 result_ok: false,
10551         }
10552 }
10553 /// Checks if the given object is currently in the success state
10554 #[no_mangle]
10555 pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool {
10556         o.result_ok
10557 }
10558 #[no_mangle]
10559 /// Frees any resources used by the CResult_NonePeerHandleErrorZ.
10560 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
10561 impl Drop for CResult_NonePeerHandleErrorZ {
10562         fn drop(&mut self) {
10563                 if self.result_ok {
10564                 } else {
10565                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10566                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10567                         }
10568                 }
10569         }
10570 }
10571 impl From<crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
10572         fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10573                 let contents = if o.result_ok {
10574                         let _ = unsafe { Box::from_raw(o.contents.result) };
10575                         o.contents.result = core::ptr::null_mut();
10576                         CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() }
10577                 } else {
10578                         let err = unsafe { o.contents.err };
10579                         unsafe { o.contents.err = core::ptr::null_mut(); }
10580                         CResult_NonePeerHandleErrorZPtr { err }
10581                 };
10582                 Self {
10583                         contents,
10584                         result_ok: o.result_ok,
10585                 }
10586         }
10587 }
10588 impl Clone for CResult_NonePeerHandleErrorZ {
10589         fn clone(&self) -> Self {
10590                 if self.result_ok {
10591                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
10592                                 result: core::ptr::null_mut()
10593                         } }
10594                 } else {
10595                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
10596                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10597                         } }
10598                 }
10599         }
10600 }
10601 #[no_mangle]
10602 /// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10603 /// but with all dynamically-allocated buffers duplicated in new buffers.
10604 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) }
10605 #[repr(C)]
10606 /// The contents of CResult_boolPeerHandleErrorZ
10607 pub union CResult_boolPeerHandleErrorZPtr {
10608         /// A pointer to the contents in the success state.
10609         /// Reading from this pointer when `result_ok` is not set is undefined.
10610         pub result: *mut bool,
10611         /// A pointer to the contents in the error state.
10612         /// Reading from this pointer when `result_ok` is set is undefined.
10613         pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError,
10614 }
10615 #[repr(C)]
10616 /// A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
10617 /// containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
10618 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10619 pub struct CResult_boolPeerHandleErrorZ {
10620         /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either
10621         /// `err` or `result` depending on the state of `result_ok`.
10622         pub contents: CResult_boolPeerHandleErrorZPtr,
10623         /// Whether this CResult_boolPeerHandleErrorZ represents a success state.
10624         pub result_ok: bool,
10625 }
10626 #[no_mangle]
10627 /// Creates a new CResult_boolPeerHandleErrorZ in the success state.
10628 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
10629         CResult_boolPeerHandleErrorZ {
10630                 contents: CResult_boolPeerHandleErrorZPtr {
10631                         result: Box::into_raw(Box::new(o)),
10632                 },
10633                 result_ok: true,
10634         }
10635 }
10636 #[no_mangle]
10637 /// Creates a new CResult_boolPeerHandleErrorZ in the error state.
10638 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
10639         CResult_boolPeerHandleErrorZ {
10640                 contents: CResult_boolPeerHandleErrorZPtr {
10641                         err: Box::into_raw(Box::new(e)),
10642                 },
10643                 result_ok: false,
10644         }
10645 }
10646 /// Checks if the given object is currently in the success state
10647 #[no_mangle]
10648 pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool {
10649         o.result_ok
10650 }
10651 #[no_mangle]
10652 /// Frees any resources used by the CResult_boolPeerHandleErrorZ.
10653 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
10654 impl Drop for CResult_boolPeerHandleErrorZ {
10655         fn drop(&mut self) {
10656                 if self.result_ok {
10657                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10658                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10659                         }
10660                 } else {
10661                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10662                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10663                         }
10664                 }
10665         }
10666 }
10667 impl From<crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
10668         fn from(mut o: crate::c_types::CResultTempl<bool, crate::lightning::ln::peer_handler::PeerHandleError>) -> Self {
10669                 let contents = if o.result_ok {
10670                         let result = unsafe { o.contents.result };
10671                         unsafe { o.contents.result = core::ptr::null_mut() };
10672                         CResult_boolPeerHandleErrorZPtr { result }
10673                 } else {
10674                         let err = unsafe { o.contents.err };
10675                         unsafe { o.contents.err = core::ptr::null_mut(); }
10676                         CResult_boolPeerHandleErrorZPtr { err }
10677                 };
10678                 Self {
10679                         contents,
10680                         result_ok: o.result_ok,
10681                 }
10682         }
10683 }
10684 impl Clone for CResult_boolPeerHandleErrorZ {
10685         fn clone(&self) -> Self {
10686                 if self.result_ok {
10687                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
10688                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
10689                         } }
10690                 } else {
10691                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
10692                                 err: Box::into_raw(Box::new(<crate::lightning::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
10693                         } }
10694                 }
10695         }
10696 }
10697 #[no_mangle]
10698 /// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10699 /// but with all dynamically-allocated buffers duplicated in new buffers.
10700 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) }
10701 #[repr(C)]
10702 /// The contents of CResult_NodeIdDecodeErrorZ
10703 pub union CResult_NodeIdDecodeErrorZPtr {
10704         /// A pointer to the contents in the success state.
10705         /// Reading from this pointer when `result_ok` is not set is undefined.
10706         pub result: *mut crate::lightning::routing::network_graph::NodeId,
10707         /// A pointer to the contents in the error state.
10708         /// Reading from this pointer when `result_ok` is set is undefined.
10709         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10710 }
10711 #[repr(C)]
10712 /// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
10713 /// containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
10714 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10715 pub struct CResult_NodeIdDecodeErrorZ {
10716         /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
10717         /// `err` or `result` depending on the state of `result_ok`.
10718         pub contents: CResult_NodeIdDecodeErrorZPtr,
10719         /// Whether this CResult_NodeIdDecodeErrorZ represents a success state.
10720         pub result_ok: bool,
10721 }
10722 #[no_mangle]
10723 /// Creates a new CResult_NodeIdDecodeErrorZ in the success state.
10724 pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeId) -> CResult_NodeIdDecodeErrorZ {
10725         CResult_NodeIdDecodeErrorZ {
10726                 contents: CResult_NodeIdDecodeErrorZPtr {
10727                         result: Box::into_raw(Box::new(o)),
10728                 },
10729                 result_ok: true,
10730         }
10731 }
10732 #[no_mangle]
10733 /// Creates a new CResult_NodeIdDecodeErrorZ in the error state.
10734 pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ {
10735         CResult_NodeIdDecodeErrorZ {
10736                 contents: CResult_NodeIdDecodeErrorZPtr {
10737                         err: Box::into_raw(Box::new(e)),
10738                 },
10739                 result_ok: false,
10740         }
10741 }
10742 /// Checks if the given object is currently in the success state
10743 #[no_mangle]
10744 pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool {
10745         o.result_ok
10746 }
10747 #[no_mangle]
10748 /// Frees any resources used by the CResult_NodeIdDecodeErrorZ.
10749 pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { }
10750 impl Drop for CResult_NodeIdDecodeErrorZ {
10751         fn drop(&mut self) {
10752                 if self.result_ok {
10753                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10754                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10755                         }
10756                 } else {
10757                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10758                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10759                         }
10760                 }
10761         }
10762 }
10763 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeIdDecodeErrorZ {
10764         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeId, crate::lightning::ln::msgs::DecodeError>) -> Self {
10765                 let contents = if o.result_ok {
10766                         let result = unsafe { o.contents.result };
10767                         unsafe { o.contents.result = core::ptr::null_mut() };
10768                         CResult_NodeIdDecodeErrorZPtr { result }
10769                 } else {
10770                         let err = unsafe { o.contents.err };
10771                         unsafe { o.contents.err = core::ptr::null_mut(); }
10772                         CResult_NodeIdDecodeErrorZPtr { err }
10773                 };
10774                 Self {
10775                         contents,
10776                         result_ok: o.result_ok,
10777                 }
10778         }
10779 }
10780 impl Clone for CResult_NodeIdDecodeErrorZ {
10781         fn clone(&self) -> Self {
10782                 if self.result_ok {
10783                         Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr {
10784                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeId>::clone(unsafe { &*self.contents.result })))
10785                         } }
10786                 } else {
10787                         Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr {
10788                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10789                         } }
10790                 }
10791         }
10792 }
10793 #[no_mangle]
10794 /// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
10795 /// but with all dynamically-allocated buffers duplicated in new buffers.
10796 pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) }
10797 #[repr(C)]
10798 /// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
10799 pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10800         /// A pointer to the contents in the success state.
10801         /// Reading from this pointer when `result_ok` is not set is undefined.
10802         pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ,
10803         /// A pointer to the contents in the error state.
10804         /// Reading from this pointer when `result_ok` is set is undefined.
10805         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10806 }
10807 #[repr(C)]
10808 /// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
10809 /// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
10810 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10811 pub struct CResult_COption_NetworkUpdateZDecodeErrorZ {
10812         /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
10813         /// `err` or `result` depending on the state of `result_ok`.
10814         pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr,
10815         /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
10816         pub result_ok: bool,
10817 }
10818 #[no_mangle]
10819 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
10820 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10821         CResult_COption_NetworkUpdateZDecodeErrorZ {
10822                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10823                         result: Box::into_raw(Box::new(o)),
10824                 },
10825                 result_ok: true,
10826         }
10827 }
10828 #[no_mangle]
10829 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
10830 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ {
10831         CResult_COption_NetworkUpdateZDecodeErrorZ {
10832                 contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10833                         err: Box::into_raw(Box::new(e)),
10834                 },
10835                 result_ok: false,
10836         }
10837 }
10838 /// Checks if the given object is currently in the success state
10839 #[no_mangle]
10840 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool {
10841         o.result_ok
10842 }
10843 #[no_mangle]
10844 /// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
10845 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { }
10846 impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ {
10847         fn drop(&mut self) {
10848                 if self.result_ok {
10849                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10850                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10851                         }
10852                 } else {
10853                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10854                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10855                         }
10856                 }
10857         }
10858 }
10859 impl From<crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>> for CResult_COption_NetworkUpdateZDecodeErrorZ {
10860         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::COption_NetworkUpdateZ, crate::lightning::ln::msgs::DecodeError>) -> Self {
10861                 let contents = if o.result_ok {
10862                         let result = unsafe { o.contents.result };
10863                         unsafe { o.contents.result = core::ptr::null_mut() };
10864                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { result }
10865                 } else {
10866                         let err = unsafe { o.contents.err };
10867                         unsafe { o.contents.err = core::ptr::null_mut(); }
10868                         CResult_COption_NetworkUpdateZDecodeErrorZPtr { err }
10869                 };
10870                 Self {
10871                         contents,
10872                         result_ok: o.result_ok,
10873                 }
10874         }
10875 }
10876 impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ {
10877         fn clone(&self) -> Self {
10878                 if self.result_ok {
10879                         Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10880                                 result: Box::into_raw(Box::new(<crate::c_types::derived::COption_NetworkUpdateZ>::clone(unsafe { &*self.contents.result })))
10881                         } }
10882                 } else {
10883                         Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr {
10884                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
10885                         } }
10886                 }
10887         }
10888 }
10889 #[no_mangle]
10890 /// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
10891 /// but with all dynamically-allocated buffers duplicated in new buffers.
10892 pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) }
10893 #[repr(C)]
10894 /// An enum which can either contain a crate::lightning::chain::Access or not
10895 pub enum COption_AccessZ {
10896         /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
10897         Some(crate::lightning::chain::Access),
10898         /// When we're in this state, this COption_AccessZ contains nothing
10899         None
10900 }
10901 impl COption_AccessZ {
10902         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
10903                 if let Self::None = self { false } else { true }
10904         }
10905         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
10906                 !self.is_some()
10907         }
10908         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Access {
10909                 if let Self::Some(v) = self { v } else { unreachable!() }
10910         }
10911 }
10912 #[no_mangle]
10913 /// Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
10914 pub extern "C" fn COption_AccessZ_some(o: crate::lightning::chain::Access) -> COption_AccessZ {
10915         COption_AccessZ::Some(o)
10916 }
10917 #[no_mangle]
10918 /// Constructs a new COption_AccessZ containing nothing
10919 pub extern "C" fn COption_AccessZ_none() -> COption_AccessZ {
10920         COption_AccessZ::None
10921 }
10922 #[no_mangle]
10923 /// Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
10924 pub extern "C" fn COption_AccessZ_free(_res: COption_AccessZ) { }
10925 #[repr(C)]
10926 /// The contents of CResult_ChannelUpdateInfoDecodeErrorZ
10927 pub union CResult_ChannelUpdateInfoDecodeErrorZPtr {
10928         /// A pointer to the contents in the success state.
10929         /// Reading from this pointer when `result_ok` is not set is undefined.
10930         pub result: *mut crate::lightning::routing::network_graph::ChannelUpdateInfo,
10931         /// A pointer to the contents in the error state.
10932         /// Reading from this pointer when `result_ok` is set is undefined.
10933         pub err: *mut crate::lightning::ln::msgs::DecodeError,
10934 }
10935 #[repr(C)]
10936 /// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
10937 /// containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
10938 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
10939 pub struct CResult_ChannelUpdateInfoDecodeErrorZ {
10940         /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
10941         /// `err` or `result` depending on the state of `result_ok`.
10942         pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr,
10943         /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
10944         pub result_ok: bool,
10945 }
10946 #[no_mangle]
10947 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
10948 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ {
10949         CResult_ChannelUpdateInfoDecodeErrorZ {
10950                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
10951                         result: Box::into_raw(Box::new(o)),
10952                 },
10953                 result_ok: true,
10954         }
10955 }
10956 #[no_mangle]
10957 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
10958 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ {
10959         CResult_ChannelUpdateInfoDecodeErrorZ {
10960                 contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
10961                         err: Box::into_raw(Box::new(e)),
10962                 },
10963                 result_ok: false,
10964         }
10965 }
10966 /// Checks if the given object is currently in the success state
10967 #[no_mangle]
10968 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool {
10969         o.result_ok
10970 }
10971 #[no_mangle]
10972 /// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
10973 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { }
10974 impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ {
10975         fn drop(&mut self) {
10976                 if self.result_ok {
10977                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
10978                                 let _ = unsafe { Box::from_raw(self.contents.result) };
10979                         }
10980                 } else {
10981                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
10982                                 let _ = unsafe { Box::from_raw(self.contents.err) };
10983                         }
10984                 }
10985         }
10986 }
10987 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateInfoDecodeErrorZ {
10988         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelUpdateInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
10989                 let contents = if o.result_ok {
10990                         let result = unsafe { o.contents.result };
10991                         unsafe { o.contents.result = core::ptr::null_mut() };
10992                         CResult_ChannelUpdateInfoDecodeErrorZPtr { result }
10993                 } else {
10994                         let err = unsafe { o.contents.err };
10995                         unsafe { o.contents.err = core::ptr::null_mut(); }
10996                         CResult_ChannelUpdateInfoDecodeErrorZPtr { err }
10997                 };
10998                 Self {
10999                         contents,
11000                         result_ok: o.result_ok,
11001                 }
11002         }
11003 }
11004 impl Clone for CResult_ChannelUpdateInfoDecodeErrorZ {
11005         fn clone(&self) -> Self {
11006                 if self.result_ok {
11007                         Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11008                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelUpdateInfo>::clone(unsafe { &*self.contents.result })))
11009                         } }
11010                 } else {
11011                         Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr {
11012                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11013                         } }
11014                 }
11015         }
11016 }
11017 #[no_mangle]
11018 /// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
11019 /// but with all dynamically-allocated buffers duplicated in new buffers.
11020 pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) }
11021 #[repr(C)]
11022 /// The contents of CResult_ChannelInfoDecodeErrorZ
11023 pub union CResult_ChannelInfoDecodeErrorZPtr {
11024         /// A pointer to the contents in the success state.
11025         /// Reading from this pointer when `result_ok` is not set is undefined.
11026         pub result: *mut crate::lightning::routing::network_graph::ChannelInfo,
11027         /// A pointer to the contents in the error state.
11028         /// Reading from this pointer when `result_ok` is set is undefined.
11029         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11030 }
11031 #[repr(C)]
11032 /// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
11033 /// containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11034 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11035 pub struct CResult_ChannelInfoDecodeErrorZ {
11036         /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
11037         /// `err` or `result` depending on the state of `result_ok`.
11038         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
11039         /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
11040         pub result_ok: bool,
11041 }
11042 #[no_mangle]
11043 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11044 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
11045         CResult_ChannelInfoDecodeErrorZ {
11046                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11047                         result: Box::into_raw(Box::new(o)),
11048                 },
11049                 result_ok: true,
11050         }
11051 }
11052 #[no_mangle]
11053 /// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11054 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
11055         CResult_ChannelInfoDecodeErrorZ {
11056                 contents: CResult_ChannelInfoDecodeErrorZPtr {
11057                         err: Box::into_raw(Box::new(e)),
11058                 },
11059                 result_ok: false,
11060         }
11061 }
11062 /// Checks if the given object is currently in the success state
11063 #[no_mangle]
11064 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool {
11065         o.result_ok
11066 }
11067 #[no_mangle]
11068 /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11069 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
11070 impl Drop for CResult_ChannelInfoDecodeErrorZ {
11071         fn drop(&mut self) {
11072                 if self.result_ok {
11073                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11074                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11075                         }
11076                 } else {
11077                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11078                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11079                         }
11080                 }
11081         }
11082 }
11083 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
11084         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::ChannelInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11085                 let contents = if o.result_ok {
11086                         let result = unsafe { o.contents.result };
11087                         unsafe { o.contents.result = core::ptr::null_mut() };
11088                         CResult_ChannelInfoDecodeErrorZPtr { result }
11089                 } else {
11090                         let err = unsafe { o.contents.err };
11091                         unsafe { o.contents.err = core::ptr::null_mut(); }
11092                         CResult_ChannelInfoDecodeErrorZPtr { err }
11093                 };
11094                 Self {
11095                         contents,
11096                         result_ok: o.result_ok,
11097                 }
11098         }
11099 }
11100 impl Clone for CResult_ChannelInfoDecodeErrorZ {
11101         fn clone(&self) -> Self {
11102                 if self.result_ok {
11103                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
11104                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
11105                         } }
11106                 } else {
11107                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
11108                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11109                         } }
11110                 }
11111         }
11112 }
11113 #[no_mangle]
11114 /// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11115 /// but with all dynamically-allocated buffers duplicated in new buffers.
11116 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) }
11117 #[repr(C)]
11118 /// The contents of CResult_RoutingFeesDecodeErrorZ
11119 pub union CResult_RoutingFeesDecodeErrorZPtr {
11120         /// A pointer to the contents in the success state.
11121         /// Reading from this pointer when `result_ok` is not set is undefined.
11122         pub result: *mut crate::lightning::routing::network_graph::RoutingFees,
11123         /// A pointer to the contents in the error state.
11124         /// Reading from this pointer when `result_ok` is set is undefined.
11125         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11126 }
11127 #[repr(C)]
11128 /// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
11129 /// containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
11130 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11131 pub struct CResult_RoutingFeesDecodeErrorZ {
11132         /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
11133         /// `err` or `result` depending on the state of `result_ok`.
11134         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
11135         /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
11136         pub result_ok: bool,
11137 }
11138 #[no_mangle]
11139 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11140 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
11141         CResult_RoutingFeesDecodeErrorZ {
11142                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11143                         result: Box::into_raw(Box::new(o)),
11144                 },
11145                 result_ok: true,
11146         }
11147 }
11148 #[no_mangle]
11149 /// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11150 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
11151         CResult_RoutingFeesDecodeErrorZ {
11152                 contents: CResult_RoutingFeesDecodeErrorZPtr {
11153                         err: Box::into_raw(Box::new(e)),
11154                 },
11155                 result_ok: false,
11156         }
11157 }
11158 /// Checks if the given object is currently in the success state
11159 #[no_mangle]
11160 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool {
11161         o.result_ok
11162 }
11163 #[no_mangle]
11164 /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11165 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
11166 impl Drop for CResult_RoutingFeesDecodeErrorZ {
11167         fn drop(&mut self) {
11168                 if self.result_ok {
11169                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11170                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11171                         }
11172                 } else {
11173                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11174                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11175                         }
11176                 }
11177         }
11178 }
11179 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
11180         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::RoutingFees, crate::lightning::ln::msgs::DecodeError>) -> Self {
11181                 let contents = if o.result_ok {
11182                         let result = unsafe { o.contents.result };
11183                         unsafe { o.contents.result = core::ptr::null_mut() };
11184                         CResult_RoutingFeesDecodeErrorZPtr { result }
11185                 } else {
11186                         let err = unsafe { o.contents.err };
11187                         unsafe { o.contents.err = core::ptr::null_mut(); }
11188                         CResult_RoutingFeesDecodeErrorZPtr { err }
11189                 };
11190                 Self {
11191                         contents,
11192                         result_ok: o.result_ok,
11193                 }
11194         }
11195 }
11196 impl Clone for CResult_RoutingFeesDecodeErrorZ {
11197         fn clone(&self) -> Self {
11198                 if self.result_ok {
11199                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
11200                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
11201                         } }
11202                 } else {
11203                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
11204                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11205                         } }
11206                 }
11207         }
11208 }
11209 #[no_mangle]
11210 /// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11211 /// but with all dynamically-allocated buffers duplicated in new buffers.
11212 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) }
11213 #[repr(C)]
11214 /// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
11215 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11216         /// A pointer to the contents in the success state.
11217         /// Reading from this pointer when `result_ok` is not set is undefined.
11218         pub result: *mut crate::lightning::routing::network_graph::NodeAnnouncementInfo,
11219         /// A pointer to the contents in the error state.
11220         /// Reading from this pointer when `result_ok` is set is undefined.
11221         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11222 }
11223 #[repr(C)]
11224 /// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
11225 /// containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11226 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11227 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
11228         /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
11229         /// `err` or `result` depending on the state of `result_ok`.
11230         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
11231         /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
11232         pub result_ok: bool,
11233 }
11234 #[no_mangle]
11235 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11236 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11237         CResult_NodeAnnouncementInfoDecodeErrorZ {
11238                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11239                         result: Box::into_raw(Box::new(o)),
11240                 },
11241                 result_ok: true,
11242         }
11243 }
11244 #[no_mangle]
11245 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11246 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
11247         CResult_NodeAnnouncementInfoDecodeErrorZ {
11248                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11249                         err: Box::into_raw(Box::new(e)),
11250                 },
11251                 result_ok: false,
11252         }
11253 }
11254 /// Checks if the given object is currently in the success state
11255 #[no_mangle]
11256 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool {
11257         o.result_ok
11258 }
11259 #[no_mangle]
11260 /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11261 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
11262 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
11263         fn drop(&mut self) {
11264                 if self.result_ok {
11265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11267                         }
11268                 } else {
11269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11271                         }
11272                 }
11273         }
11274 }
11275 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
11276         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeAnnouncementInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11277                 let contents = if o.result_ok {
11278                         let result = unsafe { o.contents.result };
11279                         unsafe { o.contents.result = core::ptr::null_mut() };
11280                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
11281                 } else {
11282                         let err = unsafe { o.contents.err };
11283                         unsafe { o.contents.err = core::ptr::null_mut(); }
11284                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
11285                 };
11286                 Self {
11287                         contents,
11288                         result_ok: o.result_ok,
11289                 }
11290         }
11291 }
11292 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
11293         fn clone(&self) -> Self {
11294                 if self.result_ok {
11295                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11296                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
11297                         } }
11298                 } else {
11299                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
11300                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11301                         } }
11302                 }
11303         }
11304 }
11305 #[no_mangle]
11306 /// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11307 /// but with all dynamically-allocated buffers duplicated in new buffers.
11308 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) }
11309 #[repr(C)]
11310 /// A dynamically-allocated array of u64s of arbitrary size.
11311 /// This corresponds to std::vector in C++
11312 pub struct CVec_u64Z {
11313         /// The elements in the array.
11314         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11315         pub data: *mut u64,
11316         /// The number of elements pointed to by `data`.
11317         pub datalen: usize
11318 }
11319 impl CVec_u64Z {
11320         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
11321                 if self.datalen == 0 { return Vec::new(); }
11322                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11323                 self.data = core::ptr::null_mut();
11324                 self.datalen = 0;
11325                 ret
11326         }
11327         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
11328                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11329         }
11330 }
11331 impl From<Vec<u64>> for CVec_u64Z {
11332         fn from(v: Vec<u64>) -> Self {
11333                 let datalen = v.len();
11334                 let data = Box::into_raw(v.into_boxed_slice());
11335                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11336         }
11337 }
11338 #[no_mangle]
11339 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11340 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
11341 impl Drop for CVec_u64Z {
11342         fn drop(&mut self) {
11343                 if self.datalen == 0 { return; }
11344                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11345         }
11346 }
11347 impl Clone for CVec_u64Z {
11348         fn clone(&self) -> Self {
11349                 let mut res = Vec::new();
11350                 if self.datalen == 0 { return Self::from(res); }
11351                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11352                 Self::from(res)
11353         }
11354 }
11355 #[repr(C)]
11356 /// The contents of CResult_NodeInfoDecodeErrorZ
11357 pub union CResult_NodeInfoDecodeErrorZPtr {
11358         /// A pointer to the contents in the success state.
11359         /// Reading from this pointer when `result_ok` is not set is undefined.
11360         pub result: *mut crate::lightning::routing::network_graph::NodeInfo,
11361         /// A pointer to the contents in the error state.
11362         /// Reading from this pointer when `result_ok` is set is undefined.
11363         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11364 }
11365 #[repr(C)]
11366 /// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
11367 /// containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
11368 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11369 pub struct CResult_NodeInfoDecodeErrorZ {
11370         /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
11371         /// `err` or `result` depending on the state of `result_ok`.
11372         pub contents: CResult_NodeInfoDecodeErrorZPtr,
11373         /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
11374         pub result_ok: bool,
11375 }
11376 #[no_mangle]
11377 /// Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11378 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
11379         CResult_NodeInfoDecodeErrorZ {
11380                 contents: CResult_NodeInfoDecodeErrorZPtr {
11381                         result: Box::into_raw(Box::new(o)),
11382                 },
11383                 result_ok: true,
11384         }
11385 }
11386 #[no_mangle]
11387 /// Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11388 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
11389         CResult_NodeInfoDecodeErrorZ {
11390                 contents: CResult_NodeInfoDecodeErrorZPtr {
11391                         err: Box::into_raw(Box::new(e)),
11392                 },
11393                 result_ok: false,
11394         }
11395 }
11396 /// Checks if the given object is currently in the success state
11397 #[no_mangle]
11398 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool {
11399         o.result_ok
11400 }
11401 #[no_mangle]
11402 /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11403 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
11404 impl Drop for CResult_NodeInfoDecodeErrorZ {
11405         fn drop(&mut self) {
11406                 if self.result_ok {
11407                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11408                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11409                         }
11410                 } else {
11411                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11412                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11413                         }
11414                 }
11415         }
11416 }
11417 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
11418         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NodeInfo, crate::lightning::ln::msgs::DecodeError>) -> Self {
11419                 let contents = if o.result_ok {
11420                         let result = unsafe { o.contents.result };
11421                         unsafe { o.contents.result = core::ptr::null_mut() };
11422                         CResult_NodeInfoDecodeErrorZPtr { result }
11423                 } else {
11424                         let err = unsafe { o.contents.err };
11425                         unsafe { o.contents.err = core::ptr::null_mut(); }
11426                         CResult_NodeInfoDecodeErrorZPtr { err }
11427                 };
11428                 Self {
11429                         contents,
11430                         result_ok: o.result_ok,
11431                 }
11432         }
11433 }
11434 impl Clone for CResult_NodeInfoDecodeErrorZ {
11435         fn clone(&self) -> Self {
11436                 if self.result_ok {
11437                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
11438                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
11439                         } }
11440                 } else {
11441                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
11442                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11443                         } }
11444                 }
11445         }
11446 }
11447 #[no_mangle]
11448 /// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11449 /// but with all dynamically-allocated buffers duplicated in new buffers.
11450 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) }
11451 #[repr(C)]
11452 /// The contents of CResult_NetworkGraphDecodeErrorZ
11453 pub union CResult_NetworkGraphDecodeErrorZPtr {
11454         /// A pointer to the contents in the success state.
11455         /// Reading from this pointer when `result_ok` is not set is undefined.
11456         pub result: *mut crate::lightning::routing::network_graph::NetworkGraph,
11457         /// A pointer to the contents in the error state.
11458         /// Reading from this pointer when `result_ok` is set is undefined.
11459         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11460 }
11461 #[repr(C)]
11462 /// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
11463 /// containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
11464 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11465 pub struct CResult_NetworkGraphDecodeErrorZ {
11466         /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
11467         /// `err` or `result` depending on the state of `result_ok`.
11468         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
11469         /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
11470         pub result_ok: bool,
11471 }
11472 #[no_mangle]
11473 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11474 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
11475         CResult_NetworkGraphDecodeErrorZ {
11476                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11477                         result: Box::into_raw(Box::new(o)),
11478                 },
11479                 result_ok: true,
11480         }
11481 }
11482 #[no_mangle]
11483 /// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11484 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
11485         CResult_NetworkGraphDecodeErrorZ {
11486                 contents: CResult_NetworkGraphDecodeErrorZPtr {
11487                         err: Box::into_raw(Box::new(e)),
11488                 },
11489                 result_ok: false,
11490         }
11491 }
11492 /// Checks if the given object is currently in the success state
11493 #[no_mangle]
11494 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool {
11495         o.result_ok
11496 }
11497 #[no_mangle]
11498 /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11499 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
11500 impl Drop for CResult_NetworkGraphDecodeErrorZ {
11501         fn drop(&mut self) {
11502                 if self.result_ok {
11503                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11504                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11505                         }
11506                 } else {
11507                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11508                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11509                         }
11510                 }
11511         }
11512 }
11513 impl From<crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
11514         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::routing::network_graph::NetworkGraph, crate::lightning::ln::msgs::DecodeError>) -> Self {
11515                 let contents = if o.result_ok {
11516                         let result = unsafe { o.contents.result };
11517                         unsafe { o.contents.result = core::ptr::null_mut() };
11518                         CResult_NetworkGraphDecodeErrorZPtr { result }
11519                 } else {
11520                         let err = unsafe { o.contents.err };
11521                         unsafe { o.contents.err = core::ptr::null_mut(); }
11522                         CResult_NetworkGraphDecodeErrorZPtr { err }
11523                 };
11524                 Self {
11525                         contents,
11526                         result_ok: o.result_ok,
11527                 }
11528         }
11529 }
11530 impl Clone for CResult_NetworkGraphDecodeErrorZ {
11531         fn clone(&self) -> Self {
11532                 if self.result_ok {
11533                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
11534                                 result: Box::into_raw(Box::new(<crate::lightning::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
11535                         } }
11536                 } else {
11537                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
11538                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11539                         } }
11540                 }
11541         }
11542 }
11543 #[no_mangle]
11544 /// Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11545 /// but with all dynamically-allocated buffers duplicated in new buffers.
11546 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { Clone::clone(&orig) }
11547 #[repr(C)]
11548 #[derive(Clone)]
11549 /// An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
11550 pub enum COption_CVec_NetAddressZZ {
11551         /// When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
11552         Some(crate::c_types::derived::CVec_NetAddressZ),
11553         /// When we're in this state, this COption_CVec_NetAddressZZ contains nothing
11554         None
11555 }
11556 impl COption_CVec_NetAddressZZ {
11557         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
11558                 if let Self::None = self { false } else { true }
11559         }
11560         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
11561                 !self.is_some()
11562         }
11563         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_NetAddressZ {
11564                 if let Self::Some(v) = self { v } else { unreachable!() }
11565         }
11566 }
11567 #[no_mangle]
11568 /// Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
11569 pub extern "C" fn COption_CVec_NetAddressZZ_some(o: crate::c_types::derived::CVec_NetAddressZ) -> COption_CVec_NetAddressZZ {
11570         COption_CVec_NetAddressZZ::Some(o)
11571 }
11572 #[no_mangle]
11573 /// Constructs a new COption_CVec_NetAddressZZ containing nothing
11574 pub extern "C" fn COption_CVec_NetAddressZZ_none() -> COption_CVec_NetAddressZZ {
11575         COption_CVec_NetAddressZZ::None
11576 }
11577 #[no_mangle]
11578 /// Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
11579 pub extern "C" fn COption_CVec_NetAddressZZ_free(_res: COption_CVec_NetAddressZZ) { }
11580 #[no_mangle]
11581 /// Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
11582 /// but with all dynamically-allocated buffers duplicated in new buffers.
11583 pub extern "C" fn COption_CVec_NetAddressZZ_clone(orig: &COption_CVec_NetAddressZZ) -> COption_CVec_NetAddressZZ { Clone::clone(&orig) }
11584 #[repr(C)]
11585 /// The contents of CResult_NetAddressDecodeErrorZ
11586 pub union CResult_NetAddressDecodeErrorZPtr {
11587         /// A pointer to the contents in the success state.
11588         /// Reading from this pointer when `result_ok` is not set is undefined.
11589         pub result: *mut crate::lightning::ln::msgs::NetAddress,
11590         /// A pointer to the contents in the error state.
11591         /// Reading from this pointer when `result_ok` is set is undefined.
11592         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11593 }
11594 #[repr(C)]
11595 /// A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
11596 /// containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
11597 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11598 pub struct CResult_NetAddressDecodeErrorZ {
11599         /// The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
11600         /// `err` or `result` depending on the state of `result_ok`.
11601         pub contents: CResult_NetAddressDecodeErrorZPtr,
11602         /// Whether this CResult_NetAddressDecodeErrorZ represents a success state.
11603         pub result_ok: bool,
11604 }
11605 #[no_mangle]
11606 /// Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11607 pub extern "C" fn CResult_NetAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NetAddress) -> CResult_NetAddressDecodeErrorZ {
11608         CResult_NetAddressDecodeErrorZ {
11609                 contents: CResult_NetAddressDecodeErrorZPtr {
11610                         result: Box::into_raw(Box::new(o)),
11611                 },
11612                 result_ok: true,
11613         }
11614 }
11615 #[no_mangle]
11616 /// Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11617 pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetAddressDecodeErrorZ {
11618         CResult_NetAddressDecodeErrorZ {
11619                 contents: CResult_NetAddressDecodeErrorZPtr {
11620                         err: Box::into_raw(Box::new(e)),
11621                 },
11622                 result_ok: false,
11623         }
11624 }
11625 /// Checks if the given object is currently in the success state
11626 #[no_mangle]
11627 pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool {
11628         o.result_ok
11629 }
11630 #[no_mangle]
11631 /// Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11632 pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { }
11633 impl Drop for CResult_NetAddressDecodeErrorZ {
11634         fn drop(&mut self) {
11635                 if self.result_ok {
11636                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11637                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11638                         }
11639                 } else {
11640                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11641                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11642                         }
11643                 }
11644         }
11645 }
11646 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>> for CResult_NetAddressDecodeErrorZ {
11647         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NetAddress, crate::lightning::ln::msgs::DecodeError>) -> Self {
11648                 let contents = if o.result_ok {
11649                         let result = unsafe { o.contents.result };
11650                         unsafe { o.contents.result = core::ptr::null_mut() };
11651                         CResult_NetAddressDecodeErrorZPtr { result }
11652                 } else {
11653                         let err = unsafe { o.contents.err };
11654                         unsafe { o.contents.err = core::ptr::null_mut(); }
11655                         CResult_NetAddressDecodeErrorZPtr { err }
11656                 };
11657                 Self {
11658                         contents,
11659                         result_ok: o.result_ok,
11660                 }
11661         }
11662 }
11663 impl Clone for CResult_NetAddressDecodeErrorZ {
11664         fn clone(&self) -> Self {
11665                 if self.result_ok {
11666                         Self { result_ok: true, contents: CResult_NetAddressDecodeErrorZPtr {
11667                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
11668                         } }
11669                 } else {
11670                         Self { result_ok: false, contents: CResult_NetAddressDecodeErrorZPtr {
11671                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11672                         } }
11673                 }
11674         }
11675 }
11676 #[no_mangle]
11677 /// Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11678 /// but with all dynamically-allocated buffers duplicated in new buffers.
11679 pub extern "C" fn CResult_NetAddressDecodeErrorZ_clone(orig: &CResult_NetAddressDecodeErrorZ) -> CResult_NetAddressDecodeErrorZ { Clone::clone(&orig) }
11680 #[repr(C)]
11681 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
11682 /// This corresponds to std::vector in C++
11683 pub struct CVec_UpdateAddHTLCZ {
11684         /// The elements in the array.
11685         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11686         pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
11687         /// The number of elements pointed to by `data`.
11688         pub datalen: usize
11689 }
11690 impl CVec_UpdateAddHTLCZ {
11691         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateAddHTLC> {
11692                 if self.datalen == 0 { return Vec::new(); }
11693                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11694                 self.data = core::ptr::null_mut();
11695                 self.datalen = 0;
11696                 ret
11697         }
11698         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateAddHTLC] {
11699                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11700         }
11701 }
11702 impl From<Vec<crate::lightning::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
11703         fn from(v: Vec<crate::lightning::ln::msgs::UpdateAddHTLC>) -> Self {
11704                 let datalen = v.len();
11705                 let data = Box::into_raw(v.into_boxed_slice());
11706                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11707         }
11708 }
11709 #[no_mangle]
11710 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11711 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
11712 impl Drop for CVec_UpdateAddHTLCZ {
11713         fn drop(&mut self) {
11714                 if self.datalen == 0 { return; }
11715                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11716         }
11717 }
11718 impl Clone for CVec_UpdateAddHTLCZ {
11719         fn clone(&self) -> Self {
11720                 let mut res = Vec::new();
11721                 if self.datalen == 0 { return Self::from(res); }
11722                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11723                 Self::from(res)
11724         }
11725 }
11726 #[repr(C)]
11727 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
11728 /// This corresponds to std::vector in C++
11729 pub struct CVec_UpdateFulfillHTLCZ {
11730         /// The elements in the array.
11731         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11732         pub data: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
11733         /// The number of elements pointed to by `data`.
11734         pub datalen: usize
11735 }
11736 impl CVec_UpdateFulfillHTLCZ {
11737         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC> {
11738                 if self.datalen == 0 { return Vec::new(); }
11739                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11740                 self.data = core::ptr::null_mut();
11741                 self.datalen = 0;
11742                 ret
11743         }
11744         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] {
11745                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11746         }
11747 }
11748 impl From<Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
11749         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFulfillHTLC>) -> Self {
11750                 let datalen = v.len();
11751                 let data = Box::into_raw(v.into_boxed_slice());
11752                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11753         }
11754 }
11755 #[no_mangle]
11756 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11757 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
11758 impl Drop for CVec_UpdateFulfillHTLCZ {
11759         fn drop(&mut self) {
11760                 if self.datalen == 0 { return; }
11761                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11762         }
11763 }
11764 impl Clone for CVec_UpdateFulfillHTLCZ {
11765         fn clone(&self) -> Self {
11766                 let mut res = Vec::new();
11767                 if self.datalen == 0 { return Self::from(res); }
11768                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11769                 Self::from(res)
11770         }
11771 }
11772 #[repr(C)]
11773 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
11774 /// This corresponds to std::vector in C++
11775 pub struct CVec_UpdateFailHTLCZ {
11776         /// The elements in the array.
11777         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11778         pub data: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
11779         /// The number of elements pointed to by `data`.
11780         pub datalen: usize
11781 }
11782 impl CVec_UpdateFailHTLCZ {
11783         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailHTLC> {
11784                 if self.datalen == 0 { return Vec::new(); }
11785                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11786                 self.data = core::ptr::null_mut();
11787                 self.datalen = 0;
11788                 ret
11789         }
11790         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] {
11791                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11792         }
11793 }
11794 impl From<Vec<crate::lightning::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
11795         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailHTLC>) -> Self {
11796                 let datalen = v.len();
11797                 let data = Box::into_raw(v.into_boxed_slice());
11798                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11799         }
11800 }
11801 #[no_mangle]
11802 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11803 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
11804 impl Drop for CVec_UpdateFailHTLCZ {
11805         fn drop(&mut self) {
11806                 if self.datalen == 0 { return; }
11807                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11808         }
11809 }
11810 impl Clone for CVec_UpdateFailHTLCZ {
11811         fn clone(&self) -> Self {
11812                 let mut res = Vec::new();
11813                 if self.datalen == 0 { return Self::from(res); }
11814                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11815                 Self::from(res)
11816         }
11817 }
11818 #[repr(C)]
11819 /// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
11820 /// This corresponds to std::vector in C++
11821 pub struct CVec_UpdateFailMalformedHTLCZ {
11822         /// The elements in the array.
11823         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11824         pub data: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
11825         /// The number of elements pointed to by `data`.
11826         pub datalen: usize
11827 }
11828 impl CVec_UpdateFailMalformedHTLCZ {
11829         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC> {
11830                 if self.datalen == 0 { return Vec::new(); }
11831                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
11832                 self.data = core::ptr::null_mut();
11833                 self.datalen = 0;
11834                 ret
11835         }
11836         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] {
11837                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
11838         }
11839 }
11840 impl From<Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
11841         fn from(v: Vec<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
11842                 let datalen = v.len();
11843                 let data = Box::into_raw(v.into_boxed_slice());
11844                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
11845         }
11846 }
11847 #[no_mangle]
11848 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
11849 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
11850 impl Drop for CVec_UpdateFailMalformedHTLCZ {
11851         fn drop(&mut self) {
11852                 if self.datalen == 0 { return; }
11853                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
11854         }
11855 }
11856 impl Clone for CVec_UpdateFailMalformedHTLCZ {
11857         fn clone(&self) -> Self {
11858                 let mut res = Vec::new();
11859                 if self.datalen == 0 { return Self::from(res); }
11860                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
11861                 Self::from(res)
11862         }
11863 }
11864 #[repr(C)]
11865 /// The contents of CResult_AcceptChannelDecodeErrorZ
11866 pub union CResult_AcceptChannelDecodeErrorZPtr {
11867         /// A pointer to the contents in the success state.
11868         /// Reading from this pointer when `result_ok` is not set is undefined.
11869         pub result: *mut crate::lightning::ln::msgs::AcceptChannel,
11870         /// A pointer to the contents in the error state.
11871         /// Reading from this pointer when `result_ok` is set is undefined.
11872         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11873 }
11874 #[repr(C)]
11875 /// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
11876 /// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
11877 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11878 pub struct CResult_AcceptChannelDecodeErrorZ {
11879         /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
11880         /// `err` or `result` depending on the state of `result_ok`.
11881         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
11882         /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
11883         pub result_ok: bool,
11884 }
11885 #[no_mangle]
11886 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11887 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
11888         CResult_AcceptChannelDecodeErrorZ {
11889                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11890                         result: Box::into_raw(Box::new(o)),
11891                 },
11892                 result_ok: true,
11893         }
11894 }
11895 #[no_mangle]
11896 /// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11897 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
11898         CResult_AcceptChannelDecodeErrorZ {
11899                 contents: CResult_AcceptChannelDecodeErrorZPtr {
11900                         err: Box::into_raw(Box::new(e)),
11901                 },
11902                 result_ok: false,
11903         }
11904 }
11905 /// Checks if the given object is currently in the success state
11906 #[no_mangle]
11907 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool {
11908         o.result_ok
11909 }
11910 #[no_mangle]
11911 /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11912 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
11913 impl Drop for CResult_AcceptChannelDecodeErrorZ {
11914         fn drop(&mut self) {
11915                 if self.result_ok {
11916                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
11917                                 let _ = unsafe { Box::from_raw(self.contents.result) };
11918                         }
11919                 } else {
11920                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
11921                                 let _ = unsafe { Box::from_raw(self.contents.err) };
11922                         }
11923                 }
11924         }
11925 }
11926 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
11927         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AcceptChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
11928                 let contents = if o.result_ok {
11929                         let result = unsafe { o.contents.result };
11930                         unsafe { o.contents.result = core::ptr::null_mut() };
11931                         CResult_AcceptChannelDecodeErrorZPtr { result }
11932                 } else {
11933                         let err = unsafe { o.contents.err };
11934                         unsafe { o.contents.err = core::ptr::null_mut(); }
11935                         CResult_AcceptChannelDecodeErrorZPtr { err }
11936                 };
11937                 Self {
11938                         contents,
11939                         result_ok: o.result_ok,
11940                 }
11941         }
11942 }
11943 impl Clone for CResult_AcceptChannelDecodeErrorZ {
11944         fn clone(&self) -> Self {
11945                 if self.result_ok {
11946                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
11947                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
11948                         } }
11949                 } else {
11950                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
11951                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
11952                         } }
11953                 }
11954         }
11955 }
11956 #[no_mangle]
11957 /// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11958 /// but with all dynamically-allocated buffers duplicated in new buffers.
11959 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) }
11960 #[repr(C)]
11961 /// The contents of CResult_AnnouncementSignaturesDecodeErrorZ
11962 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
11963         /// A pointer to the contents in the success state.
11964         /// Reading from this pointer when `result_ok` is not set is undefined.
11965         pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures,
11966         /// A pointer to the contents in the error state.
11967         /// Reading from this pointer when `result_ok` is set is undefined.
11968         pub err: *mut crate::lightning::ln::msgs::DecodeError,
11969 }
11970 #[repr(C)]
11971 /// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
11972 /// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
11973 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
11974 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
11975         /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
11976         /// `err` or `result` depending on the state of `result_ok`.
11977         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
11978         /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
11979         pub result_ok: bool,
11980 }
11981 #[no_mangle]
11982 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11983 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11984         CResult_AnnouncementSignaturesDecodeErrorZ {
11985                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11986                         result: Box::into_raw(Box::new(o)),
11987                 },
11988                 result_ok: true,
11989         }
11990 }
11991 #[no_mangle]
11992 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11993 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
11994         CResult_AnnouncementSignaturesDecodeErrorZ {
11995                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
11996                         err: Box::into_raw(Box::new(e)),
11997                 },
11998                 result_ok: false,
11999         }
12000 }
12001 /// Checks if the given object is currently in the success state
12002 #[no_mangle]
12003 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool {
12004         o.result_ok
12005 }
12006 #[no_mangle]
12007 /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
12008 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
12009 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
12010         fn drop(&mut self) {
12011                 if self.result_ok {
12012                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12013                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12014                         }
12015                 } else {
12016                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12017                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12018                         }
12019                 }
12020         }
12021 }
12022 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
12023         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::AnnouncementSignatures, crate::lightning::ln::msgs::DecodeError>) -> Self {
12024                 let contents = if o.result_ok {
12025                         let result = unsafe { o.contents.result };
12026                         unsafe { o.contents.result = core::ptr::null_mut() };
12027                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
12028                 } else {
12029                         let err = unsafe { o.contents.err };
12030                         unsafe { o.contents.err = core::ptr::null_mut(); }
12031                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
12032                 };
12033                 Self {
12034                         contents,
12035                         result_ok: o.result_ok,
12036                 }
12037         }
12038 }
12039 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
12040         fn clone(&self) -> Self {
12041                 if self.result_ok {
12042                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12043                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
12044                         } }
12045                 } else {
12046                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
12047                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12048                         } }
12049                 }
12050         }
12051 }
12052 #[no_mangle]
12053 /// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
12054 /// but with all dynamically-allocated buffers duplicated in new buffers.
12055 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) }
12056 #[repr(C)]
12057 /// The contents of CResult_ChannelReestablishDecodeErrorZ
12058 pub union CResult_ChannelReestablishDecodeErrorZPtr {
12059         /// A pointer to the contents in the success state.
12060         /// Reading from this pointer when `result_ok` is not set is undefined.
12061         pub result: *mut crate::lightning::ln::msgs::ChannelReestablish,
12062         /// A pointer to the contents in the error state.
12063         /// Reading from this pointer when `result_ok` is set is undefined.
12064         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12065 }
12066 #[repr(C)]
12067 /// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
12068 /// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
12069 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12070 pub struct CResult_ChannelReestablishDecodeErrorZ {
12071         /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
12072         /// `err` or `result` depending on the state of `result_ok`.
12073         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
12074         /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
12075         pub result_ok: bool,
12076 }
12077 #[no_mangle]
12078 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
12079 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
12080         CResult_ChannelReestablishDecodeErrorZ {
12081                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12082                         result: Box::into_raw(Box::new(o)),
12083                 },
12084                 result_ok: true,
12085         }
12086 }
12087 #[no_mangle]
12088 /// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
12089 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
12090         CResult_ChannelReestablishDecodeErrorZ {
12091                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
12092                         err: Box::into_raw(Box::new(e)),
12093                 },
12094                 result_ok: false,
12095         }
12096 }
12097 /// Checks if the given object is currently in the success state
12098 #[no_mangle]
12099 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool {
12100         o.result_ok
12101 }
12102 #[no_mangle]
12103 /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
12104 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
12105 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
12106         fn drop(&mut self) {
12107                 if self.result_ok {
12108                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12109                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12110                         }
12111                 } else {
12112                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12113                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12114                         }
12115                 }
12116         }
12117 }
12118 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
12119         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelReestablish, crate::lightning::ln::msgs::DecodeError>) -> Self {
12120                 let contents = if o.result_ok {
12121                         let result = unsafe { o.contents.result };
12122                         unsafe { o.contents.result = core::ptr::null_mut() };
12123                         CResult_ChannelReestablishDecodeErrorZPtr { result }
12124                 } else {
12125                         let err = unsafe { o.contents.err };
12126                         unsafe { o.contents.err = core::ptr::null_mut(); }
12127                         CResult_ChannelReestablishDecodeErrorZPtr { err }
12128                 };
12129                 Self {
12130                         contents,
12131                         result_ok: o.result_ok,
12132                 }
12133         }
12134 }
12135 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
12136         fn clone(&self) -> Self {
12137                 if self.result_ok {
12138                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12139                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
12140                         } }
12141                 } else {
12142                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
12143                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12144                         } }
12145                 }
12146         }
12147 }
12148 #[no_mangle]
12149 /// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
12150 /// but with all dynamically-allocated buffers duplicated in new buffers.
12151 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) }
12152 #[repr(C)]
12153 /// The contents of CResult_ClosingSignedDecodeErrorZ
12154 pub union CResult_ClosingSignedDecodeErrorZPtr {
12155         /// A pointer to the contents in the success state.
12156         /// Reading from this pointer when `result_ok` is not set is undefined.
12157         pub result: *mut crate::lightning::ln::msgs::ClosingSigned,
12158         /// A pointer to the contents in the error state.
12159         /// Reading from this pointer when `result_ok` is set is undefined.
12160         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12161 }
12162 #[repr(C)]
12163 /// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
12164 /// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12165 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12166 pub struct CResult_ClosingSignedDecodeErrorZ {
12167         /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
12168         /// `err` or `result` depending on the state of `result_ok`.
12169         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
12170         /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
12171         pub result_ok: bool,
12172 }
12173 #[no_mangle]
12174 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
12175 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
12176         CResult_ClosingSignedDecodeErrorZ {
12177                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12178                         result: Box::into_raw(Box::new(o)),
12179                 },
12180                 result_ok: true,
12181         }
12182 }
12183 #[no_mangle]
12184 /// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
12185 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
12186         CResult_ClosingSignedDecodeErrorZ {
12187                 contents: CResult_ClosingSignedDecodeErrorZPtr {
12188                         err: Box::into_raw(Box::new(e)),
12189                 },
12190                 result_ok: false,
12191         }
12192 }
12193 /// Checks if the given object is currently in the success state
12194 #[no_mangle]
12195 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool {
12196         o.result_ok
12197 }
12198 #[no_mangle]
12199 /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
12200 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
12201 impl Drop for CResult_ClosingSignedDecodeErrorZ {
12202         fn drop(&mut self) {
12203                 if self.result_ok {
12204                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12205                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12206                         }
12207                 } else {
12208                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12209                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12210                         }
12211                 }
12212         }
12213 }
12214 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
12215         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12216                 let contents = if o.result_ok {
12217                         let result = unsafe { o.contents.result };
12218                         unsafe { o.contents.result = core::ptr::null_mut() };
12219                         CResult_ClosingSignedDecodeErrorZPtr { result }
12220                 } else {
12221                         let err = unsafe { o.contents.err };
12222                         unsafe { o.contents.err = core::ptr::null_mut(); }
12223                         CResult_ClosingSignedDecodeErrorZPtr { err }
12224                 };
12225                 Self {
12226                         contents,
12227                         result_ok: o.result_ok,
12228                 }
12229         }
12230 }
12231 impl Clone for CResult_ClosingSignedDecodeErrorZ {
12232         fn clone(&self) -> Self {
12233                 if self.result_ok {
12234                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
12235                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
12236                         } }
12237                 } else {
12238                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
12239                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12240                         } }
12241                 }
12242         }
12243 }
12244 #[no_mangle]
12245 /// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
12246 /// but with all dynamically-allocated buffers duplicated in new buffers.
12247 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) }
12248 #[repr(C)]
12249 /// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
12250 pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12251         /// A pointer to the contents in the success state.
12252         /// Reading from this pointer when `result_ok` is not set is undefined.
12253         pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange,
12254         /// A pointer to the contents in the error state.
12255         /// Reading from this pointer when `result_ok` is set is undefined.
12256         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12257 }
12258 #[repr(C)]
12259 /// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
12260 /// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
12261 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12262 pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ {
12263         /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
12264         /// `err` or `result` depending on the state of `result_ok`.
12265         pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr,
12266         /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
12267         pub result_ok: bool,
12268 }
12269 #[no_mangle]
12270 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
12271 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12272         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12273                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12274                         result: Box::into_raw(Box::new(o)),
12275                 },
12276                 result_ok: true,
12277         }
12278 }
12279 #[no_mangle]
12280 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
12281 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ {
12282         CResult_ClosingSignedFeeRangeDecodeErrorZ {
12283                 contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12284                         err: Box::into_raw(Box::new(e)),
12285                 },
12286                 result_ok: false,
12287         }
12288 }
12289 /// Checks if the given object is currently in the success state
12290 #[no_mangle]
12291 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool {
12292         o.result_ok
12293 }
12294 #[no_mangle]
12295 /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
12296 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
12297 impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12298         fn drop(&mut self) {
12299                 if self.result_ok {
12300                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12301                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12302                         }
12303                 } else {
12304                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12305                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12306                         }
12307                 }
12308         }
12309 }
12310 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12311         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ClosingSignedFeeRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
12312                 let contents = if o.result_ok {
12313                         let result = unsafe { o.contents.result };
12314                         unsafe { o.contents.result = core::ptr::null_mut() };
12315                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result }
12316                 } else {
12317                         let err = unsafe { o.contents.err };
12318                         unsafe { o.contents.err = core::ptr::null_mut(); }
12319                         CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err }
12320                 };
12321                 Self {
12322                         contents,
12323                         result_ok: o.result_ok,
12324                 }
12325         }
12326 }
12327 impl Clone for CResult_ClosingSignedFeeRangeDecodeErrorZ {
12328         fn clone(&self) -> Self {
12329                 if self.result_ok {
12330                         Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12331                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ClosingSignedFeeRange>::clone(unsafe { &*self.contents.result })))
12332                         } }
12333                 } else {
12334                         Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr {
12335                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12336                         } }
12337                 }
12338         }
12339 }
12340 #[no_mangle]
12341 /// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
12342 /// but with all dynamically-allocated buffers duplicated in new buffers.
12343 pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) }
12344 #[repr(C)]
12345 /// The contents of CResult_CommitmentSignedDecodeErrorZ
12346 pub union CResult_CommitmentSignedDecodeErrorZPtr {
12347         /// A pointer to the contents in the success state.
12348         /// Reading from this pointer when `result_ok` is not set is undefined.
12349         pub result: *mut crate::lightning::ln::msgs::CommitmentSigned,
12350         /// A pointer to the contents in the error state.
12351         /// Reading from this pointer when `result_ok` is set is undefined.
12352         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12353 }
12354 #[repr(C)]
12355 /// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
12356 /// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12357 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12358 pub struct CResult_CommitmentSignedDecodeErrorZ {
12359         /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
12360         /// `err` or `result` depending on the state of `result_ok`.
12361         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
12362         /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
12363         pub result_ok: bool,
12364 }
12365 #[no_mangle]
12366 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
12367 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
12368         CResult_CommitmentSignedDecodeErrorZ {
12369                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12370                         result: Box::into_raw(Box::new(o)),
12371                 },
12372                 result_ok: true,
12373         }
12374 }
12375 #[no_mangle]
12376 /// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
12377 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
12378         CResult_CommitmentSignedDecodeErrorZ {
12379                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
12380                         err: Box::into_raw(Box::new(e)),
12381                 },
12382                 result_ok: false,
12383         }
12384 }
12385 /// Checks if the given object is currently in the success state
12386 #[no_mangle]
12387 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool {
12388         o.result_ok
12389 }
12390 #[no_mangle]
12391 /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
12392 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
12393 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
12394         fn drop(&mut self) {
12395                 if self.result_ok {
12396                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12397                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12398                         }
12399                 } else {
12400                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12401                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12402                         }
12403                 }
12404         }
12405 }
12406 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
12407         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::CommitmentSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12408                 let contents = if o.result_ok {
12409                         let result = unsafe { o.contents.result };
12410                         unsafe { o.contents.result = core::ptr::null_mut() };
12411                         CResult_CommitmentSignedDecodeErrorZPtr { result }
12412                 } else {
12413                         let err = unsafe { o.contents.err };
12414                         unsafe { o.contents.err = core::ptr::null_mut(); }
12415                         CResult_CommitmentSignedDecodeErrorZPtr { err }
12416                 };
12417                 Self {
12418                         contents,
12419                         result_ok: o.result_ok,
12420                 }
12421         }
12422 }
12423 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
12424         fn clone(&self) -> Self {
12425                 if self.result_ok {
12426                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12427                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
12428                         } }
12429                 } else {
12430                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
12431                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12432                         } }
12433                 }
12434         }
12435 }
12436 #[no_mangle]
12437 /// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
12438 /// but with all dynamically-allocated buffers duplicated in new buffers.
12439 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) }
12440 #[repr(C)]
12441 /// The contents of CResult_FundingCreatedDecodeErrorZ
12442 pub union CResult_FundingCreatedDecodeErrorZPtr {
12443         /// A pointer to the contents in the success state.
12444         /// Reading from this pointer when `result_ok` is not set is undefined.
12445         pub result: *mut crate::lightning::ln::msgs::FundingCreated,
12446         /// A pointer to the contents in the error state.
12447         /// Reading from this pointer when `result_ok` is set is undefined.
12448         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12449 }
12450 #[repr(C)]
12451 /// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
12452 /// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
12453 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12454 pub struct CResult_FundingCreatedDecodeErrorZ {
12455         /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
12456         /// `err` or `result` depending on the state of `result_ok`.
12457         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
12458         /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
12459         pub result_ok: bool,
12460 }
12461 #[no_mangle]
12462 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
12463 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
12464         CResult_FundingCreatedDecodeErrorZ {
12465                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12466                         result: Box::into_raw(Box::new(o)),
12467                 },
12468                 result_ok: true,
12469         }
12470 }
12471 #[no_mangle]
12472 /// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
12473 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
12474         CResult_FundingCreatedDecodeErrorZ {
12475                 contents: CResult_FundingCreatedDecodeErrorZPtr {
12476                         err: Box::into_raw(Box::new(e)),
12477                 },
12478                 result_ok: false,
12479         }
12480 }
12481 /// Checks if the given object is currently in the success state
12482 #[no_mangle]
12483 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool {
12484         o.result_ok
12485 }
12486 #[no_mangle]
12487 /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
12488 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
12489 impl Drop for CResult_FundingCreatedDecodeErrorZ {
12490         fn drop(&mut self) {
12491                 if self.result_ok {
12492                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12493                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12494                         }
12495                 } else {
12496                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12497                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12498                         }
12499                 }
12500         }
12501 }
12502 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
12503         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingCreated, crate::lightning::ln::msgs::DecodeError>) -> Self {
12504                 let contents = if o.result_ok {
12505                         let result = unsafe { o.contents.result };
12506                         unsafe { o.contents.result = core::ptr::null_mut() };
12507                         CResult_FundingCreatedDecodeErrorZPtr { result }
12508                 } else {
12509                         let err = unsafe { o.contents.err };
12510                         unsafe { o.contents.err = core::ptr::null_mut(); }
12511                         CResult_FundingCreatedDecodeErrorZPtr { err }
12512                 };
12513                 Self {
12514                         contents,
12515                         result_ok: o.result_ok,
12516                 }
12517         }
12518 }
12519 impl Clone for CResult_FundingCreatedDecodeErrorZ {
12520         fn clone(&self) -> Self {
12521                 if self.result_ok {
12522                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
12523                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
12524                         } }
12525                 } else {
12526                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
12527                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12528                         } }
12529                 }
12530         }
12531 }
12532 #[no_mangle]
12533 /// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
12534 /// but with all dynamically-allocated buffers duplicated in new buffers.
12535 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) }
12536 #[repr(C)]
12537 /// The contents of CResult_FundingSignedDecodeErrorZ
12538 pub union CResult_FundingSignedDecodeErrorZPtr {
12539         /// A pointer to the contents in the success state.
12540         /// Reading from this pointer when `result_ok` is not set is undefined.
12541         pub result: *mut crate::lightning::ln::msgs::FundingSigned,
12542         /// A pointer to the contents in the error state.
12543         /// Reading from this pointer when `result_ok` is set is undefined.
12544         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12545 }
12546 #[repr(C)]
12547 /// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
12548 /// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
12549 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12550 pub struct CResult_FundingSignedDecodeErrorZ {
12551         /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
12552         /// `err` or `result` depending on the state of `result_ok`.
12553         pub contents: CResult_FundingSignedDecodeErrorZPtr,
12554         /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
12555         pub result_ok: bool,
12556 }
12557 #[no_mangle]
12558 /// Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
12559 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
12560         CResult_FundingSignedDecodeErrorZ {
12561                 contents: CResult_FundingSignedDecodeErrorZPtr {
12562                         result: Box::into_raw(Box::new(o)),
12563                 },
12564                 result_ok: true,
12565         }
12566 }
12567 #[no_mangle]
12568 /// Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
12569 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
12570         CResult_FundingSignedDecodeErrorZ {
12571                 contents: CResult_FundingSignedDecodeErrorZPtr {
12572                         err: Box::into_raw(Box::new(e)),
12573                 },
12574                 result_ok: false,
12575         }
12576 }
12577 /// Checks if the given object is currently in the success state
12578 #[no_mangle]
12579 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool {
12580         o.result_ok
12581 }
12582 #[no_mangle]
12583 /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
12584 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
12585 impl Drop for CResult_FundingSignedDecodeErrorZ {
12586         fn drop(&mut self) {
12587                 if self.result_ok {
12588                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12589                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12590                         }
12591                 } else {
12592                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12593                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12594                         }
12595                 }
12596         }
12597 }
12598 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
12599         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingSigned, crate::lightning::ln::msgs::DecodeError>) -> Self {
12600                 let contents = if o.result_ok {
12601                         let result = unsafe { o.contents.result };
12602                         unsafe { o.contents.result = core::ptr::null_mut() };
12603                         CResult_FundingSignedDecodeErrorZPtr { result }
12604                 } else {
12605                         let err = unsafe { o.contents.err };
12606                         unsafe { o.contents.err = core::ptr::null_mut(); }
12607                         CResult_FundingSignedDecodeErrorZPtr { err }
12608                 };
12609                 Self {
12610                         contents,
12611                         result_ok: o.result_ok,
12612                 }
12613         }
12614 }
12615 impl Clone for CResult_FundingSignedDecodeErrorZ {
12616         fn clone(&self) -> Self {
12617                 if self.result_ok {
12618                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
12619                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
12620                         } }
12621                 } else {
12622                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
12623                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12624                         } }
12625                 }
12626         }
12627 }
12628 #[no_mangle]
12629 /// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
12630 /// but with all dynamically-allocated buffers duplicated in new buffers.
12631 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) }
12632 #[repr(C)]
12633 /// The contents of CResult_FundingLockedDecodeErrorZ
12634 pub union CResult_FundingLockedDecodeErrorZPtr {
12635         /// A pointer to the contents in the success state.
12636         /// Reading from this pointer when `result_ok` is not set is undefined.
12637         pub result: *mut crate::lightning::ln::msgs::FundingLocked,
12638         /// A pointer to the contents in the error state.
12639         /// Reading from this pointer when `result_ok` is set is undefined.
12640         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12641 }
12642 #[repr(C)]
12643 /// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
12644 /// containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
12645 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12646 pub struct CResult_FundingLockedDecodeErrorZ {
12647         /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
12648         /// `err` or `result` depending on the state of `result_ok`.
12649         pub contents: CResult_FundingLockedDecodeErrorZPtr,
12650         /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
12651         pub result_ok: bool,
12652 }
12653 #[no_mangle]
12654 /// Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
12655 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
12656         CResult_FundingLockedDecodeErrorZ {
12657                 contents: CResult_FundingLockedDecodeErrorZPtr {
12658                         result: Box::into_raw(Box::new(o)),
12659                 },
12660                 result_ok: true,
12661         }
12662 }
12663 #[no_mangle]
12664 /// Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
12665 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
12666         CResult_FundingLockedDecodeErrorZ {
12667                 contents: CResult_FundingLockedDecodeErrorZPtr {
12668                         err: Box::into_raw(Box::new(e)),
12669                 },
12670                 result_ok: false,
12671         }
12672 }
12673 /// Checks if the given object is currently in the success state
12674 #[no_mangle]
12675 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool {
12676         o.result_ok
12677 }
12678 #[no_mangle]
12679 /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
12680 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
12681 impl Drop for CResult_FundingLockedDecodeErrorZ {
12682         fn drop(&mut self) {
12683                 if self.result_ok {
12684                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12685                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12686                         }
12687                 } else {
12688                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12689                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12690                         }
12691                 }
12692         }
12693 }
12694 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
12695         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::FundingLocked, crate::lightning::ln::msgs::DecodeError>) -> Self {
12696                 let contents = if o.result_ok {
12697                         let result = unsafe { o.contents.result };
12698                         unsafe { o.contents.result = core::ptr::null_mut() };
12699                         CResult_FundingLockedDecodeErrorZPtr { result }
12700                 } else {
12701                         let err = unsafe { o.contents.err };
12702                         unsafe { o.contents.err = core::ptr::null_mut(); }
12703                         CResult_FundingLockedDecodeErrorZPtr { err }
12704                 };
12705                 Self {
12706                         contents,
12707                         result_ok: o.result_ok,
12708                 }
12709         }
12710 }
12711 impl Clone for CResult_FundingLockedDecodeErrorZ {
12712         fn clone(&self) -> Self {
12713                 if self.result_ok {
12714                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
12715                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
12716                         } }
12717                 } else {
12718                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
12719                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12720                         } }
12721                 }
12722         }
12723 }
12724 #[no_mangle]
12725 /// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
12726 /// but with all dynamically-allocated buffers duplicated in new buffers.
12727 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) }
12728 #[repr(C)]
12729 /// The contents of CResult_InitDecodeErrorZ
12730 pub union CResult_InitDecodeErrorZPtr {
12731         /// A pointer to the contents in the success state.
12732         /// Reading from this pointer when `result_ok` is not set is undefined.
12733         pub result: *mut crate::lightning::ln::msgs::Init,
12734         /// A pointer to the contents in the error state.
12735         /// Reading from this pointer when `result_ok` is set is undefined.
12736         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12737 }
12738 #[repr(C)]
12739 /// A CResult_InitDecodeErrorZ represents the result of a fallible operation,
12740 /// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
12741 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12742 pub struct CResult_InitDecodeErrorZ {
12743         /// The contents of this CResult_InitDecodeErrorZ, accessible via either
12744         /// `err` or `result` depending on the state of `result_ok`.
12745         pub contents: CResult_InitDecodeErrorZPtr,
12746         /// Whether this CResult_InitDecodeErrorZ represents a success state.
12747         pub result_ok: bool,
12748 }
12749 #[no_mangle]
12750 /// Creates a new CResult_InitDecodeErrorZ in the success state.
12751 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
12752         CResult_InitDecodeErrorZ {
12753                 contents: CResult_InitDecodeErrorZPtr {
12754                         result: Box::into_raw(Box::new(o)),
12755                 },
12756                 result_ok: true,
12757         }
12758 }
12759 #[no_mangle]
12760 /// Creates a new CResult_InitDecodeErrorZ in the error state.
12761 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
12762         CResult_InitDecodeErrorZ {
12763                 contents: CResult_InitDecodeErrorZPtr {
12764                         err: Box::into_raw(Box::new(e)),
12765                 },
12766                 result_ok: false,
12767         }
12768 }
12769 /// Checks if the given object is currently in the success state
12770 #[no_mangle]
12771 pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool {
12772         o.result_ok
12773 }
12774 #[no_mangle]
12775 /// Frees any resources used by the CResult_InitDecodeErrorZ.
12776 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
12777 impl Drop for CResult_InitDecodeErrorZ {
12778         fn drop(&mut self) {
12779                 if self.result_ok {
12780                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12781                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12782                         }
12783                 } else {
12784                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12785                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12786                         }
12787                 }
12788         }
12789 }
12790 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
12791         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Init, crate::lightning::ln::msgs::DecodeError>) -> Self {
12792                 let contents = if o.result_ok {
12793                         let result = unsafe { o.contents.result };
12794                         unsafe { o.contents.result = core::ptr::null_mut() };
12795                         CResult_InitDecodeErrorZPtr { result }
12796                 } else {
12797                         let err = unsafe { o.contents.err };
12798                         unsafe { o.contents.err = core::ptr::null_mut(); }
12799                         CResult_InitDecodeErrorZPtr { err }
12800                 };
12801                 Self {
12802                         contents,
12803                         result_ok: o.result_ok,
12804                 }
12805         }
12806 }
12807 impl Clone for CResult_InitDecodeErrorZ {
12808         fn clone(&self) -> Self {
12809                 if self.result_ok {
12810                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
12811                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
12812                         } }
12813                 } else {
12814                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
12815                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12816                         } }
12817                 }
12818         }
12819 }
12820 #[no_mangle]
12821 /// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
12822 /// but with all dynamically-allocated buffers duplicated in new buffers.
12823 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) }
12824 #[repr(C)]
12825 /// The contents of CResult_OpenChannelDecodeErrorZ
12826 pub union CResult_OpenChannelDecodeErrorZPtr {
12827         /// A pointer to the contents in the success state.
12828         /// Reading from this pointer when `result_ok` is not set is undefined.
12829         pub result: *mut crate::lightning::ln::msgs::OpenChannel,
12830         /// A pointer to the contents in the error state.
12831         /// Reading from this pointer when `result_ok` is set is undefined.
12832         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12833 }
12834 #[repr(C)]
12835 /// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
12836 /// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
12837 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12838 pub struct CResult_OpenChannelDecodeErrorZ {
12839         /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
12840         /// `err` or `result` depending on the state of `result_ok`.
12841         pub contents: CResult_OpenChannelDecodeErrorZPtr,
12842         /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
12843         pub result_ok: bool,
12844 }
12845 #[no_mangle]
12846 /// Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
12847 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
12848         CResult_OpenChannelDecodeErrorZ {
12849                 contents: CResult_OpenChannelDecodeErrorZPtr {
12850                         result: Box::into_raw(Box::new(o)),
12851                 },
12852                 result_ok: true,
12853         }
12854 }
12855 #[no_mangle]
12856 /// Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
12857 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
12858         CResult_OpenChannelDecodeErrorZ {
12859                 contents: CResult_OpenChannelDecodeErrorZPtr {
12860                         err: Box::into_raw(Box::new(e)),
12861                 },
12862                 result_ok: false,
12863         }
12864 }
12865 /// Checks if the given object is currently in the success state
12866 #[no_mangle]
12867 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool {
12868         o.result_ok
12869 }
12870 #[no_mangle]
12871 /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
12872 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
12873 impl Drop for CResult_OpenChannelDecodeErrorZ {
12874         fn drop(&mut self) {
12875                 if self.result_ok {
12876                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12877                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12878                         }
12879                 } else {
12880                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12881                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12882                         }
12883                 }
12884         }
12885 }
12886 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
12887         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::OpenChannel, crate::lightning::ln::msgs::DecodeError>) -> Self {
12888                 let contents = if o.result_ok {
12889                         let result = unsafe { o.contents.result };
12890                         unsafe { o.contents.result = core::ptr::null_mut() };
12891                         CResult_OpenChannelDecodeErrorZPtr { result }
12892                 } else {
12893                         let err = unsafe { o.contents.err };
12894                         unsafe { o.contents.err = core::ptr::null_mut(); }
12895                         CResult_OpenChannelDecodeErrorZPtr { err }
12896                 };
12897                 Self {
12898                         contents,
12899                         result_ok: o.result_ok,
12900                 }
12901         }
12902 }
12903 impl Clone for CResult_OpenChannelDecodeErrorZ {
12904         fn clone(&self) -> Self {
12905                 if self.result_ok {
12906                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
12907                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
12908                         } }
12909                 } else {
12910                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
12911                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
12912                         } }
12913                 }
12914         }
12915 }
12916 #[no_mangle]
12917 /// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
12918 /// but with all dynamically-allocated buffers duplicated in new buffers.
12919 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) }
12920 #[repr(C)]
12921 /// The contents of CResult_RevokeAndACKDecodeErrorZ
12922 pub union CResult_RevokeAndACKDecodeErrorZPtr {
12923         /// A pointer to the contents in the success state.
12924         /// Reading from this pointer when `result_ok` is not set is undefined.
12925         pub result: *mut crate::lightning::ln::msgs::RevokeAndACK,
12926         /// A pointer to the contents in the error state.
12927         /// Reading from this pointer when `result_ok` is set is undefined.
12928         pub err: *mut crate::lightning::ln::msgs::DecodeError,
12929 }
12930 #[repr(C)]
12931 /// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
12932 /// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
12933 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
12934 pub struct CResult_RevokeAndACKDecodeErrorZ {
12935         /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
12936         /// `err` or `result` depending on the state of `result_ok`.
12937         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
12938         /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
12939         pub result_ok: bool,
12940 }
12941 #[no_mangle]
12942 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
12943 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
12944         CResult_RevokeAndACKDecodeErrorZ {
12945                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12946                         result: Box::into_raw(Box::new(o)),
12947                 },
12948                 result_ok: true,
12949         }
12950 }
12951 #[no_mangle]
12952 /// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
12953 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
12954         CResult_RevokeAndACKDecodeErrorZ {
12955                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
12956                         err: Box::into_raw(Box::new(e)),
12957                 },
12958                 result_ok: false,
12959         }
12960 }
12961 /// Checks if the given object is currently in the success state
12962 #[no_mangle]
12963 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool {
12964         o.result_ok
12965 }
12966 #[no_mangle]
12967 /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
12968 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
12969 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
12970         fn drop(&mut self) {
12971                 if self.result_ok {
12972                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
12973                                 let _ = unsafe { Box::from_raw(self.contents.result) };
12974                         }
12975                 } else {
12976                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
12977                                 let _ = unsafe { Box::from_raw(self.contents.err) };
12978                         }
12979                 }
12980         }
12981 }
12982 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
12983         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::RevokeAndACK, crate::lightning::ln::msgs::DecodeError>) -> Self {
12984                 let contents = if o.result_ok {
12985                         let result = unsafe { o.contents.result };
12986                         unsafe { o.contents.result = core::ptr::null_mut() };
12987                         CResult_RevokeAndACKDecodeErrorZPtr { result }
12988                 } else {
12989                         let err = unsafe { o.contents.err };
12990                         unsafe { o.contents.err = core::ptr::null_mut(); }
12991                         CResult_RevokeAndACKDecodeErrorZPtr { err }
12992                 };
12993                 Self {
12994                         contents,
12995                         result_ok: o.result_ok,
12996                 }
12997         }
12998 }
12999 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
13000         fn clone(&self) -> Self {
13001                 if self.result_ok {
13002                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13003                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
13004                         } }
13005                 } else {
13006                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
13007                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13008                         } }
13009                 }
13010         }
13011 }
13012 #[no_mangle]
13013 /// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
13014 /// but with all dynamically-allocated buffers duplicated in new buffers.
13015 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) }
13016 #[repr(C)]
13017 /// The contents of CResult_ShutdownDecodeErrorZ
13018 pub union CResult_ShutdownDecodeErrorZPtr {
13019         /// A pointer to the contents in the success state.
13020         /// Reading from this pointer when `result_ok` is not set is undefined.
13021         pub result: *mut crate::lightning::ln::msgs::Shutdown,
13022         /// A pointer to the contents in the error state.
13023         /// Reading from this pointer when `result_ok` is set is undefined.
13024         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13025 }
13026 #[repr(C)]
13027 /// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
13028 /// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
13029 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13030 pub struct CResult_ShutdownDecodeErrorZ {
13031         /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
13032         /// `err` or `result` depending on the state of `result_ok`.
13033         pub contents: CResult_ShutdownDecodeErrorZPtr,
13034         /// Whether this CResult_ShutdownDecodeErrorZ represents a success state.
13035         pub result_ok: bool,
13036 }
13037 #[no_mangle]
13038 /// Creates a new CResult_ShutdownDecodeErrorZ in the success state.
13039 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
13040         CResult_ShutdownDecodeErrorZ {
13041                 contents: CResult_ShutdownDecodeErrorZPtr {
13042                         result: Box::into_raw(Box::new(o)),
13043                 },
13044                 result_ok: true,
13045         }
13046 }
13047 #[no_mangle]
13048 /// Creates a new CResult_ShutdownDecodeErrorZ in the error state.
13049 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
13050         CResult_ShutdownDecodeErrorZ {
13051                 contents: CResult_ShutdownDecodeErrorZPtr {
13052                         err: Box::into_raw(Box::new(e)),
13053                 },
13054                 result_ok: false,
13055         }
13056 }
13057 /// Checks if the given object is currently in the success state
13058 #[no_mangle]
13059 pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool {
13060         o.result_ok
13061 }
13062 #[no_mangle]
13063 /// Frees any resources used by the CResult_ShutdownDecodeErrorZ.
13064 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
13065 impl Drop for CResult_ShutdownDecodeErrorZ {
13066         fn drop(&mut self) {
13067                 if self.result_ok {
13068                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13069                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13070                         }
13071                 } else {
13072                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13073                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13074                         }
13075                 }
13076         }
13077 }
13078 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
13079         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Shutdown, crate::lightning::ln::msgs::DecodeError>) -> Self {
13080                 let contents = if o.result_ok {
13081                         let result = unsafe { o.contents.result };
13082                         unsafe { o.contents.result = core::ptr::null_mut() };
13083                         CResult_ShutdownDecodeErrorZPtr { result }
13084                 } else {
13085                         let err = unsafe { o.contents.err };
13086                         unsafe { o.contents.err = core::ptr::null_mut(); }
13087                         CResult_ShutdownDecodeErrorZPtr { err }
13088                 };
13089                 Self {
13090                         contents,
13091                         result_ok: o.result_ok,
13092                 }
13093         }
13094 }
13095 impl Clone for CResult_ShutdownDecodeErrorZ {
13096         fn clone(&self) -> Self {
13097                 if self.result_ok {
13098                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
13099                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
13100                         } }
13101                 } else {
13102                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
13103                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13104                         } }
13105                 }
13106         }
13107 }
13108 #[no_mangle]
13109 /// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
13110 /// but with all dynamically-allocated buffers duplicated in new buffers.
13111 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) }
13112 #[repr(C)]
13113 /// The contents of CResult_UpdateFailHTLCDecodeErrorZ
13114 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
13115         /// A pointer to the contents in the success state.
13116         /// Reading from this pointer when `result_ok` is not set is undefined.
13117         pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC,
13118         /// A pointer to the contents in the error state.
13119         /// Reading from this pointer when `result_ok` is set is undefined.
13120         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13121 }
13122 #[repr(C)]
13123 /// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
13124 /// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13125 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13126 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
13127         /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
13128         /// `err` or `result` depending on the state of `result_ok`.
13129         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
13130         /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
13131         pub result_ok: bool,
13132 }
13133 #[no_mangle]
13134 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
13135 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
13136         CResult_UpdateFailHTLCDecodeErrorZ {
13137                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13138                         result: Box::into_raw(Box::new(o)),
13139                 },
13140                 result_ok: true,
13141         }
13142 }
13143 #[no_mangle]
13144 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
13145 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
13146         CResult_UpdateFailHTLCDecodeErrorZ {
13147                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13148                         err: Box::into_raw(Box::new(e)),
13149                 },
13150                 result_ok: false,
13151         }
13152 }
13153 /// Checks if the given object is currently in the success state
13154 #[no_mangle]
13155 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool {
13156         o.result_ok
13157 }
13158 #[no_mangle]
13159 /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
13160 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
13161 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
13162         fn drop(&mut self) {
13163                 if self.result_ok {
13164                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13165                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13166                         }
13167                 } else {
13168                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13169                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13170                         }
13171                 }
13172         }
13173 }
13174 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
13175         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13176                 let contents = if o.result_ok {
13177                         let result = unsafe { o.contents.result };
13178                         unsafe { o.contents.result = core::ptr::null_mut() };
13179                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
13180                 } else {
13181                         let err = unsafe { o.contents.err };
13182                         unsafe { o.contents.err = core::ptr::null_mut(); }
13183                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
13184                 };
13185                 Self {
13186                         contents,
13187                         result_ok: o.result_ok,
13188                 }
13189         }
13190 }
13191 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
13192         fn clone(&self) -> Self {
13193                 if self.result_ok {
13194                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13195                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
13196                         } }
13197                 } else {
13198                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
13199                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13200                         } }
13201                 }
13202         }
13203 }
13204 #[no_mangle]
13205 /// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
13206 /// but with all dynamically-allocated buffers duplicated in new buffers.
13207 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) }
13208 #[repr(C)]
13209 /// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
13210 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13211         /// A pointer to the contents in the success state.
13212         /// Reading from this pointer when `result_ok` is not set is undefined.
13213         pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC,
13214         /// A pointer to the contents in the error state.
13215         /// Reading from this pointer when `result_ok` is set is undefined.
13216         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13217 }
13218 #[repr(C)]
13219 /// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
13220 /// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13221 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13222 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13223         /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
13224         /// `err` or `result` depending on the state of `result_ok`.
13225         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
13226         /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
13227         pub result_ok: bool,
13228 }
13229 #[no_mangle]
13230 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
13231 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13232         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13233                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13234                         result: Box::into_raw(Box::new(o)),
13235                 },
13236                 result_ok: true,
13237         }
13238 }
13239 #[no_mangle]
13240 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
13241 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13242         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13243                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13244                         err: Box::into_raw(Box::new(e)),
13245                 },
13246                 result_ok: false,
13247         }
13248 }
13249 /// Checks if the given object is currently in the success state
13250 #[no_mangle]
13251 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool {
13252         o.result_ok
13253 }
13254 #[no_mangle]
13255 /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
13256 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
13257 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13258         fn drop(&mut self) {
13259                 if self.result_ok {
13260                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13261                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13262                         }
13263                 } else {
13264                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13265                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13266                         }
13267                 }
13268         }
13269 }
13270 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13271         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFailMalformedHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13272                 let contents = if o.result_ok {
13273                         let result = unsafe { o.contents.result };
13274                         unsafe { o.contents.result = core::ptr::null_mut() };
13275                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
13276                 } else {
13277                         let err = unsafe { o.contents.err };
13278                         unsafe { o.contents.err = core::ptr::null_mut(); }
13279                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
13280                 };
13281                 Self {
13282                         contents,
13283                         result_ok: o.result_ok,
13284                 }
13285         }
13286 }
13287 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
13288         fn clone(&self) -> Self {
13289                 if self.result_ok {
13290                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13291                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
13292                         } }
13293                 } else {
13294                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
13295                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13296                         } }
13297                 }
13298         }
13299 }
13300 #[no_mangle]
13301 /// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
13302 /// but with all dynamically-allocated buffers duplicated in new buffers.
13303 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) }
13304 #[repr(C)]
13305 /// The contents of CResult_UpdateFeeDecodeErrorZ
13306 pub union CResult_UpdateFeeDecodeErrorZPtr {
13307         /// A pointer to the contents in the success state.
13308         /// Reading from this pointer when `result_ok` is not set is undefined.
13309         pub result: *mut crate::lightning::ln::msgs::UpdateFee,
13310         /// A pointer to the contents in the error state.
13311         /// Reading from this pointer when `result_ok` is set is undefined.
13312         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13313 }
13314 #[repr(C)]
13315 /// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
13316 /// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
13317 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13318 pub struct CResult_UpdateFeeDecodeErrorZ {
13319         /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
13320         /// `err` or `result` depending on the state of `result_ok`.
13321         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
13322         /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
13323         pub result_ok: bool,
13324 }
13325 #[no_mangle]
13326 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
13327 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
13328         CResult_UpdateFeeDecodeErrorZ {
13329                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13330                         result: Box::into_raw(Box::new(o)),
13331                 },
13332                 result_ok: true,
13333         }
13334 }
13335 #[no_mangle]
13336 /// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
13337 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
13338         CResult_UpdateFeeDecodeErrorZ {
13339                 contents: CResult_UpdateFeeDecodeErrorZPtr {
13340                         err: Box::into_raw(Box::new(e)),
13341                 },
13342                 result_ok: false,
13343         }
13344 }
13345 /// Checks if the given object is currently in the success state
13346 #[no_mangle]
13347 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool {
13348         o.result_ok
13349 }
13350 #[no_mangle]
13351 /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
13352 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
13353 impl Drop for CResult_UpdateFeeDecodeErrorZ {
13354         fn drop(&mut self) {
13355                 if self.result_ok {
13356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13358                         }
13359                 } else {
13360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13362                         }
13363                 }
13364         }
13365 }
13366 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
13367         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFee, crate::lightning::ln::msgs::DecodeError>) -> Self {
13368                 let contents = if o.result_ok {
13369                         let result = unsafe { o.contents.result };
13370                         unsafe { o.contents.result = core::ptr::null_mut() };
13371                         CResult_UpdateFeeDecodeErrorZPtr { result }
13372                 } else {
13373                         let err = unsafe { o.contents.err };
13374                         unsafe { o.contents.err = core::ptr::null_mut(); }
13375                         CResult_UpdateFeeDecodeErrorZPtr { err }
13376                 };
13377                 Self {
13378                         contents,
13379                         result_ok: o.result_ok,
13380                 }
13381         }
13382 }
13383 impl Clone for CResult_UpdateFeeDecodeErrorZ {
13384         fn clone(&self) -> Self {
13385                 if self.result_ok {
13386                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
13387                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
13388                         } }
13389                 } else {
13390                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
13391                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13392                         } }
13393                 }
13394         }
13395 }
13396 #[no_mangle]
13397 /// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
13398 /// but with all dynamically-allocated buffers duplicated in new buffers.
13399 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) }
13400 #[repr(C)]
13401 /// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
13402 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13403         /// A pointer to the contents in the success state.
13404         /// Reading from this pointer when `result_ok` is not set is undefined.
13405         pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC,
13406         /// A pointer to the contents in the error state.
13407         /// Reading from this pointer when `result_ok` is set is undefined.
13408         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13409 }
13410 #[repr(C)]
13411 /// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
13412 /// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13413 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13414 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
13415         /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
13416         /// `err` or `result` depending on the state of `result_ok`.
13417         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
13418         /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
13419         pub result_ok: bool,
13420 }
13421 #[no_mangle]
13422 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
13423 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13424         CResult_UpdateFulfillHTLCDecodeErrorZ {
13425                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13426                         result: Box::into_raw(Box::new(o)),
13427                 },
13428                 result_ok: true,
13429         }
13430 }
13431 #[no_mangle]
13432 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
13433 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
13434         CResult_UpdateFulfillHTLCDecodeErrorZ {
13435                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13436                         err: Box::into_raw(Box::new(e)),
13437                 },
13438                 result_ok: false,
13439         }
13440 }
13441 /// Checks if the given object is currently in the success state
13442 #[no_mangle]
13443 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool {
13444         o.result_ok
13445 }
13446 #[no_mangle]
13447 /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
13448 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
13449 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
13450         fn drop(&mut self) {
13451                 if self.result_ok {
13452                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13453                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13454                         }
13455                 } else {
13456                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13457                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13458                         }
13459                 }
13460         }
13461 }
13462 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
13463         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateFulfillHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13464                 let contents = if o.result_ok {
13465                         let result = unsafe { o.contents.result };
13466                         unsafe { o.contents.result = core::ptr::null_mut() };
13467                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
13468                 } else {
13469                         let err = unsafe { o.contents.err };
13470                         unsafe { o.contents.err = core::ptr::null_mut(); }
13471                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
13472                 };
13473                 Self {
13474                         contents,
13475                         result_ok: o.result_ok,
13476                 }
13477         }
13478 }
13479 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
13480         fn clone(&self) -> Self {
13481                 if self.result_ok {
13482                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13483                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
13484                         } }
13485                 } else {
13486                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
13487                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13488                         } }
13489                 }
13490         }
13491 }
13492 #[no_mangle]
13493 /// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
13494 /// but with all dynamically-allocated buffers duplicated in new buffers.
13495 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) }
13496 #[repr(C)]
13497 /// The contents of CResult_UpdateAddHTLCDecodeErrorZ
13498 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
13499         /// A pointer to the contents in the success state.
13500         /// Reading from this pointer when `result_ok` is not set is undefined.
13501         pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC,
13502         /// A pointer to the contents in the error state.
13503         /// Reading from this pointer when `result_ok` is set is undefined.
13504         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13505 }
13506 #[repr(C)]
13507 /// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
13508 /// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
13509 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13510 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
13511         /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
13512         /// `err` or `result` depending on the state of `result_ok`.
13513         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
13514         /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
13515         pub result_ok: bool,
13516 }
13517 #[no_mangle]
13518 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
13519 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
13520         CResult_UpdateAddHTLCDecodeErrorZ {
13521                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13522                         result: Box::into_raw(Box::new(o)),
13523                 },
13524                 result_ok: true,
13525         }
13526 }
13527 #[no_mangle]
13528 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
13529 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
13530         CResult_UpdateAddHTLCDecodeErrorZ {
13531                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13532                         err: Box::into_raw(Box::new(e)),
13533                 },
13534                 result_ok: false,
13535         }
13536 }
13537 /// Checks if the given object is currently in the success state
13538 #[no_mangle]
13539 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool {
13540         o.result_ok
13541 }
13542 #[no_mangle]
13543 /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
13544 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
13545 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
13546         fn drop(&mut self) {
13547                 if self.result_ok {
13548                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13549                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13550                         }
13551                 } else {
13552                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13553                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13554                         }
13555                 }
13556         }
13557 }
13558 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
13559         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UpdateAddHTLC, crate::lightning::ln::msgs::DecodeError>) -> Self {
13560                 let contents = if o.result_ok {
13561                         let result = unsafe { o.contents.result };
13562                         unsafe { o.contents.result = core::ptr::null_mut() };
13563                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
13564                 } else {
13565                         let err = unsafe { o.contents.err };
13566                         unsafe { o.contents.err = core::ptr::null_mut(); }
13567                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
13568                 };
13569                 Self {
13570                         contents,
13571                         result_ok: o.result_ok,
13572                 }
13573         }
13574 }
13575 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
13576         fn clone(&self) -> Self {
13577                 if self.result_ok {
13578                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13579                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
13580                         } }
13581                 } else {
13582                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
13583                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13584                         } }
13585                 }
13586         }
13587 }
13588 #[no_mangle]
13589 /// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
13590 /// but with all dynamically-allocated buffers duplicated in new buffers.
13591 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) }
13592 #[repr(C)]
13593 /// The contents of CResult_PingDecodeErrorZ
13594 pub union CResult_PingDecodeErrorZPtr {
13595         /// A pointer to the contents in the success state.
13596         /// Reading from this pointer when `result_ok` is not set is undefined.
13597         pub result: *mut crate::lightning::ln::msgs::Ping,
13598         /// A pointer to the contents in the error state.
13599         /// Reading from this pointer when `result_ok` is set is undefined.
13600         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13601 }
13602 #[repr(C)]
13603 /// A CResult_PingDecodeErrorZ represents the result of a fallible operation,
13604 /// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
13605 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13606 pub struct CResult_PingDecodeErrorZ {
13607         /// The contents of this CResult_PingDecodeErrorZ, accessible via either
13608         /// `err` or `result` depending on the state of `result_ok`.
13609         pub contents: CResult_PingDecodeErrorZPtr,
13610         /// Whether this CResult_PingDecodeErrorZ represents a success state.
13611         pub result_ok: bool,
13612 }
13613 #[no_mangle]
13614 /// Creates a new CResult_PingDecodeErrorZ in the success state.
13615 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
13616         CResult_PingDecodeErrorZ {
13617                 contents: CResult_PingDecodeErrorZPtr {
13618                         result: Box::into_raw(Box::new(o)),
13619                 },
13620                 result_ok: true,
13621         }
13622 }
13623 #[no_mangle]
13624 /// Creates a new CResult_PingDecodeErrorZ in the error state.
13625 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
13626         CResult_PingDecodeErrorZ {
13627                 contents: CResult_PingDecodeErrorZPtr {
13628                         err: Box::into_raw(Box::new(e)),
13629                 },
13630                 result_ok: false,
13631         }
13632 }
13633 /// Checks if the given object is currently in the success state
13634 #[no_mangle]
13635 pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool {
13636         o.result_ok
13637 }
13638 #[no_mangle]
13639 /// Frees any resources used by the CResult_PingDecodeErrorZ.
13640 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
13641 impl Drop for CResult_PingDecodeErrorZ {
13642         fn drop(&mut self) {
13643                 if self.result_ok {
13644                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13645                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13646                         }
13647                 } else {
13648                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13649                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13650                         }
13651                 }
13652         }
13653 }
13654 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
13655         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Ping, crate::lightning::ln::msgs::DecodeError>) -> Self {
13656                 let contents = if o.result_ok {
13657                         let result = unsafe { o.contents.result };
13658                         unsafe { o.contents.result = core::ptr::null_mut() };
13659                         CResult_PingDecodeErrorZPtr { result }
13660                 } else {
13661                         let err = unsafe { o.contents.err };
13662                         unsafe { o.contents.err = core::ptr::null_mut(); }
13663                         CResult_PingDecodeErrorZPtr { err }
13664                 };
13665                 Self {
13666                         contents,
13667                         result_ok: o.result_ok,
13668                 }
13669         }
13670 }
13671 impl Clone for CResult_PingDecodeErrorZ {
13672         fn clone(&self) -> Self {
13673                 if self.result_ok {
13674                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
13675                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
13676                         } }
13677                 } else {
13678                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
13679                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13680                         } }
13681                 }
13682         }
13683 }
13684 #[no_mangle]
13685 /// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
13686 /// but with all dynamically-allocated buffers duplicated in new buffers.
13687 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) }
13688 #[repr(C)]
13689 /// The contents of CResult_PongDecodeErrorZ
13690 pub union CResult_PongDecodeErrorZPtr {
13691         /// A pointer to the contents in the success state.
13692         /// Reading from this pointer when `result_ok` is not set is undefined.
13693         pub result: *mut crate::lightning::ln::msgs::Pong,
13694         /// A pointer to the contents in the error state.
13695         /// Reading from this pointer when `result_ok` is set is undefined.
13696         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13697 }
13698 #[repr(C)]
13699 /// A CResult_PongDecodeErrorZ represents the result of a fallible operation,
13700 /// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
13701 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13702 pub struct CResult_PongDecodeErrorZ {
13703         /// The contents of this CResult_PongDecodeErrorZ, accessible via either
13704         /// `err` or `result` depending on the state of `result_ok`.
13705         pub contents: CResult_PongDecodeErrorZPtr,
13706         /// Whether this CResult_PongDecodeErrorZ represents a success state.
13707         pub result_ok: bool,
13708 }
13709 #[no_mangle]
13710 /// Creates a new CResult_PongDecodeErrorZ in the success state.
13711 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
13712         CResult_PongDecodeErrorZ {
13713                 contents: CResult_PongDecodeErrorZPtr {
13714                         result: Box::into_raw(Box::new(o)),
13715                 },
13716                 result_ok: true,
13717         }
13718 }
13719 #[no_mangle]
13720 /// Creates a new CResult_PongDecodeErrorZ in the error state.
13721 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
13722         CResult_PongDecodeErrorZ {
13723                 contents: CResult_PongDecodeErrorZPtr {
13724                         err: Box::into_raw(Box::new(e)),
13725                 },
13726                 result_ok: false,
13727         }
13728 }
13729 /// Checks if the given object is currently in the success state
13730 #[no_mangle]
13731 pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool {
13732         o.result_ok
13733 }
13734 #[no_mangle]
13735 /// Frees any resources used by the CResult_PongDecodeErrorZ.
13736 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
13737 impl Drop for CResult_PongDecodeErrorZ {
13738         fn drop(&mut self) {
13739                 if self.result_ok {
13740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13742                         }
13743                 } else {
13744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13746                         }
13747                 }
13748         }
13749 }
13750 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
13751         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::Pong, crate::lightning::ln::msgs::DecodeError>) -> Self {
13752                 let contents = if o.result_ok {
13753                         let result = unsafe { o.contents.result };
13754                         unsafe { o.contents.result = core::ptr::null_mut() };
13755                         CResult_PongDecodeErrorZPtr { result }
13756                 } else {
13757                         let err = unsafe { o.contents.err };
13758                         unsafe { o.contents.err = core::ptr::null_mut(); }
13759                         CResult_PongDecodeErrorZPtr { err }
13760                 };
13761                 Self {
13762                         contents,
13763                         result_ok: o.result_ok,
13764                 }
13765         }
13766 }
13767 impl Clone for CResult_PongDecodeErrorZ {
13768         fn clone(&self) -> Self {
13769                 if self.result_ok {
13770                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
13771                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
13772                         } }
13773                 } else {
13774                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
13775                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13776                         } }
13777                 }
13778         }
13779 }
13780 #[no_mangle]
13781 /// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
13782 /// but with all dynamically-allocated buffers duplicated in new buffers.
13783 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) }
13784 #[repr(C)]
13785 /// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
13786 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13787         /// A pointer to the contents in the success state.
13788         /// Reading from this pointer when `result_ok` is not set is undefined.
13789         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement,
13790         /// A pointer to the contents in the error state.
13791         /// Reading from this pointer when `result_ok` is set is undefined.
13792         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13793 }
13794 #[repr(C)]
13795 /// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13796 /// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13797 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13798 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13799         /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
13800         /// `err` or `result` depending on the state of `result_ok`.
13801         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
13802         /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
13803         pub result_ok: bool,
13804 }
13805 #[no_mangle]
13806 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
13807 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13808         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13809                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13810                         result: Box::into_raw(Box::new(o)),
13811                 },
13812                 result_ok: true,
13813         }
13814 }
13815 #[no_mangle]
13816 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
13817 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13818         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13819                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13820                         err: Box::into_raw(Box::new(e)),
13821                 },
13822                 result_ok: false,
13823         }
13824 }
13825 /// Checks if the given object is currently in the success state
13826 #[no_mangle]
13827 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool {
13828         o.result_ok
13829 }
13830 #[no_mangle]
13831 /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
13832 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
13833 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13834         fn drop(&mut self) {
13835                 if self.result_ok {
13836                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13837                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13838                         }
13839                 } else {
13840                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13841                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13842                         }
13843                 }
13844         }
13845 }
13846 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13847         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13848                 let contents = if o.result_ok {
13849                         let result = unsafe { o.contents.result };
13850                         unsafe { o.contents.result = core::ptr::null_mut() };
13851                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
13852                 } else {
13853                         let err = unsafe { o.contents.err };
13854                         unsafe { o.contents.err = core::ptr::null_mut(); }
13855                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
13856                 };
13857                 Self {
13858                         contents,
13859                         result_ok: o.result_ok,
13860                 }
13861         }
13862 }
13863 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
13864         fn clone(&self) -> Self {
13865                 if self.result_ok {
13866                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13867                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13868                         } }
13869                 } else {
13870                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
13871                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13872                         } }
13873                 }
13874         }
13875 }
13876 #[no_mangle]
13877 /// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13878 /// but with all dynamically-allocated buffers duplicated in new buffers.
13879 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13880 #[repr(C)]
13881 /// The contents of CResult_ChannelAnnouncementDecodeErrorZ
13882 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
13883         /// A pointer to the contents in the success state.
13884         /// Reading from this pointer when `result_ok` is not set is undefined.
13885         pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement,
13886         /// A pointer to the contents in the error state.
13887         /// Reading from this pointer when `result_ok` is set is undefined.
13888         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13889 }
13890 #[repr(C)]
13891 /// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
13892 /// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
13893 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13894 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
13895         /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
13896         /// `err` or `result` depending on the state of `result_ok`.
13897         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
13898         /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
13899         pub result_ok: bool,
13900 }
13901 #[no_mangle]
13902 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
13903 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
13904         CResult_ChannelAnnouncementDecodeErrorZ {
13905                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13906                         result: Box::into_raw(Box::new(o)),
13907                 },
13908                 result_ok: true,
13909         }
13910 }
13911 #[no_mangle]
13912 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
13913 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
13914         CResult_ChannelAnnouncementDecodeErrorZ {
13915                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13916                         err: Box::into_raw(Box::new(e)),
13917                 },
13918                 result_ok: false,
13919         }
13920 }
13921 /// Checks if the given object is currently in the success state
13922 #[no_mangle]
13923 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool {
13924         o.result_ok
13925 }
13926 #[no_mangle]
13927 /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
13928 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
13929 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
13930         fn drop(&mut self) {
13931                 if self.result_ok {
13932                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
13933                                 let _ = unsafe { Box::from_raw(self.contents.result) };
13934                         }
13935                 } else {
13936                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
13937                                 let _ = unsafe { Box::from_raw(self.contents.err) };
13938                         }
13939                 }
13940         }
13941 }
13942 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
13943         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
13944                 let contents = if o.result_ok {
13945                         let result = unsafe { o.contents.result };
13946                         unsafe { o.contents.result = core::ptr::null_mut() };
13947                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
13948                 } else {
13949                         let err = unsafe { o.contents.err };
13950                         unsafe { o.contents.err = core::ptr::null_mut(); }
13951                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
13952                 };
13953                 Self {
13954                         contents,
13955                         result_ok: o.result_ok,
13956                 }
13957         }
13958 }
13959 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
13960         fn clone(&self) -> Self {
13961                 if self.result_ok {
13962                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13963                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
13964                         } }
13965                 } else {
13966                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
13967                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
13968                         } }
13969                 }
13970         }
13971 }
13972 #[no_mangle]
13973 /// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
13974 /// but with all dynamically-allocated buffers duplicated in new buffers.
13975 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) }
13976 #[repr(C)]
13977 /// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
13978 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
13979         /// A pointer to the contents in the success state.
13980         /// Reading from this pointer when `result_ok` is not set is undefined.
13981         pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate,
13982         /// A pointer to the contents in the error state.
13983         /// Reading from this pointer when `result_ok` is set is undefined.
13984         pub err: *mut crate::lightning::ln::msgs::DecodeError,
13985 }
13986 #[repr(C)]
13987 /// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
13988 /// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
13989 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
13990 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
13991         /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
13992         /// `err` or `result` depending on the state of `result_ok`.
13993         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
13994         /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
13995         pub result_ok: bool,
13996 }
13997 #[no_mangle]
13998 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
13999 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14000         CResult_UnsignedChannelUpdateDecodeErrorZ {
14001                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14002                         result: Box::into_raw(Box::new(o)),
14003                 },
14004                 result_ok: true,
14005         }
14006 }
14007 #[no_mangle]
14008 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
14009 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
14010         CResult_UnsignedChannelUpdateDecodeErrorZ {
14011                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14012                         err: Box::into_raw(Box::new(e)),
14013                 },
14014                 result_ok: false,
14015         }
14016 }
14017 /// Checks if the given object is currently in the success state
14018 #[no_mangle]
14019 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool {
14020         o.result_ok
14021 }
14022 #[no_mangle]
14023 /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
14024 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
14025 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
14026         fn drop(&mut self) {
14027                 if self.result_ok {
14028                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14029                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14030                         }
14031                 } else {
14032                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14033                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14034                         }
14035                 }
14036         }
14037 }
14038 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
14039         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14040                 let contents = if o.result_ok {
14041                         let result = unsafe { o.contents.result };
14042                         unsafe { o.contents.result = core::ptr::null_mut() };
14043                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
14044                 } else {
14045                         let err = unsafe { o.contents.err };
14046                         unsafe { o.contents.err = core::ptr::null_mut(); }
14047                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
14048                 };
14049                 Self {
14050                         contents,
14051                         result_ok: o.result_ok,
14052                 }
14053         }
14054 }
14055 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
14056         fn clone(&self) -> Self {
14057                 if self.result_ok {
14058                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14059                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
14060                         } }
14061                 } else {
14062                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
14063                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14064                         } }
14065                 }
14066         }
14067 }
14068 #[no_mangle]
14069 /// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
14070 /// but with all dynamically-allocated buffers duplicated in new buffers.
14071 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14072 #[repr(C)]
14073 /// The contents of CResult_ChannelUpdateDecodeErrorZ
14074 pub union CResult_ChannelUpdateDecodeErrorZPtr {
14075         /// A pointer to the contents in the success state.
14076         /// Reading from this pointer when `result_ok` is not set is undefined.
14077         pub result: *mut crate::lightning::ln::msgs::ChannelUpdate,
14078         /// A pointer to the contents in the error state.
14079         /// Reading from this pointer when `result_ok` is set is undefined.
14080         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14081 }
14082 #[repr(C)]
14083 /// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
14084 /// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
14085 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14086 pub struct CResult_ChannelUpdateDecodeErrorZ {
14087         /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
14088         /// `err` or `result` depending on the state of `result_ok`.
14089         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
14090         /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
14091         pub result_ok: bool,
14092 }
14093 #[no_mangle]
14094 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
14095 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
14096         CResult_ChannelUpdateDecodeErrorZ {
14097                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14098                         result: Box::into_raw(Box::new(o)),
14099                 },
14100                 result_ok: true,
14101         }
14102 }
14103 #[no_mangle]
14104 /// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
14105 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
14106         CResult_ChannelUpdateDecodeErrorZ {
14107                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
14108                         err: Box::into_raw(Box::new(e)),
14109                 },
14110                 result_ok: false,
14111         }
14112 }
14113 /// Checks if the given object is currently in the success state
14114 #[no_mangle]
14115 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool {
14116         o.result_ok
14117 }
14118 #[no_mangle]
14119 /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
14120 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
14121 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
14122         fn drop(&mut self) {
14123                 if self.result_ok {
14124                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14125                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14126                         }
14127                 } else {
14128                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14129                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14130                         }
14131                 }
14132         }
14133 }
14134 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
14135         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::DecodeError>) -> Self {
14136                 let contents = if o.result_ok {
14137                         let result = unsafe { o.contents.result };
14138                         unsafe { o.contents.result = core::ptr::null_mut() };
14139                         CResult_ChannelUpdateDecodeErrorZPtr { result }
14140                 } else {
14141                         let err = unsafe { o.contents.err };
14142                         unsafe { o.contents.err = core::ptr::null_mut(); }
14143                         CResult_ChannelUpdateDecodeErrorZPtr { err }
14144                 };
14145                 Self {
14146                         contents,
14147                         result_ok: o.result_ok,
14148                 }
14149         }
14150 }
14151 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
14152         fn clone(&self) -> Self {
14153                 if self.result_ok {
14154                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14155                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
14156                         } }
14157                 } else {
14158                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
14159                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14160                         } }
14161                 }
14162         }
14163 }
14164 #[no_mangle]
14165 /// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
14166 /// but with all dynamically-allocated buffers duplicated in new buffers.
14167 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) }
14168 #[repr(C)]
14169 /// The contents of CResult_ErrorMessageDecodeErrorZ
14170 pub union CResult_ErrorMessageDecodeErrorZPtr {
14171         /// A pointer to the contents in the success state.
14172         /// Reading from this pointer when `result_ok` is not set is undefined.
14173         pub result: *mut crate::lightning::ln::msgs::ErrorMessage,
14174         /// A pointer to the contents in the error state.
14175         /// Reading from this pointer when `result_ok` is set is undefined.
14176         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14177 }
14178 #[repr(C)]
14179 /// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
14180 /// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14181 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14182 pub struct CResult_ErrorMessageDecodeErrorZ {
14183         /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
14184         /// `err` or `result` depending on the state of `result_ok`.
14185         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
14186         /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
14187         pub result_ok: bool,
14188 }
14189 #[no_mangle]
14190 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
14191 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
14192         CResult_ErrorMessageDecodeErrorZ {
14193                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14194                         result: Box::into_raw(Box::new(o)),
14195                 },
14196                 result_ok: true,
14197         }
14198 }
14199 #[no_mangle]
14200 /// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
14201 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
14202         CResult_ErrorMessageDecodeErrorZ {
14203                 contents: CResult_ErrorMessageDecodeErrorZPtr {
14204                         err: Box::into_raw(Box::new(e)),
14205                 },
14206                 result_ok: false,
14207         }
14208 }
14209 /// Checks if the given object is currently in the success state
14210 #[no_mangle]
14211 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool {
14212         o.result_ok
14213 }
14214 #[no_mangle]
14215 /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
14216 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
14217 impl Drop for CResult_ErrorMessageDecodeErrorZ {
14218         fn drop(&mut self) {
14219                 if self.result_ok {
14220                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14221                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14222                         }
14223                 } else {
14224                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14225                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14226                         }
14227                 }
14228         }
14229 }
14230 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
14231         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ErrorMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14232                 let contents = if o.result_ok {
14233                         let result = unsafe { o.contents.result };
14234                         unsafe { o.contents.result = core::ptr::null_mut() };
14235                         CResult_ErrorMessageDecodeErrorZPtr { result }
14236                 } else {
14237                         let err = unsafe { o.contents.err };
14238                         unsafe { o.contents.err = core::ptr::null_mut(); }
14239                         CResult_ErrorMessageDecodeErrorZPtr { err }
14240                 };
14241                 Self {
14242                         contents,
14243                         result_ok: o.result_ok,
14244                 }
14245         }
14246 }
14247 impl Clone for CResult_ErrorMessageDecodeErrorZ {
14248         fn clone(&self) -> Self {
14249                 if self.result_ok {
14250                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
14251                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
14252                         } }
14253                 } else {
14254                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
14255                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14256                         } }
14257                 }
14258         }
14259 }
14260 #[no_mangle]
14261 /// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
14262 /// but with all dynamically-allocated buffers duplicated in new buffers.
14263 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) }
14264 #[repr(C)]
14265 /// The contents of CResult_WarningMessageDecodeErrorZ
14266 pub union CResult_WarningMessageDecodeErrorZPtr {
14267         /// A pointer to the contents in the success state.
14268         /// Reading from this pointer when `result_ok` is not set is undefined.
14269         pub result: *mut crate::lightning::ln::msgs::WarningMessage,
14270         /// A pointer to the contents in the error state.
14271         /// Reading from this pointer when `result_ok` is set is undefined.
14272         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14273 }
14274 #[repr(C)]
14275 /// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
14276 /// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
14277 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14278 pub struct CResult_WarningMessageDecodeErrorZ {
14279         /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
14280         /// `err` or `result` depending on the state of `result_ok`.
14281         pub contents: CResult_WarningMessageDecodeErrorZPtr,
14282         /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
14283         pub result_ok: bool,
14284 }
14285 #[no_mangle]
14286 /// Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
14287 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ {
14288         CResult_WarningMessageDecodeErrorZ {
14289                 contents: CResult_WarningMessageDecodeErrorZPtr {
14290                         result: Box::into_raw(Box::new(o)),
14291                 },
14292                 result_ok: true,
14293         }
14294 }
14295 #[no_mangle]
14296 /// Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
14297 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ {
14298         CResult_WarningMessageDecodeErrorZ {
14299                 contents: CResult_WarningMessageDecodeErrorZPtr {
14300                         err: Box::into_raw(Box::new(e)),
14301                 },
14302                 result_ok: false,
14303         }
14304 }
14305 /// Checks if the given object is currently in the success state
14306 #[no_mangle]
14307 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool {
14308         o.result_ok
14309 }
14310 #[no_mangle]
14311 /// Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
14312 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { }
14313 impl Drop for CResult_WarningMessageDecodeErrorZ {
14314         fn drop(&mut self) {
14315                 if self.result_ok {
14316                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14317                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14318                         }
14319                 } else {
14320                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14321                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14322                         }
14323                 }
14324         }
14325 }
14326 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>> for CResult_WarningMessageDecodeErrorZ {
14327         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::WarningMessage, crate::lightning::ln::msgs::DecodeError>) -> Self {
14328                 let contents = if o.result_ok {
14329                         let result = unsafe { o.contents.result };
14330                         unsafe { o.contents.result = core::ptr::null_mut() };
14331                         CResult_WarningMessageDecodeErrorZPtr { result }
14332                 } else {
14333                         let err = unsafe { o.contents.err };
14334                         unsafe { o.contents.err = core::ptr::null_mut(); }
14335                         CResult_WarningMessageDecodeErrorZPtr { err }
14336                 };
14337                 Self {
14338                         contents,
14339                         result_ok: o.result_ok,
14340                 }
14341         }
14342 }
14343 impl Clone for CResult_WarningMessageDecodeErrorZ {
14344         fn clone(&self) -> Self {
14345                 if self.result_ok {
14346                         Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr {
14347                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::WarningMessage>::clone(unsafe { &*self.contents.result })))
14348                         } }
14349                 } else {
14350                         Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr {
14351                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14352                         } }
14353                 }
14354         }
14355 }
14356 #[no_mangle]
14357 /// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
14358 /// but with all dynamically-allocated buffers duplicated in new buffers.
14359 pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) }
14360 #[repr(C)]
14361 /// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
14362 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14363         /// A pointer to the contents in the success state.
14364         /// Reading from this pointer when `result_ok` is not set is undefined.
14365         pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement,
14366         /// A pointer to the contents in the error state.
14367         /// Reading from this pointer when `result_ok` is set is undefined.
14368         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14369 }
14370 #[repr(C)]
14371 /// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14372 /// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14373 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14374 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14375         /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
14376         /// `err` or `result` depending on the state of `result_ok`.
14377         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
14378         /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
14379         pub result_ok: bool,
14380 }
14381 #[no_mangle]
14382 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
14383 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14384         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14385                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14386                         result: Box::into_raw(Box::new(o)),
14387                 },
14388                 result_ok: true,
14389         }
14390 }
14391 #[no_mangle]
14392 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
14393 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14394         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14395                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14396                         err: Box::into_raw(Box::new(e)),
14397                 },
14398                 result_ok: false,
14399         }
14400 }
14401 /// Checks if the given object is currently in the success state
14402 #[no_mangle]
14403 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool {
14404         o.result_ok
14405 }
14406 #[no_mangle]
14407 /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
14408 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
14409 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14410         fn drop(&mut self) {
14411                 if self.result_ok {
14412                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14413                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14414                         }
14415                 } else {
14416                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14417                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14418                         }
14419                 }
14420         }
14421 }
14422 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14423         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::UnsignedNodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14424                 let contents = if o.result_ok {
14425                         let result = unsafe { o.contents.result };
14426                         unsafe { o.contents.result = core::ptr::null_mut() };
14427                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
14428                 } else {
14429                         let err = unsafe { o.contents.err };
14430                         unsafe { o.contents.err = core::ptr::null_mut(); }
14431                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
14432                 };
14433                 Self {
14434                         contents,
14435                         result_ok: o.result_ok,
14436                 }
14437         }
14438 }
14439 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
14440         fn clone(&self) -> Self {
14441                 if self.result_ok {
14442                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14443                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14444                         } }
14445                 } else {
14446                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
14447                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14448                         } }
14449                 }
14450         }
14451 }
14452 #[no_mangle]
14453 /// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
14454 /// but with all dynamically-allocated buffers duplicated in new buffers.
14455 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14456 #[repr(C)]
14457 /// The contents of CResult_NodeAnnouncementDecodeErrorZ
14458 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
14459         /// A pointer to the contents in the success state.
14460         /// Reading from this pointer when `result_ok` is not set is undefined.
14461         pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement,
14462         /// A pointer to the contents in the error state.
14463         /// Reading from this pointer when `result_ok` is set is undefined.
14464         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14465 }
14466 #[repr(C)]
14467 /// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
14468 /// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
14469 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14470 pub struct CResult_NodeAnnouncementDecodeErrorZ {
14471         /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
14472         /// `err` or `result` depending on the state of `result_ok`.
14473         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
14474         /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
14475         pub result_ok: bool,
14476 }
14477 #[no_mangle]
14478 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
14479 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
14480         CResult_NodeAnnouncementDecodeErrorZ {
14481                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14482                         result: Box::into_raw(Box::new(o)),
14483                 },
14484                 result_ok: true,
14485         }
14486 }
14487 #[no_mangle]
14488 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
14489 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
14490         CResult_NodeAnnouncementDecodeErrorZ {
14491                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14492                         err: Box::into_raw(Box::new(e)),
14493                 },
14494                 result_ok: false,
14495         }
14496 }
14497 /// Checks if the given object is currently in the success state
14498 #[no_mangle]
14499 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool {
14500         o.result_ok
14501 }
14502 #[no_mangle]
14503 /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
14504 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
14505 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
14506         fn drop(&mut self) {
14507                 if self.result_ok {
14508                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14509                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14510                         }
14511                 } else {
14512                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14513                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14514                         }
14515                 }
14516         }
14517 }
14518 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
14519         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::NodeAnnouncement, crate::lightning::ln::msgs::DecodeError>) -> Self {
14520                 let contents = if o.result_ok {
14521                         let result = unsafe { o.contents.result };
14522                         unsafe { o.contents.result = core::ptr::null_mut() };
14523                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
14524                 } else {
14525                         let err = unsafe { o.contents.err };
14526                         unsafe { o.contents.err = core::ptr::null_mut(); }
14527                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
14528                 };
14529                 Self {
14530                         contents,
14531                         result_ok: o.result_ok,
14532                 }
14533         }
14534 }
14535 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
14536         fn clone(&self) -> Self {
14537                 if self.result_ok {
14538                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14539                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
14540                         } }
14541                 } else {
14542                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
14543                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14544                         } }
14545                 }
14546         }
14547 }
14548 #[no_mangle]
14549 /// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
14550 /// but with all dynamically-allocated buffers duplicated in new buffers.
14551 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) }
14552 #[repr(C)]
14553 /// The contents of CResult_QueryShortChannelIdsDecodeErrorZ
14554 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
14555         /// A pointer to the contents in the success state.
14556         /// Reading from this pointer when `result_ok` is not set is undefined.
14557         pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds,
14558         /// A pointer to the contents in the error state.
14559         /// Reading from this pointer when `result_ok` is set is undefined.
14560         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14561 }
14562 #[repr(C)]
14563 /// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
14564 /// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
14565 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14566 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
14567         /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
14568         /// `err` or `result` depending on the state of `result_ok`.
14569         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
14570         /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
14571         pub result_ok: bool,
14572 }
14573 #[no_mangle]
14574 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
14575 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14576         CResult_QueryShortChannelIdsDecodeErrorZ {
14577                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14578                         result: Box::into_raw(Box::new(o)),
14579                 },
14580                 result_ok: true,
14581         }
14582 }
14583 #[no_mangle]
14584 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
14585 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
14586         CResult_QueryShortChannelIdsDecodeErrorZ {
14587                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14588                         err: Box::into_raw(Box::new(e)),
14589                 },
14590                 result_ok: false,
14591         }
14592 }
14593 /// Checks if the given object is currently in the success state
14594 #[no_mangle]
14595 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool {
14596         o.result_ok
14597 }
14598 #[no_mangle]
14599 /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
14600 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
14601 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
14602         fn drop(&mut self) {
14603                 if self.result_ok {
14604                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14605                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14606                         }
14607                 } else {
14608                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14609                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14610                         }
14611                 }
14612         }
14613 }
14614 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
14615         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryShortChannelIds, crate::lightning::ln::msgs::DecodeError>) -> Self {
14616                 let contents = if o.result_ok {
14617                         let result = unsafe { o.contents.result };
14618                         unsafe { o.contents.result = core::ptr::null_mut() };
14619                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
14620                 } else {
14621                         let err = unsafe { o.contents.err };
14622                         unsafe { o.contents.err = core::ptr::null_mut(); }
14623                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
14624                 };
14625                 Self {
14626                         contents,
14627                         result_ok: o.result_ok,
14628                 }
14629         }
14630 }
14631 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
14632         fn clone(&self) -> Self {
14633                 if self.result_ok {
14634                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14635                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
14636                         } }
14637                 } else {
14638                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
14639                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14640                         } }
14641                 }
14642         }
14643 }
14644 #[no_mangle]
14645 /// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
14646 /// but with all dynamically-allocated buffers duplicated in new buffers.
14647 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) }
14648 #[repr(C)]
14649 /// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
14650 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14651         /// A pointer to the contents in the success state.
14652         /// Reading from this pointer when `result_ok` is not set is undefined.
14653         pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd,
14654         /// A pointer to the contents in the error state.
14655         /// Reading from this pointer when `result_ok` is set is undefined.
14656         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14657 }
14658 #[repr(C)]
14659 /// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
14660 /// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
14661 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14662 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14663         /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
14664         /// `err` or `result` depending on the state of `result_ok`.
14665         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
14666         /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
14667         pub result_ok: bool,
14668 }
14669 #[no_mangle]
14670 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
14671 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14672         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14673                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14674                         result: Box::into_raw(Box::new(o)),
14675                 },
14676                 result_ok: true,
14677         }
14678 }
14679 #[no_mangle]
14680 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
14681 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14682         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14683                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14684                         err: Box::into_raw(Box::new(e)),
14685                 },
14686                 result_ok: false,
14687         }
14688 }
14689 /// Checks if the given object is currently in the success state
14690 #[no_mangle]
14691 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool {
14692         o.result_ok
14693 }
14694 #[no_mangle]
14695 /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
14696 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
14697 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14698         fn drop(&mut self) {
14699                 if self.result_ok {
14700                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14701                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14702                         }
14703                 } else {
14704                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14705                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14706                         }
14707                 }
14708         }
14709 }
14710 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14711         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, crate::lightning::ln::msgs::DecodeError>) -> Self {
14712                 let contents = if o.result_ok {
14713                         let result = unsafe { o.contents.result };
14714                         unsafe { o.contents.result = core::ptr::null_mut() };
14715                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
14716                 } else {
14717                         let err = unsafe { o.contents.err };
14718                         unsafe { o.contents.err = core::ptr::null_mut(); }
14719                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
14720                 };
14721                 Self {
14722                         contents,
14723                         result_ok: o.result_ok,
14724                 }
14725         }
14726 }
14727 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
14728         fn clone(&self) -> Self {
14729                 if self.result_ok {
14730                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14731                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
14732                         } }
14733                 } else {
14734                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
14735                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14736                         } }
14737                 }
14738         }
14739 }
14740 #[no_mangle]
14741 /// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
14742 /// but with all dynamically-allocated buffers duplicated in new buffers.
14743 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) }
14744 #[repr(C)]
14745 /// The contents of CResult_QueryChannelRangeDecodeErrorZ
14746 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
14747         /// A pointer to the contents in the success state.
14748         /// Reading from this pointer when `result_ok` is not set is undefined.
14749         pub result: *mut crate::lightning::ln::msgs::QueryChannelRange,
14750         /// A pointer to the contents in the error state.
14751         /// Reading from this pointer when `result_ok` is set is undefined.
14752         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14753 }
14754 #[repr(C)]
14755 /// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
14756 /// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14757 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14758 pub struct CResult_QueryChannelRangeDecodeErrorZ {
14759         /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
14760         /// `err` or `result` depending on the state of `result_ok`.
14761         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
14762         /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
14763         pub result_ok: bool,
14764 }
14765 #[no_mangle]
14766 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
14767 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
14768         CResult_QueryChannelRangeDecodeErrorZ {
14769                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14770                         result: Box::into_raw(Box::new(o)),
14771                 },
14772                 result_ok: true,
14773         }
14774 }
14775 #[no_mangle]
14776 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
14777 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
14778         CResult_QueryChannelRangeDecodeErrorZ {
14779                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14780                         err: Box::into_raw(Box::new(e)),
14781                 },
14782                 result_ok: false,
14783         }
14784 }
14785 /// Checks if the given object is currently in the success state
14786 #[no_mangle]
14787 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool {
14788         o.result_ok
14789 }
14790 #[no_mangle]
14791 /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
14792 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
14793 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
14794         fn drop(&mut self) {
14795                 if self.result_ok {
14796                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14797                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14798                         }
14799                 } else {
14800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14802                         }
14803                 }
14804         }
14805 }
14806 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
14807         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::QueryChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14808                 let contents = if o.result_ok {
14809                         let result = unsafe { o.contents.result };
14810                         unsafe { o.contents.result = core::ptr::null_mut() };
14811                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
14812                 } else {
14813                         let err = unsafe { o.contents.err };
14814                         unsafe { o.contents.err = core::ptr::null_mut(); }
14815                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
14816                 };
14817                 Self {
14818                         contents,
14819                         result_ok: o.result_ok,
14820                 }
14821         }
14822 }
14823 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
14824         fn clone(&self) -> Self {
14825                 if self.result_ok {
14826                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14827                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
14828                         } }
14829                 } else {
14830                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
14831                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14832                         } }
14833                 }
14834         }
14835 }
14836 #[no_mangle]
14837 /// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
14838 /// but with all dynamically-allocated buffers duplicated in new buffers.
14839 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14840 #[repr(C)]
14841 /// The contents of CResult_ReplyChannelRangeDecodeErrorZ
14842 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
14843         /// A pointer to the contents in the success state.
14844         /// Reading from this pointer when `result_ok` is not set is undefined.
14845         pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange,
14846         /// A pointer to the contents in the error state.
14847         /// Reading from this pointer when `result_ok` is set is undefined.
14848         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14849 }
14850 #[repr(C)]
14851 /// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
14852 /// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
14853 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14854 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
14855         /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
14856         /// `err` or `result` depending on the state of `result_ok`.
14857         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
14858         /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
14859         pub result_ok: bool,
14860 }
14861 #[no_mangle]
14862 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
14863 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
14864         CResult_ReplyChannelRangeDecodeErrorZ {
14865                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14866                         result: Box::into_raw(Box::new(o)),
14867                 },
14868                 result_ok: true,
14869         }
14870 }
14871 #[no_mangle]
14872 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
14873 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
14874         CResult_ReplyChannelRangeDecodeErrorZ {
14875                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14876                         err: Box::into_raw(Box::new(e)),
14877                 },
14878                 result_ok: false,
14879         }
14880 }
14881 /// Checks if the given object is currently in the success state
14882 #[no_mangle]
14883 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool {
14884         o.result_ok
14885 }
14886 #[no_mangle]
14887 /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
14888 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
14889 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
14890         fn drop(&mut self) {
14891                 if self.result_ok {
14892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14894                         }
14895                 } else {
14896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14898                         }
14899                 }
14900         }
14901 }
14902 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
14903         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::ReplyChannelRange, crate::lightning::ln::msgs::DecodeError>) -> Self {
14904                 let contents = if o.result_ok {
14905                         let result = unsafe { o.contents.result };
14906                         unsafe { o.contents.result = core::ptr::null_mut() };
14907                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
14908                 } else {
14909                         let err = unsafe { o.contents.err };
14910                         unsafe { o.contents.err = core::ptr::null_mut(); }
14911                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
14912                 };
14913                 Self {
14914                         contents,
14915                         result_ok: o.result_ok,
14916                 }
14917         }
14918 }
14919 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
14920         fn clone(&self) -> Self {
14921                 if self.result_ok {
14922                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14923                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
14924                         } }
14925                 } else {
14926                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
14927                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
14928                         } }
14929                 }
14930         }
14931 }
14932 #[no_mangle]
14933 /// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
14934 /// but with all dynamically-allocated buffers duplicated in new buffers.
14935 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) }
14936 #[repr(C)]
14937 /// The contents of CResult_GossipTimestampFilterDecodeErrorZ
14938 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
14939         /// A pointer to the contents in the success state.
14940         /// Reading from this pointer when `result_ok` is not set is undefined.
14941         pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter,
14942         /// A pointer to the contents in the error state.
14943         /// Reading from this pointer when `result_ok` is set is undefined.
14944         pub err: *mut crate::lightning::ln::msgs::DecodeError,
14945 }
14946 #[repr(C)]
14947 /// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
14948 /// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
14949 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
14950 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
14951         /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
14952         /// `err` or `result` depending on the state of `result_ok`.
14953         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
14954         /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
14955         pub result_ok: bool,
14956 }
14957 #[no_mangle]
14958 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
14959 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
14960         CResult_GossipTimestampFilterDecodeErrorZ {
14961                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14962                         result: Box::into_raw(Box::new(o)),
14963                 },
14964                 result_ok: true,
14965         }
14966 }
14967 #[no_mangle]
14968 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
14969 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
14970         CResult_GossipTimestampFilterDecodeErrorZ {
14971                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
14972                         err: Box::into_raw(Box::new(e)),
14973                 },
14974                 result_ok: false,
14975         }
14976 }
14977 /// Checks if the given object is currently in the success state
14978 #[no_mangle]
14979 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool {
14980         o.result_ok
14981 }
14982 #[no_mangle]
14983 /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
14984 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
14985 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
14986         fn drop(&mut self) {
14987                 if self.result_ok {
14988                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
14989                                 let _ = unsafe { Box::from_raw(self.contents.result) };
14990                         }
14991                 } else {
14992                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
14993                                 let _ = unsafe { Box::from_raw(self.contents.err) };
14994                         }
14995                 }
14996         }
14997 }
14998 impl From<crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
14999         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::ln::msgs::GossipTimestampFilter, crate::lightning::ln::msgs::DecodeError>) -> Self {
15000                 let contents = if o.result_ok {
15001                         let result = unsafe { o.contents.result };
15002                         unsafe { o.contents.result = core::ptr::null_mut() };
15003                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
15004                 } else {
15005                         let err = unsafe { o.contents.err };
15006                         unsafe { o.contents.err = core::ptr::null_mut(); }
15007                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
15008                 };
15009                 Self {
15010                         contents,
15011                         result_ok: o.result_ok,
15012                 }
15013         }
15014 }
15015 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
15016         fn clone(&self) -> Self {
15017                 if self.result_ok {
15018                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15019                                 result: Box::into_raw(Box::new(<crate::lightning::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
15020                         } }
15021                 } else {
15022                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
15023                                 err: Box::into_raw(Box::new(<crate::lightning::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
15024                         } }
15025                 }
15026         }
15027 }
15028 #[no_mangle]
15029 /// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
15030 /// but with all dynamically-allocated buffers duplicated in new buffers.
15031 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) }
15032 #[repr(C)]
15033 /// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
15034 /// This corresponds to std::vector in C++
15035 pub struct CVec_PhantomRouteHintsZ {
15036         /// The elements in the array.
15037         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15038         pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints,
15039         /// The number of elements pointed to by `data`.
15040         pub datalen: usize
15041 }
15042 impl CVec_PhantomRouteHintsZ {
15043         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::ln::channelmanager::PhantomRouteHints> {
15044                 if self.datalen == 0 { return Vec::new(); }
15045                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15046                 self.data = core::ptr::null_mut();
15047                 self.datalen = 0;
15048                 ret
15049         }
15050         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] {
15051                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15052         }
15053 }
15054 impl From<Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>> for CVec_PhantomRouteHintsZ {
15055         fn from(v: Vec<crate::lightning::ln::channelmanager::PhantomRouteHints>) -> Self {
15056                 let datalen = v.len();
15057                 let data = Box::into_raw(v.into_boxed_slice());
15058                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15059         }
15060 }
15061 #[no_mangle]
15062 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15063 pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { }
15064 impl Drop for CVec_PhantomRouteHintsZ {
15065         fn drop(&mut self) {
15066                 if self.datalen == 0 { return; }
15067                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15068         }
15069 }
15070 #[repr(C)]
15071 /// The contents of CResult_InvoiceSignOrCreationErrorZ
15072 pub union CResult_InvoiceSignOrCreationErrorZPtr {
15073         /// A pointer to the contents in the success state.
15074         /// Reading from this pointer when `result_ok` is not set is undefined.
15075         pub result: *mut crate::lightning_invoice::Invoice,
15076         /// A pointer to the contents in the error state.
15077         /// Reading from this pointer when `result_ok` is set is undefined.
15078         pub err: *mut crate::lightning_invoice::SignOrCreationError,
15079 }
15080 #[repr(C)]
15081 /// A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
15082 /// containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
15083 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15084 pub struct CResult_InvoiceSignOrCreationErrorZ {
15085         /// The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
15086         /// `err` or `result` depending on the state of `result_ok`.
15087         pub contents: CResult_InvoiceSignOrCreationErrorZPtr,
15088         /// Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
15089         pub result_ok: bool,
15090 }
15091 #[no_mangle]
15092 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
15093 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSignOrCreationErrorZ {
15094         CResult_InvoiceSignOrCreationErrorZ {
15095                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15096                         result: Box::into_raw(Box::new(o)),
15097                 },
15098                 result_ok: true,
15099         }
15100 }
15101 #[no_mangle]
15102 /// Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
15103 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_InvoiceSignOrCreationErrorZ {
15104         CResult_InvoiceSignOrCreationErrorZ {
15105                 contents: CResult_InvoiceSignOrCreationErrorZPtr {
15106                         err: Box::into_raw(Box::new(e)),
15107                 },
15108                 result_ok: false,
15109         }
15110 }
15111 /// Checks if the given object is currently in the success state
15112 #[no_mangle]
15113 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool {
15114         o.result_ok
15115 }
15116 #[no_mangle]
15117 /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
15118 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { }
15119 impl Drop for CResult_InvoiceSignOrCreationErrorZ {
15120         fn drop(&mut self) {
15121                 if self.result_ok {
15122                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15123                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15124                         }
15125                 } else {
15126                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
15127                                 let _ = unsafe { Box::from_raw(self.contents.err) };
15128                         }
15129                 }
15130         }
15131 }
15132 impl From<crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>> for CResult_InvoiceSignOrCreationErrorZ {
15133         fn from(mut o: crate::c_types::CResultTempl<crate::lightning_invoice::Invoice, crate::lightning_invoice::SignOrCreationError>) -> Self {
15134                 let contents = if o.result_ok {
15135                         let result = unsafe { o.contents.result };
15136                         unsafe { o.contents.result = core::ptr::null_mut() };
15137                         CResult_InvoiceSignOrCreationErrorZPtr { result }
15138                 } else {
15139                         let err = unsafe { o.contents.err };
15140                         unsafe { o.contents.err = core::ptr::null_mut(); }
15141                         CResult_InvoiceSignOrCreationErrorZPtr { err }
15142                 };
15143                 Self {
15144                         contents,
15145                         result_ok: o.result_ok,
15146                 }
15147         }
15148 }
15149 impl Clone for CResult_InvoiceSignOrCreationErrorZ {
15150         fn clone(&self) -> Self {
15151                 if self.result_ok {
15152                         Self { result_ok: true, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15153                                 result: Box::into_raw(Box::new(<crate::lightning_invoice::Invoice>::clone(unsafe { &*self.contents.result })))
15154                         } }
15155                 } else {
15156                         Self { result_ok: false, contents: CResult_InvoiceSignOrCreationErrorZPtr {
15157                                 err: Box::into_raw(Box::new(<crate::lightning_invoice::SignOrCreationError>::clone(unsafe { &*self.contents.err })))
15158                         } }
15159                 }
15160         }
15161 }
15162 #[no_mangle]
15163 /// Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
15164 /// but with all dynamically-allocated buffers duplicated in new buffers.
15165 pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_clone(orig: &CResult_InvoiceSignOrCreationErrorZ) -> CResult_InvoiceSignOrCreationErrorZ { Clone::clone(&orig) }
15166 #[repr(C)]
15167 /// An enum which can either contain a crate::lightning::chain::Filter or not
15168 pub enum COption_FilterZ {
15169         /// When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
15170         Some(crate::lightning::chain::Filter),
15171         /// When we're in this state, this COption_FilterZ contains nothing
15172         None
15173 }
15174 impl COption_FilterZ {
15175         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
15176                 if let Self::None = self { false } else { true }
15177         }
15178         #[allow(unused)] pub(crate) fn is_none(&self) -> bool {
15179                 !self.is_some()
15180         }
15181         #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::Filter {
15182                 if let Self::Some(v) = self { v } else { unreachable!() }
15183         }
15184 }
15185 #[no_mangle]
15186 /// Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
15187 pub extern "C" fn COption_FilterZ_some(o: crate::lightning::chain::Filter) -> COption_FilterZ {
15188         COption_FilterZ::Some(o)
15189 }
15190 #[no_mangle]
15191 /// Constructs a new COption_FilterZ containing nothing
15192 pub extern "C" fn COption_FilterZ_none() -> COption_FilterZ {
15193         COption_FilterZ::None
15194 }
15195 #[no_mangle]
15196 /// Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
15197 pub extern "C" fn COption_FilterZ_free(_res: COption_FilterZ) { }
15198 #[repr(C)]
15199 /// The contents of CResult_LockedChannelMonitorNoneZ
15200 pub union CResult_LockedChannelMonitorNoneZPtr {
15201         /// A pointer to the contents in the success state.
15202         /// Reading from this pointer when `result_ok` is not set is undefined.
15203         pub result: *mut crate::lightning::chain::chainmonitor::LockedChannelMonitor,
15204         /// Note that this value is always NULL, as there are no contents in the Err variant
15205         pub err: *mut core::ffi::c_void,
15206 }
15207 #[repr(C)]
15208 /// A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
15209 /// containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
15210 /// `result_ok` indicates the overall state, and the contents are provided via `contents`.
15211 pub struct CResult_LockedChannelMonitorNoneZ {
15212         /// The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
15213         /// `err` or `result` depending on the state of `result_ok`.
15214         pub contents: CResult_LockedChannelMonitorNoneZPtr,
15215         /// Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
15216         pub result_ok: bool,
15217 }
15218 #[no_mangle]
15219 /// Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
15220 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_ok(o: crate::lightning::chain::chainmonitor::LockedChannelMonitor) -> CResult_LockedChannelMonitorNoneZ {
15221         CResult_LockedChannelMonitorNoneZ {
15222                 contents: CResult_LockedChannelMonitorNoneZPtr {
15223                         result: Box::into_raw(Box::new(o)),
15224                 },
15225                 result_ok: true,
15226         }
15227 }
15228 #[no_mangle]
15229 /// Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
15230 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChannelMonitorNoneZ {
15231         CResult_LockedChannelMonitorNoneZ {
15232                 contents: CResult_LockedChannelMonitorNoneZPtr {
15233                         err: core::ptr::null_mut(),
15234                 },
15235                 result_ok: false,
15236         }
15237 }
15238 /// Checks if the given object is currently in the success state
15239 #[no_mangle]
15240 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool {
15241         o.result_ok
15242 }
15243 #[no_mangle]
15244 /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
15245 pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { }
15246 impl Drop for CResult_LockedChannelMonitorNoneZ {
15247         fn drop(&mut self) {
15248                 if self.result_ok {
15249                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
15250                                 let _ = unsafe { Box::from_raw(self.contents.result) };
15251                         }
15252                 } else {
15253                 }
15254         }
15255 }
15256 impl From<crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>> for CResult_LockedChannelMonitorNoneZ {
15257         fn from(mut o: crate::c_types::CResultTempl<crate::lightning::chain::chainmonitor::LockedChannelMonitor, ()>) -> Self {
15258                 let contents = if o.result_ok {
15259                         let result = unsafe { o.contents.result };
15260                         unsafe { o.contents.result = core::ptr::null_mut() };
15261                         CResult_LockedChannelMonitorNoneZPtr { result }
15262                 } else {
15263                         let _ = unsafe { Box::from_raw(o.contents.err) };
15264                         o.contents.err = core::ptr::null_mut();
15265                         CResult_LockedChannelMonitorNoneZPtr { err: core::ptr::null_mut() }
15266                 };
15267                 Self {
15268                         contents,
15269                         result_ok: o.result_ok,
15270                 }
15271         }
15272 }
15273 #[repr(C)]
15274 /// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
15275 /// This corresponds to std::vector in C++
15276 pub struct CVec_OutPointZ {
15277         /// The elements in the array.
15278         /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
15279         pub data: *mut crate::lightning::chain::transaction::OutPoint,
15280         /// The number of elements pointed to by `data`.
15281         pub datalen: usize
15282 }
15283 impl CVec_OutPointZ {
15284         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::lightning::chain::transaction::OutPoint> {
15285                 if self.datalen == 0 { return Vec::new(); }
15286                 let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
15287                 self.data = core::ptr::null_mut();
15288                 self.datalen = 0;
15289                 ret
15290         }
15291         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::transaction::OutPoint] {
15292                 unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }
15293         }
15294 }
15295 impl From<Vec<crate::lightning::chain::transaction::OutPoint>> for CVec_OutPointZ {
15296         fn from(v: Vec<crate::lightning::chain::transaction::OutPoint>) -> Self {
15297                 let datalen = v.len();
15298                 let data = Box::into_raw(v.into_boxed_slice());
15299                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
15300         }
15301 }
15302 #[no_mangle]
15303 /// Frees the buffer pointed to by `data` if `datalen` is non-0.
15304 pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { }
15305 impl Drop for CVec_OutPointZ {
15306         fn drop(&mut self) {
15307                 if self.datalen == 0 { return; }
15308                 unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) };
15309         }
15310 }
15311 impl Clone for CVec_OutPointZ {
15312         fn clone(&self) -> Self {
15313                 let mut res = Vec::new();
15314                 if self.datalen == 0 { return Self::from(res); }
15315                 res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) });
15316                 Self::from(res)
15317         }
15318 }